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/GrDirectContext.h"
16 #include "tests/CtsEnforcement.h"
17 #include "tests/Test.h"
18 
19 struct GrContextOptions;
20 
DEF_GANESH_TEST_FOR_ALL_CONTEXTS(skbug12214,r,contextInfo,CtsEnforcement::kApiLevel_T)21 DEF_GANESH_TEST_FOR_ALL_CONTEXTS(skbug12214, r, contextInfo, CtsEnforcement::kApiLevel_T) {
22     auto imageInfo = SkImageInfo::Make(/*width=*/32, /*height=*/32, kRGBA_8888_SkColorType,
23                                        kPremul_SkAlphaType);
24     sk_sp<SkSurface> surface1 = SkSurface::MakeRenderTarget(
25             contextInfo.directContext(), skgpu::Budgeted::kNo, imageInfo);
26     sk_sp<SkSurface> surface2 = SkSurface::MakeRaster(imageInfo);
27 
28     // The test succeeds if this draw does not crash. (See skia:12214)
29     surface1->draw(surface2->getCanvas(), /*x=*/0, /*y=*/0);
30 }
31