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

Side by Side Diff: gm/lcdblendmodes.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/imagetoyuvplanes.cpp ('k') | gm/localmatriximagefilter.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 8
9 /* 9 /*
10 * Tests text rendering with LCD and the various blend modes. 10 * Tests text rendering with LCD and the various blend modes.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 void onDraw(SkCanvas* canvas) override { 55 void onDraw(SkCanvas* canvas) override {
56 SkPaint p; 56 SkPaint p;
57 p.setAntiAlias(false); 57 p.setAntiAlias(false);
58 p.setStyle(SkPaint::kFill_Style); 58 p.setStyle(SkPaint::kFill_Style);
59 p.setShader(fCheckerboard); 59 p.setShader(fCheckerboard);
60 SkRect r = SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight)) ; 60 SkRect r = SkRect::MakeWH(SkIntToScalar(kWidth), SkIntToScalar(kHeight)) ;
61 canvas->drawRect(r, p); 61 canvas->drawRect(r, p);
62 62
63 SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight); 63 SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
64 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); 64 auto surface(canvas->makeSurface(info));
65 if (nullptr == surface) { 65 if (nullptr == surface) {
66 surface.reset(SkSurface::NewRaster(info)); 66 surface = SkSurface::MakeRaster(info);
67 } 67 }
68 68
69 SkCanvas* surfCanvas = surface->getCanvas(); 69 SkCanvas* surfCanvas = surface->getCanvas();
70 this->drawColumn(surfCanvas, SK_ColorBLACK, SK_ColorWHITE, false); 70 this->drawColumn(surfCanvas, SK_ColorBLACK, SK_ColorWHITE, false);
71 surfCanvas->translate(SkIntToScalar(kColWidth), 0); 71 surfCanvas->translate(SkIntToScalar(kColWidth), 0);
72 this->drawColumn(surfCanvas, SK_ColorWHITE, SK_ColorBLACK, false); 72 this->drawColumn(surfCanvas, SK_ColorWHITE, SK_ColorBLACK, false);
73 surfCanvas->translate(SkIntToScalar(kColWidth), 0); 73 surfCanvas->translate(SkIntToScalar(kColWidth), 0);
74 this->drawColumn(surfCanvas, SK_ColorGREEN, SK_ColorMAGENTA, false); 74 this->drawColumn(surfCanvas, SK_ColorGREEN, SK_ColorMAGENTA, false);
75 surfCanvas->translate(SkIntToScalar(kColWidth), 0); 75 surfCanvas->translate(SkIntToScalar(kColWidth), 0);
76 this->drawColumn(surfCanvas, SK_ColorCYAN, SK_ColorMAGENTA, true); 76 this->drawColumn(surfCanvas, SK_ColorCYAN, SK_ColorMAGENTA, true);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 private: 146 private:
147 SkScalar fTextHeight; 147 SkScalar fTextHeight;
148 sk_sp<SkShader> fCheckerboard; 148 sk_sp<SkShader> fCheckerboard;
149 typedef skiagm::GM INHERITED; 149 typedef skiagm::GM INHERITED;
150 }; 150 };
151 151
152 ////////////////////////////////////////////////////////////////////////////// 152 //////////////////////////////////////////////////////////////////////////////
153 153
154 DEF_GM( return new LcdBlendGM; ) 154 DEF_GM( return new LcdBlendGM; )
155 } 155 }
OLDNEW
« no previous file with comments | « gm/imagetoyuvplanes.cpp ('k') | gm/localmatriximagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698