diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-26 12:51:57 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-11-26 12:51:57 +0000 |
commit | 11f392ed531f05e8de6b6af6ae607f90aeb080c6 (patch) | |
tree | d958adc62566d8102f1189a2b82a28abb684aa64 /tests | |
parent | 6300f4d1f3bd2e1a4d991ab28e843bcc3d4a4691 (diff) |
Revert "Revert "remove kA1_Config, as it is no longer supported""
This reverts commit 36d712f2d4c5c79719280ad95523e6aaa88b068e.
BUG=
R=rmistry@google.com, mtklein@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/86483002
git-svn-id: http://skia.googlecode.com/svn/trunk@12392 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/BitmapCopyTest.cpp | 68 | ||||
-rw-r--r-- | tests/BitmapGetColorTest.cpp | 63 | ||||
-rw-r--r-- | tests/BlitRowTest.cpp | 2 | ||||
-rw-r--r-- | tests/ImageDecodingTest.cpp | 2 |
4 files changed, 14 insertions, 121 deletions
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index 5cef1eb986..f61d55e953 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -15,7 +15,7 @@ static const char* boolStr(bool value) { // these are in the same order as the SkBitmap::Config enum static const char* gConfigName[] = { - "None", "A1", "A8", "Index8", "565", "4444", "8888", "RLE_Index8" + "None", "A8", "Index8", "565", "4444", "8888" }; static void report_opaqueness(skiatest::Reporter* reporter, const SkBitmap& src, @@ -57,10 +57,6 @@ static void init_src(const SkBitmap& bitmap) { if (bitmap.getPixels()) { if (bitmap.getColorTable()) { sk_bzero(bitmap.getPixels(), bitmap.getSize()); - } else if (SkBitmap::kA1_Config == bitmap.config()) { - // The A1 config can have uninitialized bits at the - // end of each row if eraseColor is used - memset(bitmap.getPixels(), 0xff, bitmap.getSafeSize()); } else { bitmap.eraseColor(SK_ColorWHITE); } @@ -92,7 +88,7 @@ struct Pair { static uint32_t getPixel(int x, int y, const SkBitmap& bm) { uint32_t val = 0; uint16_t val16; - uint8_t val8, shift; + uint8_t val8; SkAutoLockPixels lock(bm); const void* rawAddr = bm.getAddr(x,y); @@ -110,11 +106,6 @@ static uint32_t getPixel(int x, int y, const SkBitmap& bm) { memcpy(&val8, rawAddr, sizeof(uint8_t)); val = val8; break; - case SkBitmap::kA1_Config: - memcpy(&val8, rawAddr, sizeof(uint8_t)); - shift = x % 8; - val = (val8 >> shift) & 0x1 ; - break; default: break; } @@ -126,7 +117,7 @@ static uint32_t getPixel(int x, int y, const SkBitmap& bm) { // converted to, but at present uint32_t can handle all formats. static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) { uint16_t val16; - uint8_t val8, shift; + uint8_t val8; SkAutoLockPixels lock(bm); void* rawAddr = bm.getAddr(x,y); @@ -144,15 +135,6 @@ static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) { val8 = val & 0xFF; memcpy(rawAddr, &val8, sizeof(uint8_t)); break; - case SkBitmap::kA1_Config: - shift = x % 8; // We assume we're in the right byte. - memcpy(&val8, rawAddr, sizeof(uint8_t)); - if (val & 0x1) // Turn bit on. - val8 |= (0x1 << shift); - else // Turn bit off. - val8 &= ~(0x1 << shift); - memcpy(rawAddr, &val8, sizeof(uint8_t)); - break; default: // Ignore. break; @@ -164,7 +146,6 @@ static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) { static const char* getSkConfigName(const SkBitmap& bm) { switch (bm.config()) { case SkBitmap::kNo_Config: return "SkBitmap::kNo_Config"; - case SkBitmap::kA1_Config: return "SkBitmap::kA1_Config"; case SkBitmap::kA8_Config: return "SkBitmap::kA8_Config"; case SkBitmap::kIndex8_Config: return "SkBitmap::kIndex8_Config"; case SkBitmap::kRGB_565_Config: return "SkBitmap::kRGB_565_Config"; @@ -225,13 +206,12 @@ static void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) { static void TestBitmapCopy(skiatest::Reporter* reporter) { static const Pair gPairs[] = { - { SkBitmap::kNo_Config, "00000000" }, - { SkBitmap::kA1_Config, "01000000" }, - { SkBitmap::kA8_Config, "00101010" }, - { SkBitmap::kIndex8_Config, "00111010" }, - { SkBitmap::kRGB_565_Config, "00101010" }, - { SkBitmap::kARGB_4444_Config, "00101110" }, - { SkBitmap::kARGB_8888_Config, "00101110" }, + { SkBitmap::kNo_Config, "0000000" }, + { SkBitmap::kA8_Config, "0101010" }, + { SkBitmap::kIndex8_Config, "0111010" }, + { SkBitmap::kRGB_565_Config, "0101010" }, + { SkBitmap::kARGB_4444_Config, "0101110" }, + { SkBitmap::kARGB_8888_Config, "0101110" }, }; static const bool isExtracted[] = { @@ -375,12 +355,6 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) { case SkBitmap::kNo_Config: break; - case SkBitmap::kA1_Config: - if (safeSize.fHi != 0x470DE || - safeSize.fLo != 0x4DF82000) - sizeFail = true; - break; - case SkBitmap::kA8_Config: case SkBitmap::kIndex8_Config: if (safeSize.fHi != 0x2386F2 || @@ -411,21 +385,8 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) { reporter->reportFailed(str); } - int subW, subH; - // Set sizes to be height = 2 to force the last row of the - // source to be used, thus verifying correct operation if - // the bitmap is an extracted subset. - if (gPairs[i].fConfig == SkBitmap::kA1_Config) { - // If one-bit per pixel, use 9 pixels to force more than - // one byte per row. - subW = 9; - subH = 2; - } else { - // All other configurations are at least one byte per pixel, - // and different configs will test copying different numbers - // of bytes. - subW = subH = 2; - } + int subW = 2; + int subH = 2; // Create bitmap to act as source for copies and subsets. SkBitmap src, subset; @@ -449,12 +410,7 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) { // The extractedSubset() test case allows us to test copy- // ing when src and dst mave possibly different strides. SkIRect r; - if (gPairs[i].fConfig == SkBitmap::kA1_Config) - // This config seems to need byte-alignment of - // extracted subset bits. - r.set(0, 0, subW, subH); - else - r.set(1, 0, 1 + subW, subH); // 2x2 extracted bitmap + r.set(1, 0, 1 + subW, subH); // 2x2 extracted bitmap srcReady = src.extractSubset(&subset, r); } else { diff --git a/tests/BitmapGetColorTest.cpp b/tests/BitmapGetColorTest.cpp index 11c22e6fa3..40aa3e26bf 100644 --- a/tests/BitmapGetColorTest.cpp +++ b/tests/BitmapGetColorTest.cpp @@ -10,67 +10,6 @@ #include "SkRect.h" #include "SkRandom.h" -static int nextRand(SkRandom& rand, int min, int max) { - return min + (int)rand.nextRangeU(0, max - min); -} - -static void rand_irect(SkIRect* rect, int W, int H, SkRandom& rand) { - const int DX = W / 2; - const int DY = H / 2; - - rect->fLeft = nextRand(rand, -DX, W + DX); - rect->fTop = nextRand(rand, -DY, H + DY); - rect->fRight = nextRand(rand, -DX, W + DX); - rect->fBottom = nextRand(rand, -DY, H + DY); - rect->sort(); -} - -static void test_equal_A1_A8(skiatest::Reporter* reporter, - const SkBitmap& bm1, const SkBitmap& bm8) { - SkASSERT(SkBitmap::kA1_Config == bm1.config()); - SkASSERT(SkBitmap::kA8_Config == bm8.config()); - - REPORTER_ASSERT(reporter, bm1.width() == bm8.width()); - REPORTER_ASSERT(reporter, bm1.height() == bm8.height()); - for (int y = 0; y < bm1.height(); ++y) { - for (int x = 0; x < bm1.width(); ++x) { - int p1 = *bm1.getAddr1(x, y) & (1 << (7 - (x & 7))); - SkASSERT(SkIsPow2(p1)); - p1 = p1 ? 0xFF : 0; - - int p8 = *bm8.getAddr8(x, y); - SkASSERT(0 == p8 || 0xFF == p8); - - REPORTER_ASSERT(reporter, p1 == p8); - } - } -} - -static void test_eraserect_A1(skiatest::Reporter* reporter) { - const int W = 43; - const int H = 13; - - SkBitmap bm1, bm8; - - bm1.setConfig(SkBitmap::kA1_Config, W, H); - bm1.allocPixels(); - bm8.setConfig(SkBitmap::kA8_Config, W, H); - bm8.allocPixels(); - - SkRandom rand; - for (int i = 0; i < 10000; ++i) { - SkIRect area; - rand_irect(&area, W, H, rand); - - bm1.eraseColor(0); - bm8.eraseColor(0); - - bm1.eraseArea(area, SK_ColorWHITE); - bm8.eraseArea(area, SK_ColorWHITE); - test_equal_A1_A8(reporter, bm1, bm8); - } -} - static void TestGetColor(skiatest::Reporter* reporter) { static const struct Rec { SkBitmap::Config fConfig; @@ -105,8 +44,6 @@ static void TestGetColor(skiatest::Reporter* reporter) { SkColor c = bm.getColor(1, 1); REPORTER_ASSERT(reporter, c == gRec[i].fOutColor); } - - test_eraserect_A1(reporter); } #include "TestClassDef.h" diff --git a/tests/BlitRowTest.cpp b/tests/BlitRowTest.cpp index 3903efbfba..85761104b2 100644 --- a/tests/BlitRowTest.cpp +++ b/tests/BlitRowTest.cpp @@ -14,7 +14,7 @@ // these are in the same order as the SkBitmap::Config enum static const char* gConfigName[] = { - "None", "A1", "A8", "Index8", "565", "4444", "8888", "RLE_Index8" + "None", "A8", "Index8", "565", "4444", "8888" }; /** Returns -1 on success, else the x coord of the first bad pixel, return its diff --git a/tests/ImageDecodingTest.cpp b/tests/ImageDecodingTest.cpp index 56193f4e47..6fcef1d315 100644 --- a/tests/ImageDecodingTest.cpp +++ b/tests/ImageDecodingTest.cpp @@ -148,7 +148,7 @@ public: // the list is that each one is different, so we can test // to make sure the correct config is chosen. const SkBitmap::Config configs[] = { - SkBitmap::kA1_Config, + SkBitmap::kA8_Config, SkBitmap::kA8_Config, SkBitmap::kIndex8_Config, SkBitmap::kRGB_565_Config, |