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:
parent
d1a416a97c
commit
2ed67e83c8
@ -3,15 +3,20 @@
|
||||
namespace skiagm {
|
||||
|
||||
static void make_bm(SkBitmap* bm) {
|
||||
const SkColor colors[] = {
|
||||
const SkColor colors[4] = {
|
||||
SK_ColorRED, SK_ColorGREEN,
|
||||
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->allocPixels(ctable);
|
||||
ctable->unref();
|
||||
|
||||
|
||||
*bm->getAddr8(0, 0) = 0;
|
||||
*bm->getAddr8(1, 0) = 1;
|
||||
*bm->getAddr8(0, 1) = 2;
|
||||
@ -57,7 +62,7 @@ static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) {
|
||||
canvas->translate(SkIntToScalar(48), 0);
|
||||
|
||||
canvas->scale(SkIntToScalar(scale), SkIntToScalar(scale));
|
||||
|
||||
|
||||
x += draw_set(canvas, bm, 0, &paint);
|
||||
paint.reset();
|
||||
paint.setAlpha(0x80);
|
||||
@ -90,7 +95,7 @@ protected:
|
||||
|
||||
SkScalar x = SkIntToScalar(10);
|
||||
SkScalar y = SkIntToScalar(10);
|
||||
|
||||
|
||||
canvas->translate(x, y);
|
||||
y = draw_row(canvas, fBM8);
|
||||
canvas->translate(0, y);
|
||||
@ -100,7 +105,7 @@ protected:
|
||||
canvas->translate(0, y);
|
||||
draw_row(canvas, fBM32);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
@ -24,13 +24,17 @@ protected:
|
||||
|
||||
SkBitmap sprite;
|
||||
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_ColorWHITE, SK_ColorBLACK, SK_ColorRED,
|
||||
SK_ColorGREEN, SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLUE,
|
||||
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
|
||||
// sample interpolation may cause color bleeding around edges
|
||||
|
Loading…
Reference in New Issue
Block a user