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: gm/imagefilters.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « gm/imagealphathreshold.cpp ('k') | gm/imagefiltersclipped.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 2015 Google Inc. 2 * Copyright 2015 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 "SkColorMatrixFilter.h" 10 #include "SkColorMatrixFilter.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 canvas->translate(240, 0); 61 canvas->translate(240, 0);
62 do_draw(canvas, modes[i], imf); 62 do_draw(canvas, modes[i], imf);
63 canvas->restore(); 63 canvas->restore();
64 64
65 canvas->translate(0, 240); 65 canvas->translate(0, 240);
66 } 66 }
67 } 67 }
68 68
69 static sk_sp<SkImage> make_image(SkCanvas* canvas) { 69 static sk_sp<SkImage> make_image(SkCanvas* canvas) {
70 const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); 70 const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
71 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); 71 auto surface(canvas->makeSurface(info));
72 if (!surface) { 72 if (!surface) {
73 surface.reset(SkSurface::NewRaster(info)); 73 surface = SkSurface::MakeRaster(info);
74 } 74 }
75 surface->getCanvas()->drawRect(SkRect::MakeXYWH(25, 25, 50, 50), SkPaint()); 75 surface->getCanvas()->drawRect(SkRect::MakeXYWH(25, 25, 50, 50), SkPaint());
76 return surface->makeImageSnapshot(); 76 return surface->makeImageSnapshot();
77 } 77 }
78 78
79 // Compare blurs when we're tightly clipped (fast) and not as tightly (slower) 79 // Compare blurs when we're tightly clipped (fast) and not as tightly (slower)
80 // 80 //
81 // Expect the two to draw the same (modulo the extra border of pixels when the c lip is larger) 81 // Expect the two to draw the same (modulo the extra border of pixels when the c lip is larger)
82 // 82 //
83 DEF_SIMPLE_GM(fast_slow_blurimagefilter, canvas, 620, 260) { 83 DEF_SIMPLE_GM(fast_slow_blurimagefilter, canvas, 620, 260) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 canvas->scale(xform.fSx, xform.fSy); 171 canvas->scale(xform.fSx, xform.fSy);
172 canvas->drawImage(image, 0, 0, &paint); 172 canvas->drawImage(image, 0, 0, &paint);
173 draw_set(canvas, filters, SK_ARRAY_COUNT(filters)); 173 draw_set(canvas, filters, SK_ARRAY_COUNT(filters));
174 canvas->restore(); 174 canvas->restore();
175 } 175 }
176 176
177 for (auto& filter : filters) { 177 for (auto& filter : filters) {
178 filter->unref(); 178 filter->unref();
179 } 179 }
180 } 180 }
OLDNEW
« no previous file with comments | « gm/imagealphathreshold.cpp ('k') | gm/imagefiltersclipped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698