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

Unified Diff: gm/repeated_bitmap.cpp

Issue 918813002: PDF: Add (low-memory) SkPDFBitmap class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: mutable bitmaps get copied 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 | gyp/gmslides.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/repeated_bitmap.cpp
diff --git a/gm/repeated_bitmap.cpp b/gm/repeated_bitmap.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fa5fe0c1363ab418b8952602ba993a0d76152f2f
--- /dev/null
+++ b/gm/repeated_bitmap.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "gm.h"
+#include "sk_tool_utils.h"
+#include "Resources.h"
+
+DEF_SIMPLE_GM(repeated_bitmap, canvas, 576, 576) {
+ sk_tool_utils::draw_checkerboard(canvas, 0xFF999999, SK_ColorWHITE, 12);
+ SkRect rect = SkRect::MakeLTRB(-4.25f, -4.25f, 4.25f, 4.25f);
+ SkPaint paint;
+ paint.setColor(0xFF333333);
+ SkBitmap bm;
+ if (GetResourceAsBitmap("randPixels.png", &bm)) {
+ for (int j = 0; j < 4; ++j) {
+ for (int i = 0; i < 4; ++i) {
+ SkAutoCanvasRestore autoCanvasRestore(canvas, true);
+ canvas->scale(12.0f, 12.0f);
+ canvas->translate(6.0f + 12.0f * SkIntToScalar(i),
+ 6.0f + 12.0f * SkIntToScalar(j));
+ canvas->rotate(18.0f * (i + 4 * j));
+ canvas->drawRect(rect, paint);
+ canvas->drawBitmap(bm, -4.0f, -4.0f);
+ }
+ }
+ }
+}
« no previous file with comments | « no previous file | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698