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

Side by Side Diff: gm/xfermodeimagefilter.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/offsetimagefilter.cpp ('k') | include/core/SkImageFilter.h » ('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 "SkArithmeticMode.h" 9 #include "SkArithmeticMode.h"
10 #include "SkOffsetImageFilter.h" 10 #include "SkOffsetImageFilter.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 SkXfermode::kSrcOver_Mode, 200 SkXfermode::kSrcOver_Mode,
201 SkXfermode::kPlus_Mode}; 201 SkXfermode::kPlus_Mode};
202 int offsets[nbSamples][4] = {{ 10, 10, -16, -16}, 202 int offsets[nbSamples][4] = {{ 10, 10, -16, -16},
203 { 10, 10, 10, 10}, 203 { 10, 10, 10, 10},
204 {-10, -10, -6, -6}}; 204 {-10, -10, -6, -6}};
205 for (size_t i = 0; i < nbSamples; ++i) { 205 for (size_t i = 0; i < nbSamples; ++i) {
206 SkIRect cropRect = SkIRect::MakeXYWH(x + offsets[i][0], 206 SkIRect cropRect = SkIRect::MakeXYWH(x + offsets[i][0],
207 y + offsets[i][1], 207 y + offsets[i][1],
208 fBitmap.width() + offsets[i][2 ], 208 fBitmap.width() + offsets[i][2 ],
209 fBitmap.height() + offsets[i][3 ]); 209 fBitmap.height() + offsets[i][3 ]);
210 #ifdef SK_CROP_RECT_IS_INT
211 SkIRect rect = cropRect;
212 #else
213 SkImageFilter::CropRect rect(SkRect::Make(cropRect)); 210 SkImageFilter::CropRect rect(SkRect::Make(cropRect));
214 #endif
215 mode.reset(SkXfermode::Create(sampledModes[i])); 211 mode.reset(SkXfermode::Create(sampledModes[i]));
216 filter.reset(SkNEW_ARGS(SkXfermodeImageFilter, 212 filter.reset(SkNEW_ARGS(SkXfermodeImageFilter,
217 (mode, offsetBackground, offsetForeground, & rect))); 213 (mode, offsetBackground, offsetForeground, & rect)));
218 paint.setImageFilter(filter); 214 paint.setImageFilter(filter);
219 canvas->save(); 215 canvas->save();
220 canvas->clipRect(SkRect::MakeXYWH(SkIntToScalar(x), 216 canvas->clipRect(SkRect::MakeXYWH(SkIntToScalar(x),
221 SkIntToScalar(y), 217 SkIntToScalar(y),
222 SkIntToScalar(fBitmap.width() + 4) , 218 SkIntToScalar(fBitmap.width() + 4) ,
223 SkIntToScalar(fBitmap.height() + 4 ))); 219 SkIntToScalar(fBitmap.height() + 4 )));
224 canvas->drawPaint(paint); 220 canvas->drawPaint(paint);
(...skipping 10 matching lines...) Expand all
235 SkBitmap fBitmap, fCheckerboard; 231 SkBitmap fBitmap, fCheckerboard;
236 bool fInitialized; 232 bool fInitialized;
237 }; 233 };
238 234
239 ////////////////////////////////////////////////////////////////////////////// 235 //////////////////////////////////////////////////////////////////////////////
240 236
241 static GM* MyFactory(void*) { return new XfermodeImageFilterGM; } 237 static GM* MyFactory(void*) { return new XfermodeImageFilterGM; }
242 static GMRegistry reg(MyFactory); 238 static GMRegistry reg(MyFactory);
243 239
244 } 240 }
OLDNEW
« no previous file with comments | « gm/offsetimagefilter.cpp ('k') | include/core/SkImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698