34 {
35 const uint32_t* canvasPixels =
static_cast<const uint32_t*
>(
bitmap.getPixels());
36
37 bool failureFound = false;
38 bool foundNonBlue = false;
39
40 for (int cy = 0; cy < 8 && !failureFound; ++cy) {
41 int cx = 4;
42 SkPMColor canvasPixel = canvasPixels[cy * 8 + cx];
43
44
45
46
47
48 if (cy == 3) {
49 if (canvasPixel != 0xFFFF0000 && canvasPixel != 0xFF00FF00) {
50 failureFound = true;
51 ERRORF(
reporter,
"Wrong color at %d, %d. Got 0x%08x when we expected Blue or Green."
52 " Origin is: %s",
53 cx, cy, canvasPixel, GrSurfaceOriginToStr(origin));
54 }
55 if (canvasPixel != 0XFFFF0000) {
56 foundNonBlue = true;
57 }
58 } else {
60 if (cy == 4 && !foundNonBlue) {
61 expectedPixel = 0xFF00FF00;
62 } else {
63 expectedPixel = 0xFFFF0000;
64 }
65 if (canvasPixel != expectedPixel) {
66 failureFound = true;
68 "Wrong color at %d, %d. Got 0x%08x when we expected 0x%08x. Origin is: %s",
69 cx, cy, canvasPixel, expectedPixel, GrSurfaceOriginToStr(origin));
70 }
71 }
72 }
73}