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

Side by Side Diff: gm/imagefilterscropexpand.cpp

Issue 1842243002: Update SkImageSource to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT 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/imagefiltersclipped.cpp ('k') | gm/imagefiltersgraph.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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 30 matching lines...) Expand all
41 41
42 void onDraw(SkCanvas* canvas) override { 42 void onDraw(SkCanvas* canvas) override {
43 SkImageFilter::CropRect cropRect( 43 SkImageFilter::CropRect cropRect(
44 SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), 44 SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)),
45 SkImageFilter::CropRect::kHasAll_CropEdge); 45 SkImageFilter::CropRect::kHasAll_CropEdge);
46 46
47 sk_sp<SkImage> gradientCircle(MakeGradientCircle(64, 64)); 47 sk_sp<SkImage> gradientCircle(MakeGradientCircle(64, 64));
48 SkBitmap checkerboard; 48 SkBitmap checkerboard;
49 MakeCheckerboard(&checkerboard); 49 MakeCheckerboard(&checkerboard);
50 50
51 SkAutoTUnref<SkImageFilter> gradientCircleSource( 51 sk_sp<SkImageFilter> gradientCircleSource(SkImageSource::Make(std::move( gradientCircle)));
52 SkImageSource::Create(gradientCircle.get()));
53 sk_sp<SkImageFilter> noopCropped(SkOffsetImageFilter::Make(0, 0, nullptr , &cropRect)); 52 sk_sp<SkImageFilter> noopCropped(SkOffsetImageFilter::Make(0, 0, nullptr , &cropRect));
54 SkScalar sk255 = SkIntToScalar(255); 53 SkScalar sk255 = SkIntToScalar(255);
55 SkScalar matrix[20] = { 1, 0, 0, 0, 0, 54 SkScalar matrix[20] = { 1, 0, 0, 0, 0,
56 0, 1, 0, 0, sk255, 55 0, 1, 0, 0, sk255,
57 0, 0, 1, 0, 0, 56 0, 0, 1, 0, 0,
58 0, 0, 0, 0, sk255 }; 57 0, 0, 0, 0, sk255 };
59 auto cfAlphaTrans(SkColorFilter::MakeMatrixFilterRowMajor255(matrix)); 58 auto cfAlphaTrans(SkColorFilter::MakeMatrixFilterRowMajor255(matrix));
60 59
61 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); 60 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
62 SkScalar MARGIN = SkIntToScalar(12); 61 SkScalar MARGIN = SkIntToScalar(12);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 193
195 canvas->translate(SkIntToScalar(80), 0); 194 canvas->translate(SkIntToScalar(80), 0);
196 } 195 }
197 196
198 typedef GM INHERITED; 197 typedef GM INHERITED;
199 }; 198 };
200 199
201 /////////////////////////////////////////////////////////////////////////////// 200 ///////////////////////////////////////////////////////////////////////////////
202 201
203 DEF_GM( return new ImageFiltersCropExpandGM; ) 202 DEF_GM( return new ImageFiltersCropExpandGM; )
OLDNEW
« no previous file with comments | « gm/imagefiltersclipped.cpp ('k') | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698