diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-23 13:21:55 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-23 13:21:55 +0000 |
commit | 968edcafa61442dc4f7f8ed8f89523d0f353e9fb (patch) | |
tree | 8dc61e70b365735fce8befc3229fecad0ac3bb2b /include | |
parent | 5f640a30b92b7cf926ff1168b386882182bcb3bb (diff) |
stop calling SkBitmap::flatten
BUG=skia:
R=scroggo@google.com, halcanary@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/295793002
git-svn-id: http://skia.googlecode.com/svn/trunk@14867 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkBitmap.h | 13 | ||||
-rw-r--r-- | include/core/SkPicture.h | 3 | ||||
-rw-r--r-- | include/core/SkReadBuffer.h | 8 |
3 files changed, 22 insertions, 2 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 6ffe1bb692..29ff2c5a1a 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -24,6 +24,8 @@ 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 @@ -691,6 +693,7 @@ 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, @@ -699,7 +702,11 @@ public: duplicate bitmaps and pixelRefs. */ void flatten(SkWriteBuffer&) const; +#else +private: +#endif void unflatten(SkReadBuffer&); +public: SkDEBUGCODE(void validate() const;) @@ -796,7 +803,13 @@ private: */ void freePixels(); void updatePixelsFromRef() const; + + static void WriteRawPixels(SkWriteBuffer*, const SkBitmap&); + static bool ReadRawPixels(SkReadBuffer*, SkBitmap*); + friend class SkBitmapSource; // unflatten + friend class SkReadBuffer; // unflatten, rawpixels + friend class SkWriteBuffer; // rawpixels friend struct SkBitmapProcState; }; diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 58335ac728..44681ea7e6 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -328,13 +328,14 @@ protected: // V25: SkDashPathEffect now only writes phase and interval array when flattening // V26: Removed boolean from SkColorShader for inheriting color from SkPaint. // V27: Remove SkUnitMapper from gradients (and skia). + // V28: No longer call bitmap::flatten inside SkWriteBuffer::writeBitmap. // Note: If the picture version needs to be increased then please follow the // steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw // Only SKPs within the min/current picture version range (inclusive) can be read. static const uint32_t MIN_PICTURE_VERSION = 19; - static const uint32_t CURRENT_PICTURE_VERSION = 27; + static const uint32_t CURRENT_PICTURE_VERSION = 28; mutable uint32_t fUniqueID; diff --git a/include/core/SkReadBuffer.h b/include/core/SkReadBuffer.h index e962234ddb..5364bee285 100644 --- a/include/core/SkReadBuffer.h +++ b/include/core/SkReadBuffer.h @@ -45,6 +45,7 @@ public: kDashWritesPhaseIntervals_Version = 25, kColorShaderNoBool_Version = 26, kNoUnitMappers_Version = 27, + kNoMoreBitmapFlatten_Version = 28, }; /** @@ -149,7 +150,12 @@ public: // helpers to get info about arrays and binary data virtual uint32_t getArrayCount(); - virtual void readBitmap(SkBitmap* bitmap); + /** + * Returns false if the bitmap could not be completely read. In that case, it will be set + * to have width/height, but no pixels. + */ + bool readBitmap(SkBitmap* bitmap); + virtual SkTypeface* readTypeface(); void setBitmapStorage(SkBitmapHeapReader* bitmapStorage) { |