OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 "SkGr.h" | 8 #include "SkGr.h" |
9 #include "SkConfig8888.h" | 9 #include "SkConfig8888.h" |
10 #include "SkMessageBus.h" | 10 #include "SkMessageBus.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return result; | 148 return result; |
149 } else { | 149 } else { |
150 GrTexture* result = ctx->lockAndRefScratchTexture(desc, | 150 GrTexture* result = ctx->lockAndRefScratchTexture(desc, |
151 GrContext::kExact_Sc
ratchTexMatch); | 151 GrContext::kExact_Sc
ratchTexMatch); |
152 result->writePixels(0, 0, bitmap->width(), | 152 result->writePixels(0, 0, bitmap->width(), |
153 bitmap->height(), desc.fConfig, | 153 bitmap->height(), desc.fConfig, |
154 storage.get()); | 154 storage.get()); |
155 return result; | 155 return result; |
156 } | 156 } |
157 } else { | 157 } else { |
158 origBitmap.copyTo(&tmpBitmap, SkBitmap::kARGB_8888_Config); | 158 origBitmap.copyTo(&tmpBitmap, kPMColor_SkColorType); |
159 // now bitmap points to our temp, which has been promoted to 32bits | 159 // now bitmap points to our temp, which has been promoted to 32bits |
160 bitmap = &tmpBitmap; | 160 bitmap = &tmpBitmap; |
161 desc.fConfig = SkBitmapConfig2GrPixelConfig(bitmap->config()); | 161 desc.fConfig = SkBitmapConfig2GrPixelConfig(bitmap->config()); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 SkAutoLockPixels alp(*bitmap); | 165 SkAutoLockPixels alp(*bitmap); |
166 if (!bitmap->readyToDraw()) { | 166 if (!bitmap->readyToDraw()) { |
167 return NULL; | 167 return NULL; |
168 } | 168 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 ct = kBGRA_8888_SkColorType; | 305 ct = kBGRA_8888_SkColorType; |
306 break; | 306 break; |
307 default: | 307 default: |
308 return false; | 308 return false; |
309 } | 309 } |
310 if (ctOut) { | 310 if (ctOut) { |
311 *ctOut = ct; | 311 *ctOut = ct; |
312 } | 312 } |
313 return true; | 313 return true; |
314 } | 314 } |
OLD | NEW |