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

Unified Diff: gm/displacement.cpp

Issue 834303005: Factor out checkerboard function in gm and sampleapp into tools. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rename to sk_tools::DrawCheckerboard Created 5 years, 11 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 | « gm/colorwheel.cpp ('k') | gm/imagefiltersclipped.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/displacement.cpp
diff --git a/gm/displacement.cpp b/gm/displacement.cpp
index dddf8a53c4b3920e6177f8728ce48ae3fe8208d0..f35d5acd3f23a99f26e697b1871e7b48b6b9af3b 100644
--- a/gm/displacement.cpp
+++ b/gm/displacement.cpp
@@ -5,9 +5,10 @@
* found in the LICENSE file.
*/
-#include "gm.h"
-#include "SkDisplacementMapEffect.h"
+#include "Checkerboard.h"
#include "SkBitmapSource.h"
+#include "SkDisplacementMapEffect.h"
+#include "gm.h"
namespace skiagm {
@@ -47,22 +48,7 @@ protected:
void make_checkerboard(SkBitmap* bitmap, int w, int h) {
bitmap->allocN32Pixels(w, h);
SkCanvas canvas(*bitmap);
- canvas.clear(0x00000000);
- SkPaint darkPaint;
- darkPaint.setColor(0xFF804020);
- SkPaint lightPaint;
- lightPaint.setColor(0xFF244484);
- for (int y = 0; y < h; y += 16) {
- for (int x = 0; x < w; x += 16) {
- canvas.save();
- canvas.translate(SkIntToScalar(x), SkIntToScalar(y));
- canvas.drawRect(SkRect::MakeXYWH(0, 0, 8, 8), darkPaint);
- canvas.drawRect(SkRect::MakeXYWH(8, 0, 8, 8), lightPaint);
- canvas.drawRect(SkRect::MakeXYWH(0, 8, 8, 8), lightPaint);
- canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint);
- canvas.restore();
- }
- }
+ sk_tools::DrawCheckerboard(&canvas, 0xFF244484, 0xFF804020, 8);
}
virtual SkISize onISize() {
« no previous file with comments | « gm/colorwheel.cpp ('k') | gm/imagefiltersclipped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698