aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-06-17 08:38:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-17 08:38:31 -0700
commitc3b3266b7db2f1a41d41ecac010c766b7ad8eebc (patch)
treec45d9892b2ac00bfe74f322eafb6e68d8121a9ea /src
parenta272d6d0653620cb6b683a70d3e6993d380147d9 (diff)
hide SkBitmap::Config entirely (behind a flag)
patch from issue 339463002 TBR= I think the NoGPU failure is unrelated, so ignoring NOTRY=True Author: reed@google.com Review URL: https://codereview.chromium.org/340533002
Diffstat (limited to 'src')
-rw-r--r--src/animator/SkDrawBitmap.cpp4
-rw-r--r--src/core/SkBitmap.cpp2
-rw-r--r--src/gpu/SkGr.cpp2
-rw-r--r--src/image/SkImagePriv.cpp2
-rw-r--r--src/images/SkImageDecoder.cpp8
5 files changed, 16 insertions, 2 deletions
diff --git a/src/animator/SkDrawBitmap.cpp b/src/animator/SkDrawBitmap.cpp
index ce96efbed2..f481ee7dba 100644
--- a/src/animator/SkDrawBitmap.cpp
+++ b/src/animator/SkDrawBitmap.cpp
@@ -56,7 +56,7 @@ const SkMemberInfo SkDrawBitmap::fInfo[] = {
DEFINE_GET_MEMBER(SkDrawBitmap);
-SkDrawBitmap::SkDrawBitmap() : format((SkBitmap::Config) -1), height(-1),
+SkDrawBitmap::SkDrawBitmap() : format((SkColorType) -1), height(-1),
rowBytes(0), width(-1), fColor(0), fColorSet(false) {
}
@@ -88,7 +88,7 @@ void SkDrawBitmap::onEndElement(SkAnimateMaker&) {
SkASSERT(width != -1);
SkASSERT(height != -1);
SkASSERT(rowBytes >= 0);
- SkColorType colorType = SkBitmapConfigToColorType((SkBitmap::Config)format);
+ SkColorType colorType = SkColorType(format);
fBitmap.setInfo(SkImageInfo::Make(width, height, colorType, kPremul_SkAlphaType), rowBytes);
fBitmap.allocPixels();
if (fColorSet)
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 0490e8f482..789bf11b4c 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -91,9 +91,11 @@ void SkBitmap::reset() {
sk_bzero(this, sizeof(*this));
}
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
SkBitmap::Config SkBitmap::config() const {
return SkColorTypeToBitmapConfig(fInfo.colorType());
}
+#endif
#ifdef SK_SUPPORT_LEGACY_COMPUTE_CONFIG_SIZE
int SkBitmap::ComputeBytesPerPixel(SkBitmap::Config config) {
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 34e5d0fde3..8e7cea64d4 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -343,6 +343,7 @@ void GrUnlockAndUnrefCachedBitmapTexture(GrTexture* texture) {
///////////////////////////////////////////////////////////////////////////////
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) {
switch (config) {
case SkBitmap::kA8_Config:
@@ -360,6 +361,7 @@ GrPixelConfig SkBitmapConfig2GrPixelConfig(SkBitmap::Config config) {
return kUnknown_GrPixelConfig;
}
}
+#endif
// alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
// alpha info, that will be considered.
diff --git a/src/image/SkImagePriv.cpp b/src/image/SkImagePriv.cpp
index 3ea61d519b..f5b785877c 100644
--- a/src/image/SkImagePriv.cpp
+++ b/src/image/SkImagePriv.cpp
@@ -9,6 +9,7 @@
#include "SkCanvas.h"
#include "SkPicture.h"
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType colorType) {
switch (colorType) {
case kAlpha_8_SkColorType:
@@ -45,6 +46,7 @@ SkColorType SkBitmapConfigToColorType(SkBitmap::Config config) {
SkASSERT((unsigned)config < SK_ARRAY_COUNT(gCT));
return gCT[config];
}
+#endif
SkImage* SkNewImageFromBitmap(const SkBitmap& bm, bool canSharePixelRef) {
const SkImageInfo info = bm.info();
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index b124187505..fe61906357 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -23,7 +23,9 @@ SkImageDecoder::SkImageDecoder()
, fSampleSize(1)
, fDefaultPref(kUnknown_SkColorType)
, fDitherImage(true)
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
, fUsePrefTable(false)
+#endif
, fSkipWritingZeroes(false)
, fPreferQualityOverSpeed(false)
, fRequireUnpremultipliedColors(false) {
@@ -47,11 +49,13 @@ void SkImageDecoder::copyFieldsToOther(SkImageDecoder* other) {
#endif
other->setAllocator(fAllocator);
other->setSampleSize(fSampleSize);
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
if (fUsePrefTable) {
other->setPrefConfigTable(fPrefTable);
} else {
other->fDefaultPref = fDefaultPref;
}
+#endif
other->setDitherImage(fDitherImage);
other->setSkipWritingZeroes(fSkipWritingZeroes);
other->setPreferQualityOverSpeed(fPreferQualityOverSpeed);
@@ -140,15 +144,18 @@ bool SkImageDecoder::allocPixelRef(SkBitmap* bitmap,
///////////////////////////////////////////////////////////////////////////////
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
void SkImageDecoder::setPrefConfigTable(const PrefConfigTable& prefTable) {
fUsePrefTable = true;
fPrefTable = prefTable;
}
+#endif
// TODO: use colortype in fPrefTable, fDefaultPref so we can stop using SkBitmapConfigToColorType()
//
SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha) const {
SkColorType ct = fDefaultPref;
+#ifdef SK_SUPPORT_LEGACY_BITMAP_CONFIG
if (fUsePrefTable) {
// Until we kill or change the PrefTable, we have to go into Config land for a moment.
@@ -169,6 +176,7 @@ SkColorType SkImageDecoder::getPrefColorType(SrcDepth srcDepth, bool srcHasAlpha
// now return to SkColorType land
ct = SkBitmapConfigToColorType(config);
}
+#endif
return ct;
}