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

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

Issue 168653002: Change device factories to take SkImageInfo instead of SkBitmap::Config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix PdfViewer 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/gpu/SkGpuDevice.cpp ('k') | src/image/SkSurface_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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 case SkBitmap::kARGB_4444_Config: 253 case SkBitmap::kARGB_4444_Config:
254 return kRGBA_4444_GrPixelConfig; 254 return kRGBA_4444_GrPixelConfig;
255 case SkBitmap::kARGB_8888_Config: 255 case SkBitmap::kARGB_8888_Config:
256 return kSkia8888_GrPixelConfig; 256 return kSkia8888_GrPixelConfig;
257 default: 257 default:
258 // kNo_Config, kA1_Config missing 258 // kNo_Config, kA1_Config missing
259 return kUnknown_GrPixelConfig; 259 return kUnknown_GrPixelConfig;
260 } 260 }
261 } 261 }
262 262
263 // alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
264 // alpha info, that will be considered.
265 GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) {
266 switch (ct) {
267 case kUnknown_SkColorType:
268 return kUnknown_GrPixelConfig;
269 case kAlpha_8_SkColorType:
270 return kAlpha_8_GrPixelConfig;
271 case kRGB_565_SkColorType:
272 return kRGB_565_GrPixelConfig;
273 case kARGB_4444_SkColorType:
274 return kRGBA_4444_GrPixelConfig;
275 case kRGBA_8888_SkColorType:
276 return kRGBA_8888_GrPixelConfig;
277 case kBGRA_8888_SkColorType:
278 return kBGRA_8888_GrPixelConfig;
279 case kIndex_8_SkColorType:
280 return kIndex_8_GrPixelConfig;
281 }
282 SkASSERT(0); // shouldn't get here
283 return kUnknown_GrPixelConfig;
284 }
285
263 bool GrPixelConfig2ColorType(GrPixelConfig config, SkColorType* ctOut) { 286 bool GrPixelConfig2ColorType(GrPixelConfig config, SkColorType* ctOut) {
264 SkColorType ct; 287 SkColorType ct;
265 switch (config) { 288 switch (config) {
266 case kAlpha_8_GrPixelConfig: 289 case kAlpha_8_GrPixelConfig:
267 ct = kAlpha_8_SkColorType; 290 ct = kAlpha_8_SkColorType;
268 break; 291 break;
269 case kIndex_8_GrPixelConfig: 292 case kIndex_8_GrPixelConfig:
270 ct = kIndex_8_SkColorType; 293 ct = kIndex_8_SkColorType;
271 break; 294 break;
272 case kRGB_565_GrPixelConfig: 295 case kRGB_565_GrPixelConfig:
273 ct = kRGB_565_SkColorType; 296 ct = kRGB_565_SkColorType;
274 break; 297 break;
275 case kRGBA_4444_GrPixelConfig: 298 case kRGBA_4444_GrPixelConfig:
276 ct = kARGB_4444_SkColorType; 299 ct = kARGB_4444_SkColorType;
277 break; 300 break;
278 case kRGBA_8888_GrPixelConfig: 301 case kRGBA_8888_GrPixelConfig:
279 ct = kRGBA_8888_SkColorType; 302 ct = kRGBA_8888_SkColorType;
280 break; 303 break;
281 case kBGRA_8888_GrPixelConfig: 304 case kBGRA_8888_GrPixelConfig:
282 ct = kBGRA_8888_SkColorType; 305 ct = kBGRA_8888_SkColorType;
283 break; 306 break;
284 default: 307 default:
285 return false; 308 return false;
286 } 309 }
287 if (ctOut) { 310 if (ctOut) {
288 *ctOut = ct; 311 *ctOut = ct;
289 } 312 }
290 return true; 313 return true;
291 } 314 }
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698