Add serialization of SkBitmapSource's new filterQuality member variable
authorrobertphillips <robertphillips@google.com>
Fri, 10 Apr 2015 15:39:58 +0000 (08:39 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 10 Apr 2015 15:39:58 +0000 (08:39 -0700)
Missed this in https://codereview.chromium.org/1072603002/ (Add GM to repro crbug.com/472795)

Review URL: https://codereview.chromium.org/1078113002

include/core/SkPicture.h
src/core/SkReadBuffer.h
src/effects/SkBitmapSource.cpp

index 2dc9258..f514828 100644 (file)
@@ -244,13 +244,14 @@ private:
     // V38: Added PictureResolution option to SkPictureImageFilter
     // V39: Added FilterLevel option to SkPictureImageFilter
     // V40: Remove UniqueID serialization from SkImageFilter.
+    // V41: Added serialization of SkBitmapSource's filterQuality parameter
 
     // 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 = 35;     // Produced by Chrome M39.
-    static const uint32_t CURRENT_PICTURE_VERSION = 40;
+    static const uint32_t CURRENT_PICTURE_VERSION = 41;
 
     void createHeader(SkPictInfo* info) const;
     static bool IsValidPictInfo(const SkPictInfo& info);
index 65255e6..f009938 100644 (file)
@@ -56,6 +56,7 @@ public:
         kPictureImageFilterResolution_Version = 38,
         kPictureImageFilterLevel_Version   = 39,
         kImageFilterNoUniqueID_Version     = 40,
+        kBitmapourceFilterQuality_Version  = 41
     };
 
     /**
index ee8b798..2624229 100644 (file)
@@ -32,6 +32,12 @@ SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap,
 }
 
 SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) {
+    SkFilterQuality filterQuality;
+    if (buffer.isVersionLT(SkReadBuffer::kBitmapourceFilterQuality_Version)) {
+        filterQuality = kHigh_SkFilterQuality;
+    } else {
+        filterQuality = (SkFilterQuality)buffer.readInt();
+    }
     SkRect src, dst;
     buffer.readRect(&src);
     buffer.readRect(&dst);
@@ -39,10 +45,11 @@ SkFlattenable* SkBitmapSource::CreateProc(SkReadBuffer& buffer) {
     if (!buffer.readBitmap(&bitmap)) {
         return NULL;
     }
-    return SkBitmapSource::Create(bitmap, src, dst);
+    return SkBitmapSource::Create(bitmap, src, dst, filterQuality);
 }
 
 void SkBitmapSource::flatten(SkWriteBuffer& buffer) const {
+    buffer.writeInt(fFilterQuality);
     buffer.writeRect(fSrcRect);
     buffer.writeRect(fDstRect);
     buffer.writeBitmap(fBitmap);