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

Side by Side Diff: gm/imageblurtiled.cpp

Issue 1518643002: SkBlurImageFilter returns input when sigma = 0 (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: clean up Created 5 years 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
« no previous file with comments | « gm/imageblur2.cpp ('k') | gm/imagefilters.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 2014 Google Inc. 2 * Copyright 2014 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 "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 13 matching lines...) Expand all
24 virtual SkString onShortName() { 24 virtual SkString onShortName() {
25 return SkString("imageblurtiled"); 25 return SkString("imageblurtiled");
26 } 26 }
27 27
28 virtual SkISize onISize() { 28 virtual SkISize onISize() {
29 return SkISize::Make(WIDTH, HEIGHT); 29 return SkISize::Make(WIDTH, HEIGHT);
30 } 30 }
31 31
32 virtual void onDraw(SkCanvas* canvas) { 32 virtual void onDraw(SkCanvas* canvas) {
33 SkPaint paint; 33 SkPaint paint;
34 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref (); 34 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(fSigmaX, fSig maY));
35 paint.setImageFilter(blur);
35 const SkScalar tile_size = SkIntToScalar(128); 36 const SkScalar tile_size = SkIntToScalar(128);
36 SkRect bounds; 37 SkRect bounds;
37 if (!canvas->getClipBounds(&bounds)) { 38 if (!canvas->getClipBounds(&bounds)) {
38 bounds.setEmpty(); 39 bounds.setEmpty();
39 } 40 }
40 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tile_size) { 41 for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tile_size) {
41 for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size) { 42 for (SkScalar x = bounds.left(); x < bounds.right(); x += tile_size) {
42 canvas->save(); 43 canvas->save();
43 canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size)); 44 canvas->clipRect(SkRect::MakeXYWH(x, y, tile_size, tile_size));
44 canvas->saveLayer(nullptr, &paint); 45 canvas->saveLayer(nullptr, &paint);
(...skipping 25 matching lines...) Expand all
70 71
71 typedef GM INHERITED; 72 typedef GM INHERITED;
72 }; 73 };
73 74
74 ////////////////////////////////////////////////////////////////////////////// 75 //////////////////////////////////////////////////////////////////////////////
75 76
76 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); } 77 static GM* MyFactory1(void*) { return new ImageBlurTiledGM(3.0f, 3.0f); }
77 static GMRegistry reg1(MyFactory1); 78 static GMRegistry reg1(MyFactory1);
78 79
79 } 80 }
OLDNEW
« no previous file with comments | « gm/imageblur2.cpp ('k') | gm/imagefilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698