make a deep copy in CreateCGImageRef if we're 565, but first upscale to 32bit.
this at least draws the right colors, since we're 565 and CG only supports 1555 (unless someone knows how to tell CG we're 565...) Fix ws in picturerecord Enable dither in sample gradients, so the 4444 case isn't so ugly git-svn-id: http://skia.googlecode.com/svn/trunk@264 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
dafaf7ac4d
commit
32a4249cbd
@ -118,6 +118,7 @@ protected:
|
||||
SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) };
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setDither(true);
|
||||
|
||||
canvas->save();
|
||||
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
|
||||
|
@ -16,12 +16,12 @@ static void SkBitmap_ReleaseInfo(void* info, const void* pixelData, size_t size)
|
||||
static SkBitmap* prepareForImageRef(const SkBitmap& bm,
|
||||
size_t* bitsPerComponent,
|
||||
CGBitmapInfo* info) {
|
||||
#if 0
|
||||
SkDebugf("---- %d %d %d %d\n", SK_A32_SHIFT, SK_R32_SHIFT,
|
||||
SK_G32_SHIFT, SK_B32_SHIFT);
|
||||
#endif
|
||||
bool upscaleTo32 = false;
|
||||
|
||||
switch (bm.config()) {
|
||||
case SkBitmap::kRGB_565_Config:
|
||||
upscaleTo32 = true;
|
||||
// fall through
|
||||
case SkBitmap::kARGB_8888_Config:
|
||||
*bitsPerComponent = 8;
|
||||
#if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 0, 8, 16) \
|
||||
@ -44,11 +44,13 @@ static SkBitmap* prepareForImageRef(const SkBitmap& bm,
|
||||
kCGImageAlphaPremultipliedLast;
|
||||
#endif
|
||||
break;
|
||||
#if 0
|
||||
case SkBitmap::kRGB_565_Config:
|
||||
// doesn't see quite right. Are they thinking 1555?
|
||||
*bitsPerComponent = 5;
|
||||
*info = kCGBitmapByteOrder16Little;
|
||||
break;
|
||||
#endif
|
||||
case SkBitmap::kARGB_4444_Config:
|
||||
*bitsPerComponent = 4;
|
||||
*info = kCGBitmapByteOrder16Little | kCGImageAlphaPremultipliedLast;
|
||||
@ -57,7 +59,16 @@ static SkBitmap* prepareForImageRef(const SkBitmap& bm,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new SkBitmap(bm);
|
||||
SkBitmap* copy;
|
||||
if (upscaleTo32) {
|
||||
copy = new SkBitmap;
|
||||
// here we make a ceep copy of the pixels, since CG won't take our
|
||||
// 565 directly
|
||||
bm.copyTo(copy, SkBitmap::kARGB_8888_Config);
|
||||
} else {
|
||||
copy = new SkBitmap(bm);
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
#undef HAS_ARGB_SHIFTS
|
||||
|
Loading…
Reference in New Issue
Block a user