remove kRLE_Index8_Config from SkBitmap
BUG=
R=djsollen@google.com
Review URL: https://codereview.chromium.org/17740003
git-svn-id: http://skia.googlecode.com/svn/trunk@9764 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index e308b88..f89ea4b 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -161,7 +161,6 @@
case kA1_Config:
bpp = 0; // not applicable
break;
- case kRLE_Index8_Config:
case kA8_Config:
case kIndex8_Config:
bpp = 1;
@@ -191,7 +190,6 @@
switch (c) {
case kNo_Config:
- case kRLE_Index8_Config:
break;
case kA1_Config:
rowBytes.set(width);
@@ -473,8 +471,7 @@
dstRowBytes = fRowBytes;
}
- if (getConfig() == kRLE_Index8_Config ||
- dstRowBytes < ComputeRowBytes(getConfig(), fWidth) ||
+ if (dstRowBytes < ComputeRowBytes(getConfig(), fWidth) ||
dst == NULL || (getPixels() == NULL && pixelRef() == NULL))
return false;
@@ -538,19 +535,18 @@
case kARGB_8888_Config:
return (fFlags & kImageIsOpaque_Flag) != 0;
- case kIndex8_Config:
- case kRLE_Index8_Config: {
- uint32_t flags = 0;
+ case kIndex8_Config: {
+ uint32_t flags = 0;
- this->lockPixels();
- // if lockPixels failed, we may not have a ctable ptr
- if (fColorTable) {
- flags = fColorTable->getFlags();
- }
- this->unlockPixels();
-
- return (flags & SkColorTable::kColorsAreOpaque_Flag) != 0;
+ this->lockPixels();
+ // if lockPixels failed, we may not have a ctable ptr
+ if (fColorTable) {
+ flags = fColorTable->getFlags();
}
+ this->unlockPixels();
+
+ return (flags & SkColorTable::kColorsAreOpaque_Flag) != 0;
+ }
case kRGB_565_Config:
return true;
@@ -606,10 +602,6 @@
case SkBitmap::kA1_Config:
base += x >> 3;
break;
- case kRLE_Index8_Config:
- SkDEBUGFAIL("Can't return addr for kRLE_Index8_Config");
- base = NULL;
- break;
default:
SkDEBUGFAIL("Can't return addr for config");
base = NULL;
@@ -654,13 +646,6 @@
uint32_t* addr = this->getAddr32(x, y);
return SkUnPreMultiply::PMColorToColor(addr[0]);
}
- case kRLE_Index8_Config: {
- uint8_t dst;
- const SkBitmap::RLEPixels* rle =
- (const SkBitmap::RLEPixels*)this->getPixels();
- SkPackBits::Unpack8(&dst, x, 1, rle->packedAtY(y));
- return SkUnPreMultiply::PMColorToColor((*fColorTable)[dst]);
- }
case kNo_Config:
SkASSERT(false);
return 0;
@@ -695,7 +680,6 @@
}
return true;
} break;
- case kRLE_Index8_Config:
case SkBitmap::kIndex8_Config: {
SkAutoLockColors alc(bm);
const SkPMColor* table = alc.colors();
@@ -946,34 +930,6 @@
}
}
- if (kRLE_Index8_Config == fConfig) {
- SkAutoLockPixels alp(*this);
- // don't call readyToDraw(), since we can operate w/o a colortable
- // at this stage
- if (this->getPixels() == NULL) {
- return false;
- }
- SkBitmap bm;
-
- bm.setConfig(kIndex8_Config, r.width(), r.height());
- bm.allocPixels(this->getColorTable());
- if (NULL == bm.getPixels()) {
- return false;
- }
-
- const RLEPixels* rle = (const RLEPixels*)this->getPixels();
- uint8_t* dst = bm.getAddr8(0, 0);
- const int width = bm.width();
- const size_t rowBytes = bm.rowBytes();
-
- for (int y = r.fTop; y < r.fBottom; y++) {
- SkPackBits::Unpack8(dst, r.fLeft, width, rle->packedAtY(y));
- dst += rowBytes;
- }
- result->swap(bm);
- return true;
- }
-
// If the upper left of the rectangle was outside the bounds of this SkBitmap, we should have
// exited above.
SkASSERT(static_cast<unsigned>(r.fLeft) < static_cast<unsigned>(this->width()));
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 23aa49b..4935d8f 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2010 Google Inc.
*
@@ -6,8 +5,6 @@
* found in the LICENSE file.
*/
-
-
#include "SkGr.h"
/* Fill out buffer with the compressed format Ganesh expects from a colortable
@@ -213,7 +210,7 @@
case SkBitmap::kARGB_8888_Config:
return kSkia8888_GrPixelConfig;
default:
- // kNo_Config, kA1_Config missing, and kRLE_Index8_Config
+ // kNo_Config, kA1_Config missing
return kUnknown_GrPixelConfig;
}
}
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index 102bd58..a5cb4c2 100644
--- a/src/pdf/SkPDFImage.cpp
+++ b/src/pdf/SkPDFImage.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2010 The Android Open Source Project
*
@@ -6,13 +5,11 @@
* found in the LICENSE file.
*/
-
#include "SkPDFImage.h"
#include "SkBitmap.h"
#include "SkColor.h"
#include "SkColorPriv.h"
-#include "SkPackBits.h"
#include "SkPDFCatalog.h"
#include "SkRect.h"
#include "SkStream.h"
@@ -40,19 +37,6 @@
}
break;
}
- case SkBitmap::kRLE_Index8_Config: {
- const int rowBytes = srcRect.width();
- image = new SkMemoryStream(rowBytes * srcRect.height());
- uint8_t* dst = (uint8_t*)image->getMemoryBase();
- const SkBitmap::RLEPixels* rle =
- (const SkBitmap::RLEPixels*)bitmap.getPixels();
- for (int y = srcRect.fTop; y < srcRect.fBottom; y++) {
- SkPackBits::Unpack8(dst, srcRect.fLeft, rowBytes,
- rle->packedAtY(y));
- dst += rowBytes;
- }
- break;
- }
case SkBitmap::kARGB_4444_Config: {
isTransparent = true;
const int rowBytes = (srcRect.width() * 3 + 1) / 2;
@@ -319,8 +303,7 @@
// if (!image mask) {
if (doingAlpha || alphaOnly) {
insertName("ColorSpace", "DeviceGray");
- } else if (config == SkBitmap::kIndex8_Config ||
- config == SkBitmap::kRLE_Index8_Config) {
+ } else if (config == SkBitmap::kIndex8_Config) {
SkAutoLockPixels alp(bitmap);
insert("ColorSpace",
makeIndexedColorSpace(bitmap.getColorTable()))->unref();