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

Side by Side Diff: tests/RecordDrawTest.cpp

Issue 1861843002: Update DropShadowImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review issues Created 4 years, 8 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 | « tests/ImageFilterTest.cpp ('k') | no next file » | 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 "Test.h" 8 #include "Test.h"
9 #include "RecordTestUtils.h" 9 #include "RecordTestUtils.h"
10 10
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // This also now serves as a regression test for crbug.com/418417. We used to a djust the 202 // This also now serves as a regression test for crbug.com/418417. We used to a djust the
203 // bounds for the saveLayer, clip, and restore to be greater than the bounds of the picture. 203 // bounds for the saveLayer, clip, and restore to be greater than the bounds of the picture.
204 // (We were applying the saveLayer paint to the bounds after restore, which make s no sense.) 204 // (We were applying the saveLayer paint to the bounds after restore, which make s no sense.)
205 DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) { 205 DEF_TEST(RecordDraw_SaveLayerAffectsClipBounds, r) {
206 SkRecord record; 206 SkRecord record;
207 SkRecorder recorder(&record, 50, 50); 207 SkRecorder recorder(&record, 50, 50);
208 208
209 // We draw a rectangle with a long drop shadow. We used to not update the c lip 209 // We draw a rectangle with a long drop shadow. We used to not update the c lip
210 // bounds based on SaveLayer paints, so the drop shadow could be cut off. 210 // bounds based on SaveLayer paints, so the drop shadow could be cut off.
211 SkPaint paint; 211 SkPaint paint;
212 paint.setImageFilter(SkDropShadowImageFilter::Create(20, 0, 0, 0, SK_ColorBL ACK, 212 paint.setImageFilter(SkDropShadowImageFilter::Make(
213 SkDropShadowImageFilter::kDrawShadowAndForeground_Shado wMode))->unref(); 213 20, 0, 0, 0, SK_ColorBLACK,
214 SkDropShadowImageFilter::kDrawShadowAndForegrou nd_ShadowMode,
215 nullptr));
214 216
215 recorder.saveLayer(nullptr, &paint); 217 recorder.saveLayer(nullptr, &paint);
216 recorder.clipRect(SkRect::MakeWH(20, 40)); 218 recorder.clipRect(SkRect::MakeWH(20, 40));
217 recorder.drawRect(SkRect::MakeWH(20, 40), SkPaint()); 219 recorder.drawRect(SkRect::MakeWH(20, 40), SkPaint());
218 recorder.restore(); 220 recorder.restore();
219 221
220 // Under the original bug, the right edge value of the drawRect would be 20 less than asserted 222 // Under the original bug, the right edge value of the drawRect would be 20 less than asserted
221 // here because we intersected it with a clip that had not been adjusted for the drop shadow. 223 // here because we intersected it with a clip that had not been adjusted for the drop shadow.
222 // 224 //
223 // The second bug showed up as adjusting the picture bounds (0,0,50,50) by t he drop shadow too. 225 // The second bug showed up as adjusting the picture bounds (0,0,50,50) by t he drop shadow too.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 298
297 { 299 {
298 SkRecord record; 300 SkRecord record;
299 SkRecorder recorder(&record, 10, 10); 301 SkRecorder recorder(&record, 10, 10);
300 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr); 302 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr);
301 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); 303 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0);
302 } 304 }
303 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); 305 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled);
304 306
305 } 307 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698