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

Side by Side Diff: tests/RecordOptsTest.cpp

Issue 1852743002: Update SkBlurImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT & address code review comments 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 recorder.saveLayer(nullptr, &alphaOnlyLayerPaint); 181 recorder.saveLayer(nullptr, &alphaOnlyLayerPaint);
182 recorder.drawRect(draw, opaqueDrawPaint); 182 recorder.drawRect(draw, opaqueDrawPaint);
183 recorder.restore(); 183 recorder.restore();
184 assert_savelayer_draw_restore(r, &record, 15, true); 184 assert_savelayer_draw_restore(r, &record, 15, true);
185 185
186 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re cord, 16); 186 const SkRecords::DrawRect* drawRect = assert_type<SkRecords::DrawRect>(r, re cord, 16);
187 REPORTER_ASSERT(r, drawRect != nullptr); 187 REPORTER_ASSERT(r, drawRect != nullptr);
188 REPORTER_ASSERT(r, drawRect->paint.getColor() == 0x03020202); 188 REPORTER_ASSERT(r, drawRect->paint.getColor() == 0x03020202);
189 189
190 // saveLayer w/ backdrop should NOT go away 190 // saveLayer w/ backdrop should NOT go away
191 SkAutoTUnref<SkImageFilter> filter(SkBlurImageFilter::Create(3, 3)); 191 sk_sp<SkImageFilter> filter(SkBlurImageFilter::Make(3, 3, nullptr));
192 recorder.saveLayer({ nullptr, nullptr, filter, 0}); 192 recorder.saveLayer({ nullptr, nullptr, filter.get(), 0});
193 recorder.drawRect(draw, opaqueDrawPaint); 193 recorder.drawRect(draw, opaqueDrawPaint);
194 recorder.restore(); 194 recorder.restore();
195 assert_savelayer_draw_restore(r, &record, 18, false); 195 assert_savelayer_draw_restore(r, &record, 18, false);
196 } 196 }
197 197
198 static void assert_merge_svg_opacity_and_filter_layers(skiatest::Reporter* r, 198 static void assert_merge_svg_opacity_and_filter_layers(skiatest::Reporter* r,
199 SkRecord* record, 199 SkRecord* record,
200 int i, 200 int i,
201 bool shouldBeNoOped) { 201 bool shouldBeNoOped) {
202 SkRecordMergeSvgOpacityAndFilterLayers(record); 202 SkRecordMergeSvgOpacityAndFilterLayers(record);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 SkPaint shapePaint; 237 SkPaint shapePaint;
238 shapePaint.setColor(SK_ColorWHITE); 238 shapePaint.setColor(SK_ColorWHITE);
239 canvas->drawRect(SkRect::MakeWH(SkIntToScalar(50), SkIntToScalar(50)), s hapePaint); 239 canvas->drawRect(SkRect::MakeWH(SkIntToScalar(50), SkIntToScalar(50)), s hapePaint);
240 shape = recorder.finishRecordingAsPicture(); 240 shape = recorder.finishRecordingAsPicture();
241 } 241 }
242 translucentFilterLayerPaint.setImageFilter(SkPictureImageFilter::Make(shape) ); 242 translucentFilterLayerPaint.setImageFilter(SkPictureImageFilter::Make(shape) );
243 243
244 int index = 0; 244 int index = 0;
245 245
246 { 246 {
247 SkAutoTUnref<SkImageFilter> filter(SkBlurImageFilter::Create(3, 3)); 247 sk_sp<SkImageFilter> filter(SkBlurImageFilter::Make(3, 3, nullptr));
248 // first (null) should be optimized, 2nd should not 248 // first (null) should be optimized, 2nd should not
249 SkImageFilter* filters[] = { nullptr, filter.get() }; 249 SkImageFilter* filters[] = { nullptr, filter.get() };
250 250
251 // Any combination of these should cause the pattern to be optimized. 251 // Any combination of these should cause the pattern to be optimized.
252 SkRect* firstBounds[] = { nullptr, &bounds }; 252 SkRect* firstBounds[] = { nullptr, &bounds };
253 SkPaint* firstPaints[] = { nullptr, &alphaOnlyLayerPaint }; 253 SkPaint* firstPaints[] = { nullptr, &alphaOnlyLayerPaint };
254 SkRect* secondBounds[] = { nullptr, &bounds }; 254 SkRect* secondBounds[] = { nullptr, &bounds };
255 SkPaint* secondPaints[] = { &opaqueFilterLayerPaint, &translucentFilterL ayerPaint }; 255 SkPaint* secondPaints[] = { &opaqueFilterLayerPaint, &translucentFilterL ayerPaint };
256 256
257 for (auto outerF : filters) { 257 for (auto outerF : filters) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 recorder.saveLayer(nullptr, &opaqueFilterLayerPaint); 336 recorder.saveLayer(nullptr, &opaqueFilterLayerPaint);
337 recorder.restore(); 337 recorder.restore();
338 recorder.restore(); 338 recorder.restore();
339 SkRecordMergeSvgOpacityAndFilterLayers(&record); 339 SkRecordMergeSvgOpacityAndFilterLayers(&record);
340 assert_type<SkRecords::SaveLayer>(r, record, index); 340 assert_type<SkRecords::SaveLayer>(r, record, index);
341 assert_type<SkRecords::SaveLayer>(r, record, index + 1); 341 assert_type<SkRecords::SaveLayer>(r, record, index + 1);
342 assert_type<SkRecords::Restore>(r, record, index + 2); 342 assert_type<SkRecords::Restore>(r, record, index + 2);
343 assert_type<SkRecords::Restore>(r, record, index + 3); 343 assert_type<SkRecords::Restore>(r, record, index + 3);
344 index += 4; 344 index += 4;
345 } 345 }
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