reed@google.com | dceecc7 | 2012-02-23 19:20:19 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2012 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 "SkBitmap.h" |
| 10 | #include "SkCanvas.h" |
| 11 | |
| 12 | static SkCanvas* create(SkBitmap::Config config, int w, int h, int rb, |
| 13 | void* addr = NULL) { |
| 14 | SkBitmap bm; |
| 15 | bm.setConfig(config, w, h, rb); |
| 16 | if (addr) { |
| 17 | bm.setPixels(addr); |
| 18 | } else { |
| 19 | bm.allocPixels(); |
| 20 | } |
| 21 | return new SkCanvas(bm); |
| 22 | } |
| 23 | |
| 24 | // we used to assert if the bounds of the device (clip) was larger than 32K |
| 25 | // even when the path itself was smaller. We just draw and hope in the debug |
| 26 | // version to not assert. |
| 27 | static void test_giantaa(skiatest::Reporter* reporter) { |
| 28 | const int W = 400; |
| 29 | const int H = 400; |
| 30 | SkCanvas* canvas = create(SkBitmap::kARGB_8888_Config, 33000, 10, 0, NULL); |
| 31 | canvas->clear(0); |
| 32 | |
| 33 | SkPaint paint; |
| 34 | paint.setAntiAlias(true); |
| 35 | SkPath path; |
| 36 | path.addOval(SkRect::MakeXYWH(-10, -10, 20 + W, 20 + H)); |
| 37 | canvas->drawPath(path, paint); |
| 38 | canvas->unref(); |
| 39 | } |
| 40 | |
| 41 | static void TestDrawPath(skiatest::Reporter* reporter) { |
| 42 | test_giantaa(reporter); |
| 43 | } |
| 44 | |
| 45 | #include "TestClassDef.h" |
| 46 | DEFINE_TESTCLASS("DrawPath", TestDrawPathClass, TestDrawPath) |