Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Unified Diff: gm/pictureshader.cpp

Issue 896093005: GM for http://skbug.com/3398 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/pictureshader.cpp
diff --git a/gm/pictureshader.cpp b/gm/pictureshader.cpp
index eccf6a62875df213dac79440bea9983f2203c78a..630ecd8f0c60d7f456fc2e55f24b9240a705163d 100644
--- a/gm/pictureshader.cpp
+++ b/gm/pictureshader.cpp
@@ -180,3 +180,38 @@ private:
};
DEF_GM( return SkNEW_ARGS(PictureShaderGM, (50, 100)); )
+
+DEF_SIMPLE_GM(tiled_picture_shader, canvas, 400, 400) {
+ // https://code.google.com/p/skia/issues/detail?id=3398
+ SkRect tile = SkRect::MakeWH(100, 100);
+
+ SkPictureRecorder recorder;
+ SkCanvas* c = recorder.beginRecording(tile);
+
+ SkRect r = tile;
+ r.inset(4, 4);
+ SkPaint p;
+ p.setColor(0xFF303F9F); // dark blue
+ c->drawRect(r, p);
+ p.setColor(0xFFC5CAE9); // light blue
+ p.setStrokeWidth(10);
+ c->drawLine(20, 20, 80, 80, p);
+
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+ SkAutoTUnref<SkShader> shader(SkShader::CreatePictureShader(
+ picture.get(),
+ SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode,
+ NULL,
+ NULL));
+
+ p.setColor(0xFF8BC34A); // green
+ canvas->drawPaint(p);
+
+ canvas->clipRect(SkRect::MakeXYWH(0, 0, 400, 350));
+ p.setColor(0xFFB6B6B6); // gray
+ canvas->drawPaint(p);
+ p.setShader(shader.get());
+
+ canvas->drawPaint(p);
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698