Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkRect.h" | 10 #include "SkRect.h" |
| 11 #include "SkRandom.h" | 11 #include "SkRandom.h" |
| 12 | 12 |
| 13 static int nextRand(SkRandom& rand, int min, int max) { | 13 static int nextRand(SkRandom& rand, int min, int max) { |
| 14 return min + (int)rand.nextRangeU(0, max - min); | 14 return min + (int)rand.nextRangeU(0, max - min); |
| 15 } | 15 } |
| 16 | 16 |
| 17 static void rand_irect(SkIRect* rect, int W, int H, SkRandom& rand) { | 17 static void rand_irect(SkIRect* rect, int W, int H, SkRandom& rand) { |
| 18 const int DX = W / 2; | 18 const int DX = W / 2; |
| 19 const int DY = H / 2; | 19 const int DY = H / 2; |
| 20 | 20 |
| 21 rect->fLeft = nextRand(rand, -DX, W + DX); | 21 rect->fLeft = nextRand(rand, -DX, W + DX); |
| 22 rect->fTop = nextRand(rand, -DY, H + DY); | 22 rect->fTop = nextRand(rand, -DY, H + DY); |
| 23 rect->fRight = nextRand(rand, -DX, W + DX); | 23 rect->fRight = nextRand(rand, -DX, W + DX); |
| 24 rect->fBottom = nextRand(rand, -DY, H + DY); | 24 rect->fBottom = nextRand(rand, -DY, H + DY); |
| 25 rect->sort(); | 25 rect->sort(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 static void test_equal_A1_A8(skiatest::Reporter* reporter, | 28 static void test_equal_A1_A8(skiatest::Reporter* reporter, |
| 29 const SkBitmap& bm1, const SkBitmap& bm8) { | 29 const SkBitmap& bm1, const SkBitmap& bm8) { |
| 30 return; | |
|
scroggo
2013/11/20 21:04:28
This doesn't hit any of our warnings?
reed1
2013/11/20 21:27:18
A1 no longer supported
scroggo
2013/11/20 21:35:19
Can we go ahead and remove this whole function?
I
| |
| 30 SkASSERT(SkBitmap::kA1_Config == bm1.config()); | 31 SkASSERT(SkBitmap::kA1_Config == bm1.config()); |
| 31 SkASSERT(SkBitmap::kA8_Config == bm8.config()); | 32 SkASSERT(SkBitmap::kA8_Config == bm8.config()); |
| 32 | 33 |
| 33 REPORTER_ASSERT(reporter, bm1.width() == bm8.width()); | 34 REPORTER_ASSERT(reporter, bm1.width() == bm8.width()); |
| 34 REPORTER_ASSERT(reporter, bm1.height() == bm8.height()); | 35 REPORTER_ASSERT(reporter, bm1.height() == bm8.height()); |
| 35 for (int y = 0; y < bm1.height(); ++y) { | 36 for (int y = 0; y < bm1.height(); ++y) { |
| 36 for (int x = 0; x < bm1.width(); ++x) { | 37 for (int x = 0; x < bm1.width(); ++x) { |
| 37 int p1 = *bm1.getAddr1(x, y) & (1 << (7 - (x & 7))); | 38 int p1 = *bm1.getAddr1(x, y) & (1 << (7 - (x & 7))); |
| 38 SkASSERT(SkIsPow2(p1)); | 39 SkASSERT(SkIsPow2(p1)); |
| 39 p1 = p1 ? 0xFF : 0; | 40 p1 = p1 ? 0xFF : 0; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 | 105 |
| 105 SkColor c = bm.getColor(1, 1); | 106 SkColor c = bm.getColor(1, 1); |
| 106 REPORTER_ASSERT(reporter, c == gRec[i].fOutColor); | 107 REPORTER_ASSERT(reporter, c == gRec[i].fOutColor); |
| 107 } | 108 } |
| 108 | 109 |
| 109 test_eraserect_A1(reporter); | 110 test_eraserect_A1(reporter); |
| 110 } | 111 } |
| 111 | 112 |
| 112 #include "TestClassDef.h" | 113 #include "TestClassDef.h" |
| 113 DEFINE_TESTCLASS("GetColor", TestGetColorClass, TestGetColor) | 114 DEFINE_TESTCLASS("GetColor", TestGetColorClass, TestGetColor) |
| OLD | NEW |