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

Side by Side Diff: gm/resizeimagefilter.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/perspshaders.cpp ('k') | gm/srcmode.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 2013 Google Inc. 2 * Copyright 2013 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 "SkImageSource.h" 10 #include "SkImageSource.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 srcRect, 80 srcRect,
81 deviceSize, 81 deviceSize,
82 kMedium_SkFilterQuality); 82 kMedium_SkFilterQuality);
83 83
84 canvas->translate(srcRect.width() + SkIntToScalar(10), 0); 84 canvas->translate(srcRect.width() + SkIntToScalar(10), 0);
85 draw(canvas, 85 draw(canvas,
86 srcRect, 86 srcRect,
87 deviceSize, 87 deviceSize,
88 kHigh_SkFilterQuality); 88 kHigh_SkFilterQuality);
89 89
90 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(16, 16)); 90 auto surface(SkSurface::MakeRasterN32Premul(16, 16));
91 SkCanvas* surfaceCanvas = surface->getCanvas(); 91 SkCanvas* surfaceCanvas = surface->getCanvas();
92 surfaceCanvas->clear(0x000000); 92 surfaceCanvas->clear(0x000000);
93 { 93 {
94 SkPaint paint; 94 SkPaint paint;
95 paint.setColor(0xFF00FF00); 95 paint.setColor(0xFF00FF00);
96 SkRect ovalRect = SkRect::MakeWH(16, 16); 96 SkRect ovalRect = SkRect::MakeWH(16, 16);
97 ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3); 97 ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3);
98 surfaceCanvas->drawOval(ovalRect, paint); 98 surfaceCanvas->drawOval(ovalRect, paint);
99 } 99 }
100 sk_sp<SkImage> image(surface->makeImageSnapshot()); 100 sk_sp<SkImage> image(surface->makeImageSnapshot());
(...skipping 12 matching lines...) Expand all
113 private: 113 private:
114 typedef GM INHERITED; 114 typedef GM INHERITED;
115 }; 115 };
116 116
117 ////////////////////////////////////////////////////////////////////////////// 117 //////////////////////////////////////////////////////////////////////////////
118 118
119 static GM* MyFactory(void*) { return new ResizeGM; } 119 static GM* MyFactory(void*) { return new ResizeGM; }
120 static GMRegistry reg(MyFactory); 120 static GMRegistry reg(MyFactory);
121 121
122 } 122 }
OLDNEW
« no previous file with comments | « gm/perspshaders.cpp ('k') | gm/srcmode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698