1 /*
2 * Copyright 2016 Google Inc.
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/SkCanvas.h"
10 #include "include/core/SkColorType.h"
11 #include "include/core/SkFont.h"
12 #include "include/core/SkImageInfo.h"
13 #include "include/core/SkPaint.h"
14 #include "include/core/SkRefCnt.h"
15 #include "include/core/SkSurface.h"
16 #include "include/core/SkTypes.h"
17 #include "include/gpu/GpuTypes.h"
18 #include "include/gpu/ganesh/GrDirectContext.h"
19 #include "include/gpu/ganesh/SkSurfaceGanesh.h"
20 #include "tests/CtsEnforcement.h"
21 #include "tests/Test.h"
22 #include "tools/fonts/FontToolUtils.h"
23
24 struct GrContextOptions;
25
26 // This passes by not crashing.
test(SkCanvas * canvas)27 static void test(SkCanvas* canvas) {
28 canvas->scale(63, 0);
29 canvas->drawString("A", 50, 50, ToolUtils::DefaultFont(), SkPaint());
30 }
31
DEF_TEST(skbug5221,r)32 DEF_TEST(skbug5221, r) {
33 sk_sp<SkSurface> surface(SkSurfaces::Raster(SkImageInfo::MakeN32Premul(256, 256)));
34 test(surface->getCanvas());
35 }
36
DEF_GANESH_TEST_FOR_ALL_CONTEXTS(skbug5221_GPU,r,contextInfo,CtsEnforcement::kNever)37 DEF_GANESH_TEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo, CtsEnforcement::kNever) {
38 sk_sp<SkSurface> surface(SkSurfaces::RenderTarget(
39 contextInfo.directContext(),
40 skgpu::Budgeted::kYes,
41 SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType)));
42 test(surface->getCanvas());
43 }
44