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

Side by Side Diff: bench/ImageBench.cpp

Issue 1505333002: SkBitmap::installPixels(const SkPixmap&); (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-12-09 (Wednesday) 13:58:05 EST Created 5 years 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 | « no previous file | gm/image.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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImage.h" 10 #include "SkImage.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 fBitmap.setInfo(info); 118 fBitmap.setInfo(info);
119 if (fImage->getTexture()) { 119 if (fImage->getTexture()) {
120 #if SK_SUPPORT_GPU 120 #if SK_SUPPORT_GPU
121 fBitmap.setPixelRef(new SkGrPixelRef(info, fImage->getTexture()))->u nref(); 121 fBitmap.setPixelRef(new SkGrPixelRef(info, fImage->getTexture()))->u nref();
122 #endif 122 #endif
123 } else { 123 } else {
124 SkPixmap pmap; 124 SkPixmap pmap;
125 if (!fImage->peekPixels(&pmap)) { 125 if (!fImage->peekPixels(&pmap)) {
126 sk_throw(); 126 sk_throw();
127 } 127 }
128 fBitmap.installPixels(pmap.info(), pmap.writable_addr(), pmap.rowByt es()); 128 fBitmap.installPixels(pmap);
129 } 129 }
130 } 130 }
131 131
132 void onPerCanvasPostDraw(SkCanvas*) override { 132 void onPerCanvasPostDraw(SkCanvas*) override {
133 // Release the image and raster surface here to prevent out of order des truction 133 // Release the image and raster surface here to prevent out of order des truction
134 // between these and the gpu interface. 134 // between these and the gpu interface.
135 fImage.reset(nullptr); 135 fImage.reset(nullptr);
136 fBitmap.reset(); 136 fBitmap.reset();
137 } 137 }
138 138
(...skipping 30 matching lines...) Expand all
169 } 169 }
170 } 170 }
171 171
172 private: 172 private:
173 typedef Benchmark INHERITED; 173 typedef Benchmark INHERITED;
174 }; 174 };
175 DEF_BENCH( return new ImageFilterSpriteBench(kSprite_Type, "sprite"); ) 175 DEF_BENCH( return new ImageFilterSpriteBench(kSprite_Type, "sprite"); )
176 DEF_BENCH( return new ImageFilterSpriteBench(kBitmap_Type, "bitmap"); ) 176 DEF_BENCH( return new ImageFilterSpriteBench(kBitmap_Type, "bitmap"); )
177 DEF_BENCH( return new ImageFilterSpriteBench(kImage_Type, "image"); ) 177 DEF_BENCH( return new ImageFilterSpriteBench(kImage_Type, "image"); )
178 178
OLDNEW
« no previous file with comments | « no previous file | gm/image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698