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 "tests/Test.h"
9
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkSurface.h"
12 #include "include/gpu/GrDirectContext.h"
13
DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug12214,r,contextInfo)14 DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug12214, r, contextInfo) {
15 auto imageInfo = SkImageInfo::Make(/*width=*/32, /*height=*/32, kRGBA_8888_SkColorType,
16 kPremul_SkAlphaType);
17 sk_sp<SkSurface> surface1 = SkSurface::MakeRenderTarget(contextInfo.directContext(),
18 SkBudgeted::kNo, imageInfo);
19 sk_sp<SkSurface> surface2 = SkSurface::MakeRaster(imageInfo);
20
21 // The test succeeds if this draw does not crash. (See skia:12214)
22 surface1->draw(surface2->getCanvas(), /*x=*/0, /*y=*/0);
23 }
24