diff options
author | 2014-03-19 21:20:24 +0000 | |
---|---|---|
committer | 2014-03-19 21:20:24 +0000 | |
commit | e14792d99fc7a1a314ef5e2ca5b269239468355a (patch) | |
tree | 8415a8086f37d363ac8ebf4107c98258d2671420 /src/core/SkBitmapDevice.cpp | |
parent | d8a57af725e8fa8905207df3cf7465be50598752 (diff) |
hide Config8888 entirely
BUG=skia:
R=bsalomon@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/203993002
git-svn-id: http://skia.googlecode.com/svn/trunk@13865 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkBitmapDevice.cpp')
-rw-r--r-- | src/core/SkBitmapDevice.cpp | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index f0f4df41f1..d968cb850b 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -221,47 +221,27 @@ static void rect_memcpy(void* dst, size_t dstRB, const void* src, size_t srcRB, } } -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()) { - 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; + 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()); } if (srcInfo.colorType() == dstInfo.colorType()) { switch (srcInfo.colorType()) { |