ARM Skia NEON patches - 08 - Cleaning / possible fix
Misc: use SK_PMCOLOR_BYTE_ORDER where appropriate Before SK_PMCOLOR_BYTE_ORDER was introduced, I had written my own macro for the same purpose. I had at the time spotted these two places where it seemed to be useful. The change in SkCreateCGImageRef.cpp may be a bugfix or a bug for the second occurrence, I'm not sure... BUG= R=djsollen@google.com, caryclark@google.com, reed@google.com, tomhudson@google.com Author: kevin.petit.arm@gmail.com Review URL: https://chromiumcodereview.appspot.com/18024003 git-svn-id: http://skia.googlecode.com/svn/trunk@10071 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
12e0cda1dd
commit
5dc14c171a
@ -219,32 +219,15 @@ bool SkDevice::readPixels(SkBitmap* bitmap, int x, int y,
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef SK_CPU_LENDIAN
|
||||
#if 24 == SK_A32_SHIFT && 16 == SK_R32_SHIFT && \
|
||||
8 == SK_G32_SHIFT && 0 == SK_B32_SHIFT
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
SkCanvas::kBGRA_Premul_Config8888;
|
||||
#elif 24 == SK_A32_SHIFT && 0 == SK_R32_SHIFT && \
|
||||
8 == SK_G32_SHIFT && 16 == SK_B32_SHIFT
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
SkCanvas::kRGBA_Premul_Config8888;
|
||||
#else
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
(SkCanvas::Config8888) -1;
|
||||
#endif
|
||||
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
SkCanvas::kBGRA_Premul_Config8888;
|
||||
#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
SkCanvas::kRGBA_Premul_Config8888;
|
||||
#else
|
||||
#if 0 == SK_A32_SHIFT && 8 == SK_R32_SHIFT && \
|
||||
16 == SK_G32_SHIFT && 24 == SK_B32_SHIFT
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
SkCanvas::kBGRA_Premul_Config8888;
|
||||
#elif 0 == SK_A32_SHIFT && 24 == SK_R32_SHIFT && \
|
||||
16 == SK_G32_SHIFT && 8 == SK_B32_SHIFT
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
SkCanvas::kRGBA_Premul_Config8888;
|
||||
#else
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
(SkCanvas::Config8888) -1;
|
||||
#endif
|
||||
const SkCanvas::Config8888 SkDevice::kPMColorAlias =
|
||||
(SkCanvas::Config8888) -1;
|
||||
#endif
|
||||
|
||||
#include <SkConfig8888.h>
|
||||
|
@ -14,10 +14,6 @@ static void SkBitmap_ReleaseInfo(void* info, const void* pixelData, size_t size)
|
||||
delete bitmap;
|
||||
}
|
||||
|
||||
#define HAS_ARGB_SHIFTS(a, r, g, b) \
|
||||
(SK_A32_SHIFT == (a) && SK_R32_SHIFT == (r) \
|
||||
&& SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b))
|
||||
|
||||
static bool getBitmapInfo(const SkBitmap& bm,
|
||||
size_t* bitsPerComponent,
|
||||
CGBitmapInfo* info,
|
||||
@ -34,16 +30,14 @@ static bool getBitmapInfo(const SkBitmap& bm,
|
||||
// fall through
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
*bitsPerComponent = 8;
|
||||
#if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 0, 8, 16) \
|
||||
|| defined(SK_CPU_BENDIAN) && HAS_ARGB_SHIFTS(0, 24, 16, 8)
|
||||
#if SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
|
||||
*info = kCGBitmapByteOrder32Big;
|
||||
if (bm.isOpaque()) {
|
||||
*info |= kCGImageAlphaNoneSkipLast;
|
||||
} else {
|
||||
*info |= kCGImageAlphaPremultipliedLast;
|
||||
}
|
||||
#elif defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0) \
|
||||
|| defined(SK_CPU_BENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0)
|
||||
#elif SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
|
||||
// Matches the CGBitmapInfo that Apple recommends for best
|
||||
// performance, used by google chrome.
|
||||
*info = kCGBitmapByteOrder32Little;
|
||||
@ -108,8 +102,6 @@ static SkBitmap* prepareForImageRef(const SkBitmap& bm,
|
||||
return copy;
|
||||
}
|
||||
|
||||
#undef HAS_ARGB_SHIFTS
|
||||
|
||||
CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm,
|
||||
CGColorSpaceRef colorSpace) {
|
||||
size_t bitsPerComponent SK_INIT_TO_AVOID_WARNING;
|
||||
|
Loading…
Reference in New Issue
Block a user