Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: gm/bitmaprect.cpp

Issue 873983009: fix gm to not rely on SkColor's swizzle == SkPMColor's (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/bitmaprect.cpp
diff --git a/gm/bitmaprect.cpp b/gm/bitmaprect.cpp
index 8fb56f5fcaa71384cc43cd305270727342d838f1..32eb7b17bb93700d332f3fefa0ca50bfec0fca09 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);
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698