aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-01-27 07:26:51 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-27 07:26:51 -0800
commit776c0cd9550f16019da6773370dcce70db0c6a09 (patch)
tree87959fbdf9f3752b41a0179a7faaa0d7c6bbe210 /gm
parentca0a1799ffdceb4ccd998468566f39abac2f0b55 (diff)
fix gm to not rely on SkColor's swizzle == SkPMColor's
Diffstat (limited to 'gm')
-rw-r--r--gm/bitmaprect.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/gm/bitmaprect.cpp b/gm/bitmaprect.cpp
index 8fb56f5fca..32eb7b17bb 100644
--- a/gm/bitmaprect.cpp
+++ b/gm/bitmaprect.cpp
@@ -87,22 +87,25 @@ private:
};
//////////////////////////////////////////////////////////////////////////////
-static void make_3x3_bitmap(SkBitmap* bitmap) {
- static const int gXSize = 3;
- static const int gYSize = 3;
+static void make_3x3_bitmap(SkBitmap* bitmap) {
+ const int xSize = 3;
+ const int ySize = 3;
- SkColor textureData[gXSize][gYSize] = {
+ const SkColor textureData[xSize][ySize] = {
{ SK_ColorRED, SK_ColorWHITE, SK_ColorBLUE },
{ SK_ColorGREEN, SK_ColorBLACK, SK_ColorCYAN },
{ 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 < gYSize; y++) {
- for (int x = 0; x < gXSize; x++) {
- *bitmap->getAddr32(x, y) = textureData[x][y];
+ for (int y = 0; y < ySize; y++) {
+ for (int x = 0; x < xSize; x++) {
+ paint.setColor(textureData[x][y]);
+ canvas.drawIRect(SkIRect::MakeXYWH(x, y, 1, 1), paint);
}
}
}