bsalomon | 40ef485 | 2016-05-02 13:22:13 -0700 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "tests/Test.h" |
Hal Canary | a70ae1a | 2019-01-08 15:04:23 -0500 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/core/SkCanvas.h" |
| 11 | #include "include/core/SkFont.h" |
| 12 | #include "include/core/SkSurface.h" |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 13 | #include "include/gpu/GrDirectContext.h" |
bsalomon | 40ef485 | 2016-05-02 13:22:13 -0700 | [diff] [blame] | 14 | |
| 15 | // This passes by not crashing. |
| 16 | static void test(SkCanvas* canvas) { |
bsalomon | 40ef485 | 2016-05-02 13:22:13 -0700 | [diff] [blame] | 17 | canvas->scale(63, 0); |
Hal Canary | a70ae1a | 2019-01-08 15:04:23 -0500 | [diff] [blame] | 18 | canvas->drawString("A", 50, 50, SkFont(), SkPaint()); |
bsalomon | 40ef485 | 2016-05-02 13:22:13 -0700 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | DEF_TEST(skbug5221, r) { |
| 22 | sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256))); |
| 23 | test(surface->getCanvas()); |
| 24 | } |
| 25 | |
bsalomon | 40ef485 | 2016-05-02 13:22:13 -0700 | [diff] [blame] | 26 | DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) { |
Brian Salomon | ae38f6e | 2017-06-23 12:04:22 -0400 | [diff] [blame] | 27 | sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget( |
Robert Phillips | 6d344c3 | 2020-07-06 10:56:46 -0400 | [diff] [blame] | 28 | contextInfo.directContext(), SkBudgeted::kYes, |
Brian Salomon | ae38f6e | 2017-06-23 12:04:22 -0400 | [diff] [blame] | 29 | SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType))); |
bsalomon | 40ef485 | 2016-05-02 13:22:13 -0700 | [diff] [blame] | 30 | test(surface->getCanvas()); |
| 31 | } |