Fix tests with incorrect swizzle.

http://codereview.appspot.com/4552046/


git-svn-id: http://skia.googlecode.com/svn/trunk@1367 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bungeman@google.com 2011-05-18 18:54:23 +00:00
parent d1a416a97c
commit 2ed67e83c8
2 changed files with 17 additions and 8 deletions

View File

@ -3,11 +3,16 @@
namespace skiagm { namespace skiagm {
static void make_bm(SkBitmap* bm) { static void make_bm(SkBitmap* bm) {
const SkColor colors[] = { const SkColor colors[4] = {
SK_ColorRED, SK_ColorGREEN, SK_ColorRED, SK_ColorGREEN,
SK_ColorBLUE, SK_ColorWHITE SK_ColorBLUE, SK_ColorWHITE
}; };
SkColorTable* ctable = new SkColorTable(colors, 4); SkPMColor colorsPM[4];
for (size_t i = 0; i < SK_ARRAY_COUNT(colors); ++i) {
colorsPM[i] = SkPreMultiplyColor(colors[i]);
}
SkColorTable* ctable = new SkColorTable(colorsPM, 4);
bm->setConfig(SkBitmap::kIndex8_Config, 2, 2); bm->setConfig(SkBitmap::kIndex8_Config, 2, 2);
bm->allocPixels(ctable); bm->allocPixels(ctable);
ctable->unref(); ctable->unref();

View File

@ -24,13 +24,17 @@ protected:
SkBitmap sprite; SkBitmap sprite;
sprite.setConfig(SkBitmap::kARGB_8888_Config, 4, 4, 4*sizeof(SkColor)); sprite.setConfig(SkBitmap::kARGB_8888_Config, 4, 4, 4*sizeof(SkColor));
SkColor spriteData[16] = { const SkColor spriteData[16] = {
SK_ColorBLACK, SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, SK_ColorBLACK, SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, SK_ColorRED, SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, SK_ColorRED,
SK_ColorGREEN, SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLUE, SK_ColorGREEN, SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLUE,
SK_ColorYELLOW, SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorBLACK SK_ColorYELLOW, SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorBLACK
}; };
sprite.setPixels(spriteData); SkPMColor spriteDataPM[16];
for (size_t i = 0; i < SK_ARRAY_COUNT(spriteData); ++i) {
spriteDataPM[i] = SkPreMultiplyColor(spriteData[i]);
}
sprite.setPixels(spriteDataPM);
// We draw a magnified subrect of the sprite // We draw a magnified subrect of the sprite
// sample interpolation may cause color bleeding around edges // sample interpolation may cause color bleeding around edges