Reverting revert of r11862 (Constify SkFlattenable::getFactory()) or reverting r11871.
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 21 Oct 2013 12:26:10 +0000 (12:26 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 21 Oct 2013 12:26:10 +0000 (12:26 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@11876 2bbb7eff-a529-9590-31e7-b0007b416f81

include/core/SkFlattenable.h
include/core/SkFlattenableBuffers.h
include/effects/SkDashPathEffect.h
src/core/SkFlattenableBuffers.cpp
src/core/SkOrderedWriteBuffer.cpp
src/core/SkOrderedWriteBuffer.h
src/effects/SkColorFilters.cpp
src/effects/SkDashPathEffect.cpp

index 58e69fd416cb049b56d881942f6f77ebb676e93d..6cc76db46ed872379ef4ae07e8ec1819af29111c 100644 (file)
@@ -27,10 +27,10 @@ class SkFlattenableWriteBuffer;
     }
 
 #define SK_DECLARE_UNFLATTENABLE_OBJECT() \
-    virtual Factory getFactory() SK_OVERRIDE { return NULL; }
+    virtual Factory getFactory() const SK_OVERRIDE { return NULL; }
 
 #define SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(flattenable) \
-    virtual Factory getFactory() SK_OVERRIDE { return CreateProc; } \
+    virtual Factory getFactory() const SK_OVERRIDE { return CreateProc; } \
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { \
         return SkNEW_ARGS(flattenable, (buffer)); \
     }
@@ -53,7 +53,7 @@ public:
      to recreate your class given a buffer (previously written to by your
      override of flatten().
      */
-    virtual Factory getFactory() = 0;
+    virtual Factory getFactory() const = 0;
 
     static Factory NameToFactory(const char name[]);
     static const char* FactoryToName(Factory);
index 51016c737ffbc705b697809830c0ad0ab9164c5c..d71f7c025b6fbafc6631652440a67e3ef3247ee6 100644 (file)
@@ -182,7 +182,7 @@ public:
                                     SkPaint::TextEncoding encoding) = 0;
 
     // common data structures
-    virtual void writeFlattenable(SkFlattenable* flattenable) = 0;
+    virtual void writeFlattenable(const SkFlattenable* flattenable) = 0;
     virtual void writeColor(const SkColor& color) = 0;
     virtual void writeColorArray(const SkColor* color, uint32_t count) = 0;
     virtual void writePoint(const SkPoint& point) = 0;
@@ -222,7 +222,7 @@ public:
 
 protected:
     // A helper function so that each subclass does not have to be a friend of SkFlattenable
-    void flattenObject(SkFlattenable* obj, SkFlattenableWriteBuffer& buffer);
+    void flattenObject(const SkFlattenable* obj, SkFlattenableWriteBuffer& buffer);
 
     uint32_t fFlags;
 };
index 9c0775dfbaa19b347643472b59173bb2624ac006..4e83f45cb6ae320402664866676f4e737d2f9dd9 100644 (file)
@@ -47,7 +47,7 @@ public:
                           const SkStrokeRec&, const SkMatrix&,
                           const SkRect*) const SK_OVERRIDE;
 
-    virtual Factory getFactory() SK_OVERRIDE;
+    virtual Factory getFactory() const SK_OVERRIDE;
 
     static SkFlattenable* CreateProc(SkFlattenableReadBuffer&);
 
index 50a47d5c47c209857f468fae86a575f0bd7c8de2..5167c2ebe9067b1a41c0b3785f0ef37f2cb7ac81 100644 (file)
@@ -51,6 +51,7 @@ void SkFlattenableWriteBuffer::writePaint(const SkPaint& paint) {
     paint.flatten(*this);
 }
 
-void SkFlattenableWriteBuffer::flattenObject(SkFlattenable* obj, SkFlattenableWriteBuffer& buffer) {
+void SkFlattenableWriteBuffer::flattenObject(const SkFlattenable* obj,
+                                             SkFlattenableWriteBuffer& buffer) {
     obj->flatten(buffer);
 }
index 64f52193acaf7c55dab611a5b53f41f13685fd7e..9c31b4c4d7309c71b775376a8422da0bd19bd91c 100644 (file)
@@ -253,7 +253,7 @@ void SkOrderedWriteBuffer::setBitmapEncoder(SkPicture::EncodeBitmap bitmapEncode
     }
 }
 
-void SkOrderedWriteBuffer::writeFlattenable(SkFlattenable* flattenable) {
+void SkOrderedWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
     /*
      *  If we have a factoryset, then the first 32bits tell us...
      *       0: failure to write the flattenable
index 277b7bfd811ccea581a931e6fe50e8d96d87aaf8..f3b414e104a46d52620da2cdcba69638ae9f8f91 100644 (file)
@@ -59,7 +59,7 @@ public:
     virtual void writeEncodedString(const void* value, size_t byteLength,
                                     SkPaint::TextEncoding encoding) SK_OVERRIDE;
 
-    virtual void writeFlattenable(SkFlattenable* flattenable) SK_OVERRIDE;
+    virtual void writeFlattenable(const SkFlattenable* flattenable) SK_OVERRIDE;
     virtual void writeColor(const SkColor& color) SK_OVERRIDE;
     virtual void writeColorArray(const SkColor* color, uint32_t count) SK_OVERRIDE;
     virtual void writePoint(const SkPoint& point) SK_OVERRIDE;
index 41a201ef39559fc232e10319c3a9e65f20c39c8c..a821129e85e34ee07d65c34c5162b13f8a0f7bc7 100644 (file)
@@ -498,7 +498,7 @@ protected:
 
     virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE {}
 
-    virtual Factory getFactory() {
+    virtual Factory getFactory() const {
         return CreateProc;
     }
 
index be065919ceab0667ce8cc85983437cb9b733df33..4aa46ab6bf10f277a81a4bc48e5a203030e89d4e 100644 (file)
@@ -528,7 +528,7 @@ bool SkDashPathEffect::asPoints(PointData* results,
     return true;
 }
 
-SkFlattenable::Factory SkDashPathEffect::getFactory() {
+SkFlattenable::Factory SkDashPathEffect::getFactory() const {
     return fInitialDashLength < 0 ? NULL : CreateProc;
 }