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

Unified Diff: tests/BitmapCopyTest.cpp

Issue 86483002: Revert "Revert "remove kA1_Config, as it is no longer supported"" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add change to picture version Created 7 years, 1 month 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 | « src/utils/debugger/SkObjectParser.cpp ('k') | tests/BitmapGetColorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapCopyTest.cpp
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 5cef1eb98668ed14a8a9183bc82f622722b59cd6..f61d55e953ab3df3ac06b9abc1c1f086f944182c 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 {
« no previous file with comments | « src/utils/debugger/SkObjectParser.cpp ('k') | tests/BitmapGetColorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698