diff options
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkFlattenable.h | 43 | ||||
-rw-r--r-- | include/core/SkPaint.h | 8 | ||||
-rw-r--r-- | include/core/SkPathEffect.h | 17 | ||||
-rw-r--r-- | include/core/SkPtrRecorder.h | 5 |
4 files changed, 50 insertions, 23 deletions
diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h index 03bcab86e2..fddda551cd 100644 --- a/include/core/SkFlattenable.h +++ b/include/core/SkFlattenable.h @@ -100,11 +100,27 @@ public: fTFArray = array; fTFCount = count; } - + + /** + * Call this with a pre-loaded array of Factories, in the same order as + * were created/written by the writer. SkPicture uses this. + */ void setFactoryPlayback(SkFlattenable::Factory array[], int count) { + fFactoryTDArray = NULL; fFactoryArray = array; fFactoryCount = count; } + + /** + * Call this with an initially empty array, so the reader can cache each + * factory it sees by name. Used by the pipe code in conjunction with + * the writer's kInlineFactoryNames_Flag. + */ + void setFactoryArray(SkTDArray<SkFlattenable::Factory>* array) { + fFactoryTDArray = array; + fFactoryArray = NULL; + fFactoryCount = 0; + } SkTypeface* readTypeface(); SkRefCnt* readRefCnt(); @@ -118,6 +134,7 @@ private: SkTypeface** fTFArray; int fTFCount; + SkTDArray<SkFlattenable::Factory>* fFactoryTDArray; SkFlattenable::Factory* fFactoryArray; int fFactoryCount; @@ -165,12 +182,22 @@ public: SkFactorySet* setFactoryRecorder(SkFactorySet*); enum Flags { - kCrossProcess_Flag = 0x01 + kCrossProcess_Flag = 0x01, + /** + * Instructs the writer to inline Factory names as there are seen the + * first time (after that we store an index). The pipe code uses this. + */ + kInlineFactoryNames_Flag = 0x02, }; - Flags getFlags() const { return fFlags; } + Flags getFlags() const { return (Flags)fFlags; } void setFlags(Flags flags) { fFlags = flags; } - bool isCrossProcess() const { return (fFlags & kCrossProcess_Flag) != 0; } + bool isCrossProcess() const { + return SkToBool(fFlags & kCrossProcess_Flag); + } + bool inlineFactoryNames() const { + return SkToBool(fFlags & kInlineFactoryNames_Flag); + } bool persistBitmapPixels() const { return (fFlags & kCrossProcess_Flag) != 0; @@ -179,10 +206,10 @@ public: bool persistTypeface() const { return (fFlags & kCrossProcess_Flag) != 0; } private: - Flags fFlags; - SkRefCntSet* fTFSet; - SkRefCntSet* fRCSet; - SkFactorySet* fFactorySet; + uint32_t fFlags; + SkRefCntSet* fTFSet; + SkRefCntSet* fRCSet; + SkFactorySet* fFactorySet; typedef SkWriter32 INHERITED; }; diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index f4b325fea5..4e83651927 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -876,7 +876,7 @@ private: friend class SkTextToPathIter; }; -////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// #include "SkPathEffect.h" @@ -894,20 +894,18 @@ public: SkPaint::Cap, SkScalar miterLimit = -1); // overrides - // This method is not exported to java. virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width); // overrides for SkFlattenable - // This method is not exported to java. virtual void flatten(SkFlattenableWriteBuffer&); - // This method is not exported to java. virtual Factory getFactory(); + static SkFlattenable* CreateProc(SkFlattenableReadBuffer&); + private: SkScalar fWidth, fMiter; uint8_t fStyle, fJoin, fCap; - static SkFlattenable* CreateProc(SkFlattenableReadBuffer&); SkStrokePathEffect(SkFlattenableReadBuffer&); typedef SkPathEffect INHERITED; diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h index eb1cc23833..f84e1d1b12 100644 --- a/include/core/SkPathEffect.h +++ b/include/core/SkPathEffect.h @@ -31,7 +31,6 @@ class SkPath; */ class SK_API SkPathEffect : public SkFlattenable { public: - // This method is not exported to java. SkPathEffect() {} /** Given a src path and a width value, return true if the patheffect @@ -86,16 +85,16 @@ public: // overrides - // This method is not exported to java. virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width); + static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { + return SkNEW_ARGS(SkComposePathEffect, (buffer)); + } + protected: virtual Factory getFactory() { return CreateProc; } private: - static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { - return SkNEW_ARGS(SkComposePathEffect, (buffer)); - } SkComposePathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} // illegal @@ -121,16 +120,16 @@ public: : INHERITED(first, second) {} // overrides - // This method is not exported to java. virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width); + static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { + return SkNEW_ARGS(SkSumPathEffect, (buffer)); + } + protected: virtual Factory getFactory() { return CreateProc; } private: - static SkFlattenable* CreateProc(SkFlattenableReadBuffer& buffer) { - return SkNEW_ARGS(SkSumPathEffect, (buffer)); - } SkSumPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} // illegal diff --git a/include/core/SkPtrRecorder.h b/include/core/SkPtrRecorder.h index db6c64dfdf..fa87243e52 100644 --- a/include/core/SkPtrRecorder.h +++ b/include/core/SkPtrRecorder.h @@ -89,10 +89,13 @@ private: */ template <typename T> class SkTPtrSet : public SkPtrSet { public: + uint32_t find(T ptr) { + return this->INHERITED::find((void*)ptr); + } uint32_t add(T ptr) { return this->INHERITED::add((void*)ptr); } - + void copyToArray(T* array) const { this->INHERITED::copyToArray((void**)array); } |