OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 if (cur_x + bm.width() >= fGMWidth - fMargin) { | 229 if (cur_x + bm.width() >= fGMWidth - fMargin) { |
230 cur_x = 0; | 230 cur_x = 0; |
231 cur_y += max_height + fPadding; | 231 cur_y += max_height + fPadding; |
232 max_height = 0; | 232 max_height = 0; |
233 } | 233 } |
234 | 234 |
235 canvas->save(); | 235 canvas->save(); |
236 canvas->translate((SkScalar)cur_x, (SkScalar)cur_y); | 236 canvas->translate((SkScalar)cur_x, (SkScalar)cur_y); |
237 canvas->translate(-(bm.width() - r.width())/2, -(bm.height()
-r.height())/2); | 237 canvas->translate(-(bm.width() - r.width())/2, -(bm.height()
-r.height())/2); |
238 canvas->drawBitmap(bm, 0.f, 0.f, NULL); | 238 canvas->drawBitmap(bm, 0.f, 0.f, nullptr); |
239 canvas->restore(); | 239 canvas->restore(); |
240 | 240 |
241 cur_x += bm.width() + fPadding; | 241 cur_x += bm.width() + fPadding; |
242 if (bm.height() > max_height) | 242 if (bm.height() > max_height) |
243 max_height = bm.height(); | 243 max_height = bm.height(); |
244 } | 244 } |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 return; | 306 return; |
307 } | 307 } |
308 SkAutoMaskFreeImage amfi(mask.fImage); | 308 SkAutoMaskFreeImage amfi(mask.fImage); |
309 | 309 |
310 SkBitmap bm; | 310 SkBitmap bm; |
311 bm.installMaskPixels(mask); | 311 bm.installMaskPixels(mask); |
312 | 312 |
313 center_x = (canvas_size.fWidth - mask.fBounds.width())/2; | 313 center_x = (canvas_size.fWidth - mask.fBounds.width())/2; |
314 center_y = (canvas_size.fHeight - mask.fBounds.height())/2; | 314 center_y = (canvas_size.fHeight - mask.fBounds.height())/2; |
315 | 315 |
316 canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y),
NULL); | 316 canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y),
nullptr); |
317 } | 317 } |
318 | 318 |
319 private: | 319 private: |
320 typedef GM INHERITED; | 320 typedef GM INHERITED; |
321 }; | 321 }; |
322 | 322 |
323 class BlurRectFastGM: public BlurRectCompareGM { | 323 class BlurRectFastGM: public BlurRectCompareGM { |
324 public: | 324 public: |
325 BlurRectFastGM(const char name[], unsigned int rectWidth, | 325 BlurRectFastGM(const char name[], unsigned int rectWidth, |
326 unsigned int rectHeight, float blurRadius, | 326 unsigned int rectHeight, float blurRadius, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 } | 411 } |
412 private: | 412 private: |
413 typedef BlurRectCompareGM INHERITED; | 413 typedef BlurRectCompareGM INHERITED; |
414 }; | 414 }; |
415 | 415 |
416 | 416 |
417 ////////////////////////////////////////////////////////////////////////////// | 417 ////////////////////////////////////////////////////////////////////////////// |
418 | 418 |
419 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) | 419 DEF_GM(return new BlurRectGM("blurrects", 0xFF);) |
420 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");) | 420 DEF_GM(return new BlurRectDirectGM("blurrect_gallery");) |
OLD | NEW |