aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-03-06 13:40:24 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-06 19:56:46 +0000
commitbe1b3971806e3d80aa9673a36e2b35d0145198ac (patch)
treefec8c2a345951fdd14b4c5da392586f231cb9c92 /gm
parent18e9ba1eddb09bff6083f9a83dc569d3b3b54fe6 (diff)
add tiler for SkDraw
Bug: skia:2122 Change-Id: I276de2064939151eef5fa14c53188e8b5728b7c9 Reviewed-on: https://skia-review.googlesource.com/110840 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'gm')
-rw-r--r--gm/hugepath.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/gm/hugepath.cpp b/gm/hugepath.cpp
index 83dff9ec3e..4a691b8182 100644
--- a/gm/hugepath.cpp
+++ b/gm/hugepath.cpp
@@ -8,6 +8,7 @@
#include "gm.h"
#include "SkCanvas.h"
#include "SkPath.h"
+#include "SkSurface.h"
DEF_SIMPLE_GM(path_huge_crbug_800804, canvas, 50, 600) {
SkPaint paint;
@@ -35,3 +36,35 @@ DEF_SIMPLE_GM(path_huge_crbug_800804, canvas, 50, 600) {
}
}
+// Test that we can draw into a huge surface ( > 64K ) and still retain paths and antialiasing.
+DEF_SIMPLE_GM(path_huge_aa, canvas, 200, 200) {
+ auto proc = [](SkCanvas* canvas, int w, int h) {
+ SkAutoCanvasRestore acr(canvas, true);
+
+ auto surf = SkSurface::MakeRasterN32Premul(w, h);
+ auto can = surf->getCanvas();
+
+ SkPaint paint;
+ SkPath path;
+ path.addRoundRect(SkRect::MakeXYWH(4, 4, w - 8, h - 8), 12, 12);
+
+ canvas->save();
+ canvas->clipRect(SkRect::MakeXYWH(4, 4, 64, 64));
+ can->drawPath(path, paint);
+ surf->draw(canvas, 64 - w, 0, nullptr);
+ canvas->restore();
+
+ canvas->translate(80, 0);
+ canvas->save();
+ canvas->clipRect(SkRect::MakeXYWH(4, 4, 64, 64));
+ can->clear(0);
+ paint.setAntiAlias(true);
+ can->drawPath(path, paint);
+ surf->draw(canvas, 64 - w, 0, nullptr);
+ canvas->restore();
+ };
+
+ proc(canvas, 100, 60);
+ canvas->translate(0, 80);
+ proc(canvas, 100 * 1024, 60);
+}