| Index: src/core/SkBitmapDevice.cpp
|
| diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
|
| index f0f4df41f17067028a7361b90a9c0e40aaa3965a..d968cb850b97bb84a5968eea97fb056ad8aa3dc0 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()) {
|
|
|