diff options
author | Chris Craik <ccraik@google.com> | 2015-07-24 15:17:29 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-07-24 15:27:48 -0700 |
commit | 6260b22501996d2e7a0323b493ae6c4badb93c28 (patch) | |
tree | 3c0b302bd6d4b79e77cd50627793a236ff7d7706 /core/jni/android | |
parent | 304b01c2493f16c2537563b3e00e4770765942a2 (diff) | |
download | frameworks_base-6260b22501996d2e7a0323b493ae6c4badb93c28.zip frameworks_base-6260b22501996d2e7a0323b493ae6c4badb93c28.tar.gz frameworks_base-6260b22501996d2e7a0323b493ae6c4badb93c28.tar.bz2 |
Fix bitmap get/set pixels for ALPHA_8
bug:22724734
Change-Id: If8307854f6bad6fac9ee0b394bf0b044c61183e5
Diffstat (limited to 'core/jni/android')
-rwxr-xr-x | core/jni/android/graphics/Bitmap.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp index 0d80a7f..670d3c0 100755 --- a/core/jni/android/graphics/Bitmap.cpp +++ b/core/jni/android/graphics/Bitmap.cpp @@ -475,6 +475,14 @@ static void FromColor_D4444_Raw(void* dst, const SkColor src[], int width, } } +static void FromColor_DA8(void* dst, const SkColor src[], int width, int x, int y) { + uint8_t* d = (uint8_t*)dst; + + for (int stop = x + width; x < stop; x++) { + *d++ = SkColorGetA(*src++); + } +} + // can return NULL static FromColorProc ChooseFromColorProc(const SkBitmap& bitmap) { switch (bitmap.colorType()) { @@ -485,6 +493,8 @@ static FromColorProc ChooseFromColorProc(const SkBitmap& bitmap) { FromColor_D4444_Raw; case kRGB_565_SkColorType: return FromColor_D565; + case kAlpha_8_SkColorType: + return FromColor_DA8; default: break; } @@ -632,6 +642,15 @@ static void ToColor_SI8_Opaque(SkColor dst[], const void* src, int width, } while (--width != 0); } +static void ToColor_SA8(SkColor dst[], const void* src, int width, SkColorTable*) { + SkASSERT(width > 0); + const uint8_t* s = (const uint8_t*)src; + do { + uint8_t c = *s++; + *dst++ = SkColorSetARGB(c, c, c, c); + } while (--width != 0); +} + // can return NULL static ToColorProc ChooseToColorProc(const SkBitmap& src) { switch (src.colorType()) { @@ -673,6 +692,8 @@ static ToColorProc ChooseToColorProc(const SkBitmap& src) { default: return NULL; } + case kAlpha_8_SkColorType: + return ToColor_SA8; default: break; } |