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

Side by Side Diff: gm/imagefilterscropped.cpp

Issue 1657773002: Fix zero-sized blur with crop rect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixes per review comments Created 4 years, 10 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
« no previous file with comments | « no previous file | src/effects/SkBlurImageFilter.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 canvas->drawBitmap(bm, 0, 0, &paint); 65 canvas->drawBitmap(bm, 0, 0, &paint);
66 } 66 }
67 67
68 /////////////////////////////////////////////////////////////////////////////// 68 ///////////////////////////////////////////////////////////////////////////////
69 69
70 class ImageFiltersCroppedGM : public skiagm::GM { 70 class ImageFiltersCroppedGM : public skiagm::GM {
71 public: 71 public:
72 ImageFiltersCroppedGM () {} 72 ImageFiltersCroppedGM () {}
73 73
74 protected: 74 protected:
75 virtual SkString onShortName() override { 75 SkString onShortName() override {
76 return SkString("imagefilterscropped"); 76 return SkString("imagefilterscropped");
77 } 77 }
78 78
79 virtual SkISize onISize() override { return SkISize::Make(400, 880); } 79 SkISize onISize() override { return SkISize::Make(400, 960); }
80 80
81 void make_checkerboard() { 81 void make_checkerboard() {
82 fCheckerboard.allocN32Pixels(80, 80); 82 fCheckerboard.allocN32Pixels(80, 80);
83 SkCanvas canvas(fCheckerboard); 83 SkCanvas canvas(fCheckerboard);
84 canvas.clear(SK_ColorTRANSPARENT); 84 canvas.clear(SK_ColorTRANSPARENT);
85 SkPaint darkPaint; 85 SkPaint darkPaint;
86 darkPaint.setColor(sk_tool_utils::color_to_565(0xFF404040)); 86 darkPaint.setColor(sk_tool_utils::color_to_565(0xFF404040));
87 SkPaint lightPaint; 87 SkPaint lightPaint;
88 lightPaint.setColor(sk_tool_utils::color_to_565(0xFFA0A0A0)); 88 lightPaint.setColor(sk_tool_utils::color_to_565(0xFFA0A0A0));
89 for (int y = 0; y < 80; y += 16) { 89 for (int y = 0; y < 80; y += 16) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 SkIntToScalar(-10), SkIntToScalar(-10))); 124 SkIntToScalar(-10), SkIntToScalar(-10)));
125 125
126 SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf .get(), offset.get())); 126 SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf .get(), offset.get()));
127 127
128 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null ptr, &cropRect)); 128 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null ptr, &cropRect));
129 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null ptr, &cropRect)); 129 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null ptr, &cropRect));
130 130
131 SkImageFilter* filters[] = { 131 SkImageFilter* filters[] = {
132 nullptr, 132 nullptr,
133 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect), 133 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect),
134 SkBlurImageFilter::Create(0.0f, 0.0f, nullptr, &cropRect),
134 SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect), 135 SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect),
135 SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect), 136 SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect),
136 SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect), 137 SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect),
137 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect), 138 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect),
138 SkErodeImageFilter::Create(1, 1, nullptr, &cropRect), 139 SkErodeImageFilter::Create(1, 1, nullptr, &cropRect),
139 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect), 140 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect),
140 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect), 141 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect),
141 SkErodeImageFilter::Create(8, 8, nullptr, &cropRect), 142 SkErodeImageFilter::Create(8, 8, nullptr, &cropRect),
142 SkMergeImageFilter::Create(nullptr, cfOffset.get(), SkXfermode::kSrc Over_Mode, &cropRect), 143 SkMergeImageFilter::Create(nullptr, cfOffset.get(), SkXfermode::kSrc Over_Mode, &cropRect),
143 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect), 144 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect),
(...skipping 24 matching lines...) Expand all
168 } 169 }
169 170
170 private: 171 private:
171 SkBitmap fCheckerboard; 172 SkBitmap fCheckerboard;
172 typedef GM INHERITED; 173 typedef GM INHERITED;
173 }; 174 };
174 175
175 /////////////////////////////////////////////////////////////////////////////// 176 ///////////////////////////////////////////////////////////////////////////////
176 177
177 DEF_GM( return new ImageFiltersCroppedGM; ) 178 DEF_GM( return new ImageFiltersCroppedGM; )
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698