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

Side by Side Diff: gm/offsetimagefilter.cpp

Issue 27521002: Remove support for SK_CROP_RECT_IS_INT, now that it is no longer used in Blink or Chrome. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add comment Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/morphology.cpp ('k') | gm/xfermodeimagefilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkOffsetImageFilter.h" 9 #include "SkOffsetImageFilter.h"
10 #include "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 canvas->clear(0x00000000); 85 canvas->clear(0x00000000);
86 SkPaint paint; 86 SkPaint paint;
87 87
88 int x = 0, y = 0; 88 int x = 0, y = 0;
89 for (size_t i = 0; i < 4; i++) { 89 for (size_t i = 0; i < 4; i++) {
90 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap; 90 SkBitmap* bitmap = (i & 0x01) ? &fCheckerboard : &fBitmap;
91 SkIRect cropRect = SkIRect::MakeXYWH(x + i * 12, 91 SkIRect cropRect = SkIRect::MakeXYWH(x + i * 12,
92 y + i * 8, 92 y + i * 8,
93 bitmap->width() - i * 8, 93 bitmap->width() - i * 8,
94 bitmap->height() - i * 12); 94 bitmap->height() - i * 12);
95 #ifdef SK_CROP_RECT_IS_INT
96 SkIRect rect = cropRect;
97 #else
98 SkImageFilter::CropRect rect(SkRect::Make(cropRect)); 95 SkImageFilter::CropRect rect(SkRect::Make(cropRect));
99 #endif
100 SkAutoTUnref<SkImageFilter> tileInput(SkNEW_ARGS(SkBitmapSource, (*b itmap))); 96 SkAutoTUnref<SkImageFilter> tileInput(SkNEW_ARGS(SkBitmapSource, (*b itmap)));
101 SkScalar dx = SkIntToScalar(i*5); 97 SkScalar dx = SkIntToScalar(i*5);
102 SkScalar dy = SkIntToScalar(i*10); 98 SkScalar dy = SkIntToScalar(i*10);
103 SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS( 99 SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(
104 SkOffsetImageFilter, (dx, dy, tileInput, &rect))); 100 SkOffsetImageFilter, (dx, dy, tileInput, &rect)));
105 paint.setImageFilter(filter); 101 paint.setImageFilter(filter);
106 drawClippedBitmap(canvas, *bitmap, paint, SkIntToScalar(x), SkIntToS calar(y)); 102 drawClippedBitmap(canvas, *bitmap, paint, SkIntToScalar(x), SkIntToS calar(y));
107 x += bitmap->width() + MARGIN; 103 x += bitmap->width() + MARGIN;
108 if (x + bitmap->width() > WIDTH) { 104 if (x + bitmap->width() > WIDTH) {
109 x = 0; 105 x = 0;
110 y += bitmap->height() + MARGIN; 106 y += bitmap->height() + MARGIN;
111 } 107 }
112 } 108 }
113 } 109 }
114 private: 110 private:
115 typedef GM INHERITED; 111 typedef GM INHERITED;
116 SkBitmap fBitmap, fCheckerboard; 112 SkBitmap fBitmap, fCheckerboard;
117 bool fInitialized; 113 bool fInitialized;
118 }; 114 };
119 115
120 ////////////////////////////////////////////////////////////////////////////// 116 //////////////////////////////////////////////////////////////////////////////
121 117
122 static GM* MyFactory(void*) { return new OffsetImageFilterGM; } 118 static GM* MyFactory(void*) { return new OffsetImageFilterGM; }
123 static GMRegistry reg(MyFactory); 119 static GMRegistry reg(MyFactory);
124 120
125 } 121 }
OLDNEW
« no previous file with comments | « gm/morphology.cpp ('k') | gm/xfermodeimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698