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

Side by Side Diff: gm/matriximagefilter.cpp

Issue 1858353002: Update SkMatrixImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix fuzz 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 | « gm/imageresizetiled.cpp ('k') | gm/resizeimagefilter.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 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 "gm.h" 8 #include "gm.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkImageFilter.h" 10 #include "SkImageFilter.h"
11 11
12 static void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap, 12 static void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap,
13 const SkMatrix& matrix, SkFilterQuality filter) { 13 const SkMatrix& matrix, SkFilterQuality filter) {
14 SkAutoTUnref<SkImageFilter> imageFilter(
15 SkImageFilter::CreateMatrixFilter(matrix, filter));
16 SkPaint paint; 14 SkPaint paint;
17 paint.setImageFilter(imageFilter.get()); 15 paint.setImageFilter(SkImageFilter::MakeMatrixFilter(matrix, filter, nul lptr));
18 canvas->saveLayer(&rect, &paint); 16 canvas->saveLayer(&rect, &paint);
19 canvas->drawBitmap(bitmap, 0, 0); 17 canvas->drawBitmap(bitmap, 0, 0);
20 canvas->restore(); 18 canvas->restore();
21 } 19 }
22 20
23 static void make_checkerboard(SkBitmap* bitmap) { 21 static void make_checkerboard(SkBitmap* bitmap) {
24 bitmap->allocN32Pixels(64, 64); 22 bitmap->allocN32Pixels(64, 64);
25 SkCanvas canvas(*bitmap); 23 SkCanvas canvas(*bitmap);
26 SkPaint darkPaint; 24 SkPaint darkPaint;
27 darkPaint.setColor(sk_tool_utils::color_to_565(0xFF404040)); 25 darkPaint.setColor(sk_tool_utils::color_to_565(0xFF404040));
(...skipping 29 matching lines...) Expand all
57 55
58 #if 0 56 #if 0
59 // This may be causing Mac 10.6 to barf. 57 // This may be causing Mac 10.6 to barf.
60 canvas->translate(srcRect.width() + margin, 0); 58 canvas->translate(srcRect.width() + margin, 0);
61 draw(canvas, srcRect, checkerboard, matrix, kMedium_SkFilterQuality); 59 draw(canvas, srcRect, checkerboard, matrix, kMedium_SkFilterQuality);
62 60
63 canvas->translate(srcRect.width() + margin, 0); 61 canvas->translate(srcRect.width() + margin, 0);
64 draw(canvas, srcRect, checkerboard, matrix, kHigh_SkFilterQuality); 62 draw(canvas, srcRect, checkerboard, matrix, kHigh_SkFilterQuality);
65 #endif 63 #endif
66 } 64 }
OLDNEW
« no previous file with comments | « gm/imageresizetiled.cpp ('k') | gm/resizeimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698