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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 171723007: add new copyTo version to SkBitmap, which takes SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/image/SkImage_Gpu.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 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
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
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 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/image/SkImage_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698