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

Side by Side Diff: bench/RepeatTileBench.cpp

Issue 25275004: store SkAlphaType inside SkBitmap, on road to support unpremul (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 protected: 110 protected:
111 virtual const char* onGetName() SK_OVERRIDE { 111 virtual const char* onGetName() SK_OVERRIDE {
112 return fName.c_str(); 112 return fName.c_str();
113 } 113 }
114 114
115 virtual void onPreDraw() SK_OVERRIDE { 115 virtual void onPreDraw() SK_OVERRIDE {
116 fBitmap.allocPixels(); 116 fBitmap.allocPixels();
117 fBitmap.eraseColor(fIsOpaque ? SK_ColorWHITE : 0); 117 fBitmap.eraseColor(fIsOpaque ? SK_ColorWHITE : 0);
118 fBitmap.setIsOpaque(fIsOpaque); 118 fBitmap.setAlphaType(fIsOpaque ?
119 kOpaque_SkAlphaType : kPremul_SkAlphaType);
119 120
120 draw_into_bitmap(fBitmap); 121 draw_into_bitmap(fBitmap);
121 122
122 if (SkBitmap::kIndex8_Config == fConfig) { 123 if (SkBitmap::kIndex8_Config == fConfig) {
123 SkBitmap tmp; 124 SkBitmap tmp;
124 convert_to_index666(fBitmap, &tmp, fIsOpaque); 125 convert_to_index666(fBitmap, &tmp, fIsOpaque);
125 fBitmap = tmp; 126 fBitmap = tmp;
126 } 127 }
127 128
128 SkShader* s = SkShader::CreateBitmapShader(fBitmap, 129 SkShader* s = SkShader::CreateBitmapShader(fBitmap,
(...skipping 13 matching lines...) Expand all
142 } 143 }
143 144
144 private: 145 private:
145 typedef SkBenchmark INHERITED; 146 typedef SkBenchmark INHERITED;
146 }; 147 };
147 148
148 DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, true)) 149 DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, true))
149 DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, false)) 150 DEF_BENCH(return new RepeatTileBench(SkBitmap::kARGB_8888_Config, false))
150 DEF_BENCH(return new RepeatTileBench(SkBitmap::kRGB_565_Config)) 151 DEF_BENCH(return new RepeatTileBench(SkBitmap::kRGB_565_Config))
151 DEF_BENCH(return new RepeatTileBench(SkBitmap::kIndex8_Config)) 152 DEF_BENCH(return new RepeatTileBench(SkBitmap::kIndex8_Config))
OLDNEW
« no previous file with comments | « bench/BitmapScaleBench.cpp ('k') | bench/TileBench.cpp » ('j') | src/core/SkBitmap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698