1 /*
2 * Copyright 2021 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "include/core/SkAlphaType.h"
9 #include "include/core/SkColorType.h"
10 #include "include/core/SkImageInfo.h"
11 #include "include/core/SkRefCnt.h"
12 #include "include/core/SkSurface.h"
13 #include "include/core/SkTypes.h"
14 #include "include/gpu/GpuTypes.h"
15 #include "include/gpu/ganesh/GrDirectContext.h"
16 #include "include/gpu/ganesh/SkSurfaceGanesh.h"
17 #include "tests/CtsEnforcement.h"
18 #include "tests/Test.h"
19
20 struct GrContextOptions;
21
DEF_GANESH_TEST_FOR_ALL_CONTEXTS(skbug12214,r,contextInfo,CtsEnforcement::kApiLevel_T)22 DEF_GANESH_TEST_FOR_ALL_CONTEXTS(skbug12214, r, contextInfo, CtsEnforcement::kApiLevel_T) {
23 auto imageInfo = SkImageInfo::Make(/*width=*/32, /*height=*/32, kRGBA_8888_SkColorType,
24 kPremul_SkAlphaType);
25 sk_sp<SkSurface> surface1 =
26 SkSurfaces::RenderTarget(contextInfo.directContext(), skgpu::Budgeted::kNo, imageInfo);
27 sk_sp<SkSurface> surface2 = SkSurfaces::Raster(imageInfo);
28
29 // The test succeeds if this draw does not crash. (See skia:12214)
30 surface1->draw(surface2->getCanvas(), /*x=*/0, /*y=*/0);
31 }
32