fix gm to not rely on SkColor's swizzle == SkPMColor's

BUG=skia:3361

Review URL: https://codereview.chromium.org/873983009
This commit is contained in:
reed 2015-01-27 07:26:51 -08:00 committed by Commit bot
parent ca0a1799ff
commit 776c0cd955

View File

@ -87,22 +87,25 @@ private:
}; };
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
static void make_3x3_bitmap(SkBitmap* bitmap) { static void make_3x3_bitmap(SkBitmap* bitmap) {
const int xSize = 3;
const int ySize = 3;
static const int gXSize = 3; const SkColor textureData[xSize][ySize] = {
static const int gYSize = 3;
SkColor textureData[gXSize][gYSize] = {
{ SK_ColorRED, SK_ColorWHITE, SK_ColorBLUE }, { SK_ColorRED, SK_ColorWHITE, SK_ColorBLUE },
{ SK_ColorGREEN, SK_ColorBLACK, SK_ColorCYAN }, { SK_ColorGREEN, SK_ColorBLACK, SK_ColorCYAN },
{ SK_ColorYELLOW, SK_ColorGRAY, SK_ColorMAGENTA } { SK_ColorYELLOW, SK_ColorGRAY, SK_ColorMAGENTA }
}; };
bitmap->allocN32Pixels(xSize, ySize, true);
SkCanvas canvas(*bitmap);
SkPaint paint;
bitmap->allocN32Pixels(gXSize, gYSize); for (int y = 0; y < ySize; y++) {
for (int y = 0; y < gYSize; y++) { for (int x = 0; x < xSize; x++) {
for (int x = 0; x < gXSize; x++) { paint.setColor(textureData[x][y]);
*bitmap->getAddr32(x, y) = textureData[x][y]; canvas.drawIRect(SkIRect::MakeXYWH(x, y, 1, 1), paint);
} }
} }
} }