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

Unified Diff: src/core/SkBitmapDevice.cpp

Issue 205963003: Revert "hide Config8888 entirely". Broke a bunch of builds. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 | « include/gpu/SkGpuDevice.h ('k') | src/core/SkConfig8888.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapDevice.cpp
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index d968cb850b97bb84a5968eea97fb056ad8aa3dc0..f0f4df41f17067028a7361b90a9c0e40aaa3965a 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -221,27 +221,47 @@ static void rect_memcpy(void* dst, size_t dstRB, const void* src, size_t srcRB,
}
}
-#include "SkConfig8888.h"
+static bool info2config8888(const SkImageInfo& info, SkCanvas::Config8888* config) {
+ bool pre;
+ switch (info.alphaType()) {
+ case kPremul_SkAlphaType:
+ case kOpaque_SkAlphaType:
+ pre = true;
+ break;
+ case kUnpremul_SkAlphaType:
+ pre = false;
+ break;
+ default:
+ return false;
+ }
+ switch (info.colorType()) {
+ case kRGBA_8888_SkColorType:
+ *config = pre ? SkCanvas::kRGBA_Premul_Config8888 : SkCanvas::kRGBA_Unpremul_Config8888;
+ return true;
+ case kBGRA_8888_SkColorType:
+ *config = pre ? SkCanvas::kBGRA_Premul_Config8888 : SkCanvas::kBGRA_Unpremul_Config8888;
+ return true;
+ default:
+ return false;
+ }
+}
+// TODO: make this guy real, and not rely on legacy config8888 utility
+#include "SkConfig8888.h"
static bool copy_pixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
const SkImageInfo& srcInfo, const void* srcPixels, size_t srcRowBytes) {
if (srcInfo.dimensions() != dstInfo.dimensions()) {
return false;
}
if (4 == srcInfo.bytesPerPixel() && 4 == dstInfo.bytesPerPixel()) {
- SkDstPixelInfo dstPI;
- dstPI.fColorType = dstInfo.colorType();
- dstPI.fAlphaType = dstInfo.alphaType();
- dstPI.fPixels = dstPixels;
- dstPI.fRowBytes = dstRowBytes;
-
- SkSrcPixelInfo srcPI;
- srcPI.fColorType = srcInfo.colorType();
- srcPI.fAlphaType = srcInfo.alphaType();
- srcPI.fPixels = srcPixels;
- srcPI.fRowBytes = srcRowBytes;
-
- return srcPI.convertPixelsTo(&dstPI, srcInfo.width(), srcInfo.height());
+ SkCanvas::Config8888 srcConfig, dstConfig;
+ if (!info2config8888(srcInfo, &srcConfig) || !info2config8888(dstInfo, &dstConfig)) {
+ return false;
+ }
+ SkConvertConfig8888Pixels((uint32_t*)dstPixels, dstRowBytes, dstConfig,
+ (const uint32_t*)srcPixels, srcRowBytes, srcConfig,
+ srcInfo.width(), srcInfo.height());
+ return true;
}
if (srcInfo.colorType() == dstInfo.colorType()) {
switch (srcInfo.colorType()) {
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | src/core/SkConfig8888.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698