OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |