diff options
author | 2014-03-25 13:38:44 +0000 | |
---|---|---|
committer | 2014-03-25 13:38:44 +0000 | |
commit | 231f6b81c22001cac4ea87ea412c4d6fd10ffb8a (patch) | |
tree | dae7097b678bfcd382993b53ba9808ae9438aa57 /src/gpu/SkGr.cpp | |
parent | 1121170477302e25ef2a020cf2092aa6b399b3ef (diff) |
Revert of implement readPixels and writePixels natively, w/o using the (deprecated) (https://codereview.chromium.org/199733016/)
Reason for revert:
Android bots segfaulting in tests.
Original issue's description:
> implement readPixels and writePixels natively, w/o using the (deprecated)
> SkCanvas::Config8888 enum.
>
> Revert "Revert "hide Config8888 entirely". Broke a bunch of builds."
>
> This reverts commit 763277ba157fef0f651004bb98a189e9f1ac730b.
>
> Needs chrome to remove the READPIXELS guard from skia's .gyp
>
> Committed: https://code.google.com/p/skia/source/detail?r=13931
R=reed@google.com
TBR=reed@google.com
NOTREECHECKS=true
NOTRY=true
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/209233004
git-svn-id: http://skia.googlecode.com/svn/trunk@13932 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r-- | src/gpu/SkGr.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index db46b86901..94e4c8c35d 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -34,22 +34,11 @@ static void build_compressed_data(void* buffer, const SkBitmap& bitmap) { SkColorTable* ctable = bitmap.getColorTable(); char* dst = (char*)buffer; - const int count = ctable->count(); - - SkDstPixelInfo dstPI; - dstPI.fColorType = kRGBA_8888_SkColorType; - dstPI.fAlphaType = kPremul_SkAlphaType; - dstPI.fPixels = buffer; - dstPI.fRowBytes = count * sizeof(SkPMColor); - - SkSrcPixelInfo srcPI; - srcPI.fColorType = kPMColor_SkColorType; - srcPI.fAlphaType = kPremul_SkAlphaType; - srcPI.fPixels = ctable->lockColors(); - srcPI.fRowBytes = count * sizeof(SkPMColor); - - srcPI.convertPixelsTo(&dstPI, count, 1); - + uint32_t* colorTableDst = reinterpret_cast<uint32_t*>(dst); + const uint32_t* colorTableSrc = reinterpret_cast<const uint32_t*>(ctable->lockColors()); + SkConvertConfig8888Pixels(colorTableDst, 0, SkCanvas::kRGBA_Premul_Config8888, + colorTableSrc, 0, SkCanvas::kNative_Premul_Config8888, + ctable->count(), 1); ctable->unlockColors(); // always skip a full 256 number of entries, even if we memcpy'd fewer |