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

Side by Side Diff: gm/imagealphathreshold.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage 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/image_shader.cpp ('k') | gm/imagefilters.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 "SkAlphaThresholdFilter.h" 9 #include "SkAlphaThresholdFilter.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 void onDraw(SkCanvas* canvas) override { 96 void onDraw(SkCanvas* canvas) override {
97 SkImageInfo info = SkImageInfo::MakeN32(WIDTH, HEIGHT, kOpaque_SkAlphaTy pe); 97 SkImageInfo info = SkImageInfo::MakeN32(WIDTH, HEIGHT, kOpaque_SkAlphaTy pe);
98 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); 98 SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
99 if (nullptr == surface) { 99 if (nullptr == surface) {
100 surface.reset(SkSurface::NewRaster(info)); 100 surface.reset(SkSurface::NewRaster(info));
101 } 101 }
102 surface->getCanvas()->clear(SK_ColorWHITE); 102 surface->getCanvas()->clear(SK_ColorWHITE);
103 draw_rects(surface->getCanvas()); 103 draw_rects(surface->getCanvas());
104 104
105 SkAutoTUnref<SkImage> image(surface->newImageSnapshot());
106 SkPaint paint = create_filter_paint(); 105 SkPaint paint = create_filter_paint();
107 canvas->clipRect(SkRect::MakeLTRB(100, 100, WIDTH - 100, HEIGHT - 100)); 106 canvas->clipRect(SkRect::MakeLTRB(100, 100, WIDTH - 100, HEIGHT - 100));
108 canvas->drawImage(image, 0, 0, &paint); 107 canvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, &paint);
109 } 108 }
110 109
111 private: 110 private:
112 typedef GM INHERITED; 111 typedef GM INHERITED;
113 }; 112 };
114 113
115 ////////////////////////////////////////////////////////////////////////////// 114 //////////////////////////////////////////////////////////////////////////////
116 115
117 DEF_GM(return new ImageAlphaThresholdGM();) 116 DEF_GM(return new ImageAlphaThresholdGM();)
118 DEF_GM(return new ImageAlphaThresholdSurfaceGM();) 117 DEF_GM(return new ImageAlphaThresholdSurfaceGM();)
119 118
120 } 119 }
OLDNEW
« no previous file with comments | « gm/image_shader.cpp ('k') | gm/imagefilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698