OLD | NEW |
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 Loading... |
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 Loading... |
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)) |
OLD | NEW |