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

Side by Side Diff: gm/pictureimagegenerator.cpp

Issue 1340803002: discardable pixelrefs are gone, update tests accordingly (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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/etc1bitmap.cpp ('k') | tests/DrawBitmapRectTest.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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (configs[i].scaleX < 0) { 153 if (configs[i].scaleX < 0) {
154 m.postTranslate(SkIntToScalar(configs[i].size.width()), 0); 154 m.postTranslate(SkIntToScalar(configs[i].size.width()), 0);
155 } 155 }
156 if (configs[i].scaleY < 0) { 156 if (configs[i].scaleY < 0) {
157 m.postTranslate(0, SkIntToScalar(configs[i].size.height())); 157 m.postTranslate(0, SkIntToScalar(configs[i].size.height()));
158 } 158 }
159 SkAutoTDelete<SkImageGenerator> gen( 159 SkAutoTDelete<SkImageGenerator> gen(
160 SkImageGenerator::NewFromPicture(configs[i].size, fPicture.get() , &m, 160 SkImageGenerator::NewFromPicture(configs[i].size, fPicture.get() , &m,
161 p.getAlpha() != 255 ? &p : null ptr)); 161 p.getAlpha() != 255 ? &p : null ptr));
162 SkBitmap bm; 162 SkBitmap bm;
163 SkAssertResult(SkInstallDiscardablePixelRef(gen.detach(), &bm)); 163 gen->generateBitmap(&bm);
164 164
165 const SkScalar x = kDrawSize * (i % kDrawsPerRow); 165 const SkScalar x = kDrawSize * (i % kDrawsPerRow);
166 const SkScalar y = kDrawSize * (i / kDrawsPerRow); 166 const SkScalar y = kDrawSize * (i / kDrawsPerRow);
167 167
168 p.setColor(0xfff0f0f0); 168 p.setColor(0xfff0f0f0);
169 p.setAlpha(255); 169 p.setAlpha(255);
170 canvas->drawRect(SkRect::MakeXYWH(x, y, 170 canvas->drawRect(SkRect::MakeXYWH(x, y,
171 SkIntToScalar(bm.width()), 171 SkIntToScalar(bm.width()),
172 SkIntToScalar(bm.height())), p); 172 SkIntToScalar(bm.height())), p);
173 canvas->drawBitmap(bm, x, y); 173 canvas->drawBitmap(bm, x, y);
174 } 174 }
175 } 175 }
176 176
177 private: 177 private:
178 SkAutoTUnref<SkPicture> fPicture; 178 SkAutoTUnref<SkPicture> fPicture;
179 179
180 const SkScalar kPictureWidth = 200; 180 const SkScalar kPictureWidth = 200;
181 const SkScalar kPictureHeight = 100; 181 const SkScalar kPictureHeight = 100;
182 182
183 typedef skiagm::GM INHERITED; 183 typedef skiagm::GM INHERITED;
184 }; 184 };
185 185
186 DEF_GM(return new PictureGeneratorGM;) 186 DEF_GM(return new PictureGeneratorGM;)
OLDNEW
« no previous file with comments | « gm/etc1bitmap.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698