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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGr.cpp
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index fa9fa713269f87d0f7766c6f93e1b8179af4bd30..c053e8b81102e796ceb4b3442c85269021730d3c 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -260,6 +260,29 @@ GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) {
}
}
+// alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
+// alpha info, that will be considered.
+GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType) {
+ switch (ct) {
+ case kUnknown_SkColorType:
+ return kUnknown_GrPixelConfig;
+ case kAlpha_8_SkColorType:
+ return kAlpha_8_GrPixelConfig;
+ case kRGB_565_SkColorType:
+ return kRGB_565_GrPixelConfig;
+ case kARGB_4444_SkColorType:
+ return kRGBA_4444_GrPixelConfig;
+ case kRGBA_8888_SkColorType:
+ return kRGBA_8888_GrPixelConfig;
+ case kBGRA_8888_SkColorType:
+ return kBGRA_8888_GrPixelConfig;
+ case kIndex_8_SkColorType:
+ return kIndex_8_GrPixelConfig;
+ }
+ SkASSERT(0); // shouldn't get here
+ return kUnknown_GrPixelConfig;
+}
+
bool GrPixelConfig2ColorType(GrPixelConfig config, SkColorType* ctOut) {
SkColorType ct;
switch (config) {
« 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