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

Side by Side Diff: gm/imagesource2.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/imagescalealigned.cpp ('k') | gm/imagetoyuvplanes.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 "SkImage.h" 9 #include "SkImage.h"
10 #include "SkImageSource.h" 10 #include "SkImageSource.h"
(...skipping 23 matching lines...) Expand all
34 static const SkPMColor gColors[] = { 34 static const SkPMColor gColors[] = {
35 SK_ColorRED, SK_ColorGRAY, 35 SK_ColorRED, SK_ColorGRAY,
36 SK_ColorGREEN, SK_ColorGRAY, 36 SK_ColorGREEN, SK_ColorGRAY,
37 SK_ColorBLUE, SK_ColorGRAY, 37 SK_ColorBLUE, SK_ColorGRAY,
38 SK_ColorCYAN, SK_ColorGRAY, 38 SK_ColorCYAN, SK_ColorGRAY,
39 SK_ColorMAGENTA, SK_ColorGRAY, 39 SK_ColorMAGENTA, SK_ColorGRAY,
40 SK_ColorYELLOW, SK_ColorGRAY, 40 SK_ColorYELLOW, SK_ColorGRAY,
41 SK_ColorWHITE, SK_ColorGRAY, 41 SK_ColorWHITE, SK_ColorGRAY,
42 }; 42 };
43 43
44 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(kImageSize , kImageSize)); 44 auto surface(SkSurface::MakeRasterN32Premul(kImageSize, kImageSize));
45 SkCanvas* canvas = surface->getCanvas(); 45 SkCanvas* canvas = surface->getCanvas();
46 46
47 int curColor = 0; 47 int curColor = 0;
48 48
49 for (int x = 0; x < kImageSize; x += 3) { 49 for (int x = 0; x < kImageSize; x += 3) {
50 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(0), 50 SkRect r = SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(0),
51 SkIntToScalar(3), SkIntToScalar(kImageSi ze)); 51 SkIntToScalar(3), SkIntToScalar(kImageSi ze));
52 SkPaint p; 52 SkPaint p;
53 p.setColor(gColors[curColor]); 53 p.setColor(gColors[curColor]);
54 canvas->drawRect(r, p); 54 canvas->drawRect(r, p);
(...skipping 29 matching lines...) Expand all
84 typedef GM INHERITED; 84 typedef GM INHERITED;
85 }; 85 };
86 86
87 ////////////////////////////////////////////////////////////////////////////// 87 //////////////////////////////////////////////////////////////////////////////
88 88
89 DEF_GM(return new ImageSourceGM("none", kNone_SkFilterQuality);) 89 DEF_GM(return new ImageSourceGM("none", kNone_SkFilterQuality);)
90 DEF_GM(return new ImageSourceGM("low", kLow_SkFilterQuality);) 90 DEF_GM(return new ImageSourceGM("low", kLow_SkFilterQuality);)
91 DEF_GM(return new ImageSourceGM("med", kMedium_SkFilterQuality);) 91 DEF_GM(return new ImageSourceGM("med", kMedium_SkFilterQuality);)
92 DEF_GM(return new ImageSourceGM("high", kHigh_SkFilterQuality);) 92 DEF_GM(return new ImageSourceGM("high", kHigh_SkFilterQuality);)
93 } 93 }
OLDNEW
« no previous file with comments | « gm/imagescalealigned.cpp ('k') | gm/imagetoyuvplanes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698