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

Side by Side Diff: gm/imageblur.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 | « bench/BlurImageFilterBench.cpp ('k') | gm/imageblur2.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 2011 Google Inc. 2 * Copyright 2011 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"
11 11
12 #define WIDTH 500 12 #define WIDTH 500
13 #define HEIGHT 500 13 #define HEIGHT 500
14 14
15 void imageblurgm_draw(SkScalar fSigmaX, SkScalar fSigmaY, SkCanvas* canvas) { 15 void imageblurgm_draw(SkScalar fSigmaX, SkScalar fSigmaY, SkCanvas* canvas) {
16 SkPaint paint; 16 SkPaint paint;
17 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref (); 17 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(fSigmaX, fSig maY));
18 paint.setImageFilter(blur);
18 canvas->saveLayer(nullptr, &paint); 19 canvas->saveLayer(nullptr, &paint);
19 const char* str = "The quick brown fox jumped over the lazy dog."; 20 const char* str = "The quick brown fox jumped over the lazy dog.";
20 21
21 SkRandom rand; 22 SkRandom rand;
22 SkPaint textPaint; 23 SkPaint textPaint;
23 textPaint.setAntiAlias(true); 24 textPaint.setAntiAlias(true);
24 sk_tool_utils::set_portable_typeface(&textPaint); 25 sk_tool_utils::set_portable_typeface(&textPaint);
25 for (int i = 0; i < 25; ++i) { 26 for (int i = 0; i < 25; ++i) {
26 int x = rand.nextULessThan(WIDTH); 27 int x = rand.nextULessThan(WIDTH);
27 int y = rand.nextULessThan(HEIGHT); 28 int y = rand.nextULessThan(HEIGHT);
28 textPaint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0 xFF000000)); 29 textPaint.setColor(sk_tool_utils::color_to_565(rand.nextBits(24) | 0 xFF000000));
29 textPaint.setTextSize(rand.nextRangeScalar(0, 300)); 30 textPaint.setTextSize(rand.nextRangeScalar(0, 300));
30 canvas->drawText(str, strlen(str), SkIntToScalar(x), 31 canvas->drawText(str, strlen(str), SkIntToScalar(x),
31 SkIntToScalar(y), textPaint); 32 SkIntToScalar(y), textPaint);
32 } 33 }
33 canvas->restore(); 34 canvas->restore();
34 } 35 }
35 DEF_SIMPLE_GM_BG(imageblur, canvas, WIDTH, HEIGHT, SK_ColorBLACK) { 36 DEF_SIMPLE_GM_BG(imageblur, canvas, WIDTH, HEIGHT, SK_ColorBLACK) {
36 imageblurgm_draw(24.0f, 0.0f, canvas); 37 imageblurgm_draw(24.0f, 0.0f, canvas);
37 } 38 }
38 DEF_SIMPLE_GM_BG(imageblur_large, canvas, WIDTH, HEIGHT, SK_ColorBLACK) { 39 DEF_SIMPLE_GM_BG(imageblur_large, canvas, WIDTH, HEIGHT, SK_ColorBLACK) {
39 imageblurgm_draw(80.0f, 80.0f, canvas); 40 imageblurgm_draw(80.0f, 80.0f, canvas);
40 } 41 }
OLDNEW
« no previous file with comments | « bench/BlurImageFilterBench.cpp ('k') | gm/imageblur2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698