aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-27 14:03:51 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-27 14:03:51 +0000
commit851155c28e18e3f5b702ef15ee7bfb12f3cbacda (patch)
tree46be4be9680b38894563a681726f1afcd770a8e0
parent067fe482663de257c7c4e2887462269813ced255 (diff)
remove SK_SUPPORT_LEGACY_BITMAPFLATTEN code
BUG=skia: R=scroggo@google.com, reed@google.com Author: reed@chromium.org Review URL: https://codereview.chromium.org/303563002 git-svn-id: http://skia.googlecode.com/svn/trunk@14888 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkBitmap.h19
-rw-r--r--src/core/SkBitmap.cpp23
-rw-r--r--src/core/SkReadBuffer.cpp2
-rw-r--r--src/effects/SkBitmapSource.cpp2
4 files changed, 5 insertions, 41 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 4f74bd1eb6..d87f01d232 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -24,8 +24,6 @@ class SkRegion;
class SkString;
class GrTexture;
-//#define SK_SUPPORT_LEGACY_BITMAPFLATTEN
-
/** \class SkBitmap
The SkBitmap class specifies a raster bitmap. A bitmap has an integer width
@@ -688,21 +686,6 @@ public:
bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator,
SkIPoint* offset) const;
-#ifdef SK_SUPPORT_LEGACY_BITMAPFLATTEN
- /** The following two functions provide the means to both flatten and
- unflatten the bitmap AND its pixels into the provided buffer.
- It is recommended that you do not call these functions directly,
- but instead call the write/readBitmap functions on the respective
- buffers as they can optimize the recording process and avoid recording
- duplicate bitmaps and pixelRefs.
- */
- void flatten(SkWriteBuffer&) const;
-#else
-private:
-#endif
- void unflatten(SkReadBuffer&);
-public:
-
SkDEBUGCODE(void validate() const;)
class Allocator : public SkRefCnt {
@@ -799,6 +782,8 @@ private:
void freePixels();
void updatePixelsFromRef() const;
+ void legacyUnflatten(SkReadBuffer&);
+
static void WriteRawPixels(SkWriteBuffer*, const SkBitmap&);
static bool ReadRawPixels(SkReadBuffer*, SkBitmap*);
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp
index 3cd2a79b28..cc3c165a3a 100644
--- a/src/core/SkBitmap.cpp
+++ b/src/core/SkBitmap.cpp
@@ -1347,28 +1347,7 @@ enum {
SERIALIZE_PIXELTYPE_REF_DATA
};
-#ifdef SK_SUPPORT_LEGACY_BITMAPFLATTEN
-void SkBitmap::flatten(SkWriteBuffer& buffer) const {
- fInfo.flatten(buffer);
- buffer.writeInt(fRowBytes);
-
- if (fPixelRef) {
- if (fPixelRef->getFactory()) {
- buffer.writeInt(SERIALIZE_PIXELTYPE_REF_DATA);
- buffer.writeInt(fPixelRefOrigin.fX);
- buffer.writeInt(fPixelRefOrigin.fY);
- buffer.writeFlattenable(fPixelRef);
- return;
- }
- // if we get here, we can't record the pixels
- buffer.writeInt(SERIALIZE_PIXELTYPE_NONE);
- } else {
- buffer.writeInt(SERIALIZE_PIXELTYPE_NONE);
- }
-}
-#endif
-
-void SkBitmap::unflatten(SkReadBuffer& buffer) {
+void SkBitmap::legacyUnflatten(SkReadBuffer& buffer) {
this->reset();
SkImageInfo info;
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 3f21078b1f..88894d13ab 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -266,7 +266,7 @@ bool SkReadBuffer::readBitmap(SkBitmap* bitmap) {
// A size of zero means the SkBitmap was simply flattened.
if (this->isVersionLT(kNoMoreBitmapFlatten_Version)) {
SkBitmap tmp;
- tmp.unflatten(*this);
+ tmp.legacyUnflatten(*this);
// just throw this guy away
} else {
if (SkBitmap::ReadRawPixels(this, bitmap)) {
diff --git a/src/effects/SkBitmapSource.cpp b/src/effects/SkBitmapSource.cpp
index 79f6e92c1d..d8d4329e65 100644
--- a/src/effects/SkBitmapSource.cpp
+++ b/src/effects/SkBitmapSource.cpp
@@ -28,7 +28,7 @@ SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, co
SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) : INHERITED(0, buffer) {
if (buffer.isVersionLT(SkReadBuffer::kNoMoreBitmapFlatten_Version)) {
- fBitmap.unflatten(buffer);
+ fBitmap.legacyUnflatten(buffer);
} else {
buffer.readBitmap(&fBitmap);
}