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 | |
| 8 | #include "Test.h" |
| 9 | #include "SkCanvas.h" |
| 10 | #include "SkSurface.h" |
| 11 | |
| 12 | // This passes by not crashing. |
| 13 | static void test(SkCanvas* canvas) { |
| 14 | SkPaint paint; |
| 15 | paint.setAntiAlias(true); |
| 16 | canvas->scale(63, 0); |
| 17 | static const char kTxt[] = "A"; |
| 18 | canvas->drawText(kTxt, SK_ARRAY_COUNT(kTxt), 50, 50, paint); |
| 19 | } |
| 20 | |
| 21 | DEF_TEST(skbug5221, r) { |
| 22 | sk_sp<SkSurface> surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(256, 256))); |
| 23 | test(surface->getCanvas()); |
| 24 | } |
| 25 | |
| 26 | #if SK_SUPPORT_GPU |
| 27 | DEF_GPUTEST_FOR_ALL_CONTEXTS(skbug5221_GPU, r, contextInfo) { |
bsalomon | 8b7451a | 2016-05-11 06:33:06 -0700 | [diff] [blame] | 28 | sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(contextInfo.grContext(), SkBudgeted::kYes, |
robertphillips | 7e92276 | 2016-07-26 11:38:17 -0700 | [diff] [blame] | 29 | SkImageInfo::MakeN32Premul(256, 256))); |
bsalomon | 40ef485 | 2016-05-02 13:22:13 -0700 | [diff] [blame] | 30 | test(surface->getCanvas()); |
| 31 | } |
| 32 | #endif |