diff options
author | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-29 15:18:04 +0000 |
---|---|---|
committer | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-03-29 15:18:04 +0000 |
commit | 54924243c1b65b3ee6d8fa064b50a9b1bb2a19a5 (patch) | |
tree | e27f07f67a7d5ecd2149ced9d389c1a078ebb656 /src/effects | |
parent | 5a64e58ebb19228828eaa800822afa4d9510ccf2 (diff) |
Cleanup code related to SkFlattenable::flatten()
The following changes were made by this CL:
1. Make flatten() a protected method as callers should use
SkFlattenableWriteBuffer to flatten an object
2. Make flatten a const method (including subclasses)
3. Mark subclass implementation of flatten with SK_OVERRIDE
4. Ensure overridden flatten impls call their parent
5. Remove no-op implementations of flatten from subclasses
Additionally, if necessary the unflattening constructor was
also moved to the protected section of the subclasses
header if it was not already there.
git-svn-id: http://skia.googlecode.com/svn/trunk@3540 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
24 files changed, 79 insertions, 81 deletions
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp index 11170f4a46..62ca7b39b8 100644 --- a/src/effects/Sk1DPathEffect.cpp +++ b/src/effects/Sk1DPathEffect.cpp @@ -156,7 +156,8 @@ SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) { return fInitialOffset; } -void SkPath1DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) { +void SkPath1DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { + this->INHERITED::flatten(buffer); buffer.writeScalar(fAdvance); if (fAdvance > 0) { fPath.flatten(buffer); diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp index 60ec2576d3..9a9216215a 100644 --- a/src/effects/Sk2DPathEffect.cpp +++ b/src/effects/Sk2DPathEffect.cpp @@ -64,7 +64,8 @@ void Sk2DPathEffect::end(SkPath* dst) {} /////////////////////////////////////////////////////////////////////////////// -void Sk2DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) { +void Sk2DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { + this->INHERITED::flatten(buffer); char storage[SkMatrix::kMaxFlattenSize]; uint32_t size = fMatrix.flatten(storage); buffer.write32(size); @@ -92,7 +93,7 @@ SkPath2DPathEffect::SkPath2DPathEffect(SkFlattenableReadBuffer& buffer) fPath.unflatten(buffer); } -void SkPath2DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) { +void SkPath2DPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); fPath.flatten(buffer); } diff --git a/src/effects/SkAvoidXfermode.cpp b/src/effects/SkAvoidXfermode.cpp index d6682226ca..b5375e602f 100644 --- a/src/effects/SkAvoidXfermode.cpp +++ b/src/effects/SkAvoidXfermode.cpp @@ -29,7 +29,7 @@ SkAvoidXfermode::SkAvoidXfermode(SkFlattenableReadBuffer& buffer) fMode = (Mode)buffer.readU8(); } -void SkAvoidXfermode::flatten(SkFlattenableWriteBuffer& buffer) +void SkAvoidXfermode::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp index 656f8f7d6c..3b785731fa 100644 --- a/src/effects/SkBlurDrawLooper.cpp +++ b/src/effects/SkBlurDrawLooper.cpp @@ -61,7 +61,8 @@ SkBlurDrawLooper::~SkBlurDrawLooper() { SkSafeUnref(fColorFilter); } -void SkBlurDrawLooper::flatten(SkFlattenableWriteBuffer& buffer) { +void SkBlurDrawLooper::flatten(SkFlattenableWriteBuffer& buffer) const { + this->INHERITED::flatten(buffer); buffer.writeScalar(fDx); buffer.writeScalar(fDy); buffer.write32(fBlurColor); diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp index 1446e92117..522f4b05ea 100644 --- a/src/effects/SkBlurImageFilter.cpp +++ b/src/effects/SkBlurImageFilter.cpp @@ -24,7 +24,7 @@ bool SkBlurImageFilter::asABlur(SkSize* sigma) const { return true; } -void SkBlurImageFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkBlurImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeScalar(fSigma.fWidth); buffer.writeScalar(fSigma.fHeight); diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index eb64000007..306770bb65 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -24,9 +24,6 @@ public: virtual BlurType asABlur(BlurInfo*) const SK_OVERRIDE; virtual void computeFastBounds(const SkRect& src, SkRect* dst) SK_OVERRIDE; - // overrides from SkFlattenable - virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE; - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl) private: @@ -35,6 +32,7 @@ private: uint32_t fBlurFlags; SkBlurMaskFilterImpl(SkFlattenableReadBuffer&); + virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; typedef SkMaskFilter INHERITED; }; @@ -112,7 +110,7 @@ SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkFlattenableReadBuffer& buffer) SkASSERT((unsigned)fBlurStyle < SkBlurMaskFilter::kBlurStyleCount); } -void SkBlurMaskFilterImpl::flatten(SkFlattenableWriteBuffer& buffer) { +void SkBlurMaskFilterImpl::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeScalar(fRadius); buffer.write32(fBlurStyle); diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp index 2970c7c218..3b97250930 100644 --- a/src/effects/SkColorFilters.cpp +++ b/src/effects/SkColorFilters.cpp @@ -50,7 +50,7 @@ public: bool isModeValid() const { return ILLEGAL_XFERMODE_MODE != fMode; } protected: - virtual void flatten(SkFlattenableWriteBuffer& buffer) { + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { this->INHERITED::flatten(buffer); buffer.write32(fColor); buffer.write32(fMode); @@ -193,7 +193,7 @@ public: SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Proc_SkModeColorFilter) protected: - virtual void flatten(SkFlattenableWriteBuffer& buffer) { + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { this->INHERITED::flatten(buffer); buffer.writeFunctionPtr((void*)fProc); buffer.writeFunctionPtr((void*)fProc16); @@ -312,7 +312,7 @@ public: SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLightingColorFilter) protected: - virtual void flatten(SkFlattenableWriteBuffer& buffer) { + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { this->INHERITED::flatten(buffer); buffer.write32(fMul); buffer.write32(fAdd); @@ -489,7 +489,7 @@ protected: } } - virtual void flatten(SkFlattenableWriteBuffer& buffer) {} + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE {} virtual Factory getFactory() { return CreateProc; diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index 47ff8ad6ac..c6886250fa 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -310,7 +310,7 @@ void SkColorMatrixFilter::filterSpan16(const uint16_t src[], int count, /////////////////////////////////////////////////////////////////////////////// -void SkColorMatrixFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkColorMatrixFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeFunctionPtr((void*)fProc); diff --git a/src/effects/SkCornerPathEffect.cpp b/src/effects/SkCornerPathEffect.cpp index 5eb94a438f..bf59a27a1b 100644 --- a/src/effects/SkCornerPathEffect.cpp +++ b/src/effects/SkCornerPathEffect.cpp @@ -129,7 +129,8 @@ DONE: return true; } -void SkCornerPathEffect::flatten(SkFlattenableWriteBuffer& buffer) { +void SkCornerPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { + this->INHERITED::flatten(buffer); buffer.writeScalar(fRadius); } diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp index 7950d648af..88f003b4af 100644 --- a/src/effects/SkDashPathEffect.cpp +++ b/src/effects/SkDashPathEffect.cpp @@ -140,9 +140,10 @@ SkFlattenable::Factory SkDashPathEffect::getFactory() { return fInitialDashLength < 0 ? NULL : CreateProc; } -void SkDashPathEffect::flatten(SkFlattenableWriteBuffer& buffer) { +void SkDashPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { SkASSERT(fInitialDashLength >= 0); + this->INHERITED::flatten(buffer); buffer.write32(fCount); buffer.write32(fInitialDashIndex); buffer.writeScalar(fInitialDashLength); diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp index 089bed6757..e8c0ec9ad2 100644 --- a/src/effects/SkDiscretePathEffect.cpp +++ b/src/effects/SkDiscretePathEffect.cpp @@ -67,7 +67,8 @@ bool SkDiscretePathEffect::filterPath(SkPath* dst, const SkPath& src, return true; } -void SkDiscretePathEffect::flatten(SkFlattenableWriteBuffer& buffer) { +void SkDiscretePathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { + this->INHERITED::flatten(buffer); buffer.writeScalar(fSegLength); buffer.writeScalar(fPerterb); } diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp index 26a5e2ec59..245ccd69df 100644 --- a/src/effects/SkEmbossMaskFilter.cpp +++ b/src/effects/SkEmbossMaskFilter.cpp @@ -122,11 +122,12 @@ SkEmbossMaskFilter::SkEmbossMaskFilter(SkFlattenableReadBuffer& buffer) fBlurRadius = buffer.readScalar(); } -void SkEmbossMaskFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkEmbossMaskFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); - fLight.fPad = 0; // for the font-cache lookup to be clean - buffer.writeMul4(&fLight, sizeof(fLight)); + Light tmpLight = fLight; + tmpLight.fPad = 0; // for the font-cache lookup to be clean + buffer.writeMul4(&tmpLight, sizeof(tmpLight)); buffer.writeScalar(fBlurRadius); } diff --git a/src/effects/SkGradientShader.cpp b/src/effects/SkGradientShader.cpp index 0fcb514585..a93bd52dbb 100644 --- a/src/effects/SkGradientShader.cpp +++ b/src/effects/SkGradientShader.cpp @@ -174,6 +174,8 @@ public: protected: Gradient_Shader(SkFlattenableReadBuffer& ); + virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; + SkUnitMapper* fMapper; SkMatrix fPtsToUnit; // set by subclass SkMatrix fDstToIndex; @@ -190,7 +192,6 @@ protected: }; Rec* fRecs; - virtual void flatten(SkFlattenableWriteBuffer& ); const uint16_t* getCache16() const; const SkPMColor* getCache32() const; @@ -404,7 +405,7 @@ void Gradient_Shader::initCommon() { fColorsAreOpaque = colorAlpha == 0xFF; } -void Gradient_Shader::flatten(SkFlattenableWriteBuffer& buffer) { +void Gradient_Shader::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeFlattenable(fMapper); buffer.write32(fColorCount); @@ -849,22 +850,21 @@ public: SkScalar* twoPointRadialParams) const SK_OVERRIDE; virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; - virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE { - this->INHERITED::flatten(buffer); - buffer.writeScalar(fStart.fX); - buffer.writeScalar(fStart.fY); - buffer.writeScalar(fEnd.fX); - buffer.writeScalar(fEnd.fY); - } - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Linear_Gradient) protected: Linear_Gradient(SkFlattenableReadBuffer& buffer) - : Gradient_Shader(buffer), + : INHERITED(buffer), fStart(unflatten_point(buffer)), fEnd(unflatten_point(buffer)) { } + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { + this->INHERITED::flatten(buffer); + buffer.writeScalar(fStart.fX); + buffer.writeScalar(fStart.fY); + buffer.writeScalar(fEnd.fX); + buffer.writeScalar(fEnd.fY); + } private: typedef Gradient_Shader INHERITED; @@ -1507,21 +1507,20 @@ public: return kRadial_GradientType; } - virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE { - this->INHERITED::flatten(buffer); - buffer.writeScalar(fCenter.fX); - buffer.writeScalar(fCenter.fY); - buffer.writeScalar(fRadius); - } - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Radial_Gradient) protected: Radial_Gradient(SkFlattenableReadBuffer& buffer) - : Gradient_Shader(buffer), + : INHERITED(buffer), fCenter(unflatten_point(buffer)), fRadius(buffer.readScalar()) { } + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { + this->INHERITED::flatten(buffer); + buffer.writeScalar(fCenter.fX); + buffer.writeScalar(fCenter.fY); + buffer.writeScalar(fRadius); + } private: typedef Gradient_Shader INHERITED; @@ -2039,21 +2038,11 @@ public: return true; } - virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE { - this->INHERITED::flatten(buffer); - buffer.writeScalar(fCenter1.fX); - buffer.writeScalar(fCenter1.fY); - buffer.writeScalar(fCenter2.fX); - buffer.writeScalar(fCenter2.fY); - buffer.writeScalar(fRadius1); - buffer.writeScalar(fRadius2); - } - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Two_Point_Radial_Gradient) protected: Two_Point_Radial_Gradient(SkFlattenableReadBuffer& buffer) - : Gradient_Shader(buffer), + : INHERITED(buffer), fCenter1(unflatten_point(buffer)), fCenter2(unflatten_point(buffer)), fRadius1(buffer.readScalar()), @@ -2061,6 +2050,16 @@ protected: init(); }; + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { + this->INHERITED::flatten(buffer); + buffer.writeScalar(fCenter1.fX); + buffer.writeScalar(fCenter1.fY); + buffer.writeScalar(fCenter2.fX); + buffer.writeScalar(fCenter2.fY); + buffer.writeScalar(fRadius1); + buffer.writeScalar(fRadius2); + } + private: typedef Gradient_Shader INHERITED; const SkPoint fCenter1; @@ -2125,19 +2124,18 @@ public: return kSweep_GradientType; } - virtual void flatten(SkFlattenableWriteBuffer& buffer) SK_OVERRIDE { - this->INHERITED::flatten(buffer); - buffer.writeScalar(fCenter.fX); - buffer.writeScalar(fCenter.fY); - } - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sweep_Gradient) protected: Sweep_Gradient(SkFlattenableReadBuffer& buffer) - : Gradient_Shader(buffer), + : INHERITED(buffer), fCenter(unflatten_point(buffer)) { } + virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE { + this->INHERITED::flatten(buffer); + buffer.writeScalar(fCenter.fX); + buffer.writeScalar(fCenter.fY); + } private: typedef Gradient_Shader INHERITED; diff --git a/src/effects/SkGroupShape.cpp b/src/effects/SkGroupShape.cpp index b27026e8b9..83a204396f 100644 --- a/src/effects/SkGroupShape.cpp +++ b/src/effects/SkGroupShape.cpp @@ -83,7 +83,7 @@ void SkGroupShape::onDraw(SkCanvas* canvas) { } } -void SkGroupShape::flatten(SkFlattenableWriteBuffer& buffer) { +void SkGroupShape::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); int count = fList.count(); diff --git a/src/effects/SkKernel33MaskFilter.cpp b/src/effects/SkKernel33MaskFilter.cpp index f01451c4fe..10aabc4e77 100644 --- a/src/effects/SkKernel33MaskFilter.cpp +++ b/src/effects/SkKernel33MaskFilter.cpp @@ -73,7 +73,7 @@ bool SkKernel33ProcMaskFilter::filterMask(SkMask* dst, const SkMask& src, return true; } -void SkKernel33ProcMaskFilter::flatten(SkFlattenableWriteBuffer& wb) { +void SkKernel33ProcMaskFilter::flatten(SkFlattenableWriteBuffer& wb) const { this->INHERITED::flatten(wb); wb.write32(fPercent256); } @@ -104,7 +104,7 @@ uint8_t SkKernel33MaskFilter::computeValue(uint8_t* const* srcRows) { return (uint8_t)value; } -void SkKernel33MaskFilter::flatten(SkFlattenableWriteBuffer& wb) { +void SkKernel33MaskFilter::flatten(SkFlattenableWriteBuffer& wb) const { this->INHERITED::flatten(wb); wb.writeMul4(fKernel, 9 * sizeof(int)); wb.write32(fShift); diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp index acb3e8891f..250306ca16 100644 --- a/src/effects/SkLayerDrawLooper.cpp +++ b/src/effects/SkLayerDrawLooper.cpp @@ -180,7 +180,7 @@ SkLayerDrawLooper::Rec* SkLayerDrawLooper::Rec::Reverse(Rec* head) { /////////////////////////////////////////////////////////////////////////////// -void SkLayerDrawLooper::flatten(SkFlattenableWriteBuffer& buffer) { +void SkLayerDrawLooper::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); #ifdef SK_DEBUG diff --git a/src/effects/SkLayerRasterizer.cpp b/src/effects/SkLayerRasterizer.cpp index ae4eb2eb99..81263d13d1 100644 --- a/src/effects/SkLayerRasterizer.cpp +++ b/src/effects/SkLayerRasterizer.cpp @@ -197,7 +197,7 @@ SkLayerRasterizer::SkLayerRasterizer(SkFlattenableReadBuffer& buffer) } } -void SkLayerRasterizer::flatten(SkFlattenableWriteBuffer& buffer) { +void SkLayerRasterizer::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.write32(fLayers.count()); diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 78fabc5616..09610cd145 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -19,7 +19,7 @@ SkMorphologyImageFilter::SkMorphologyImageFilter(int radiusX, int radiusY) } -void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkMorphologyImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeScalar(fRadius.fWidth); buffer.writeScalar(fRadius.fHeight); diff --git a/src/effects/SkPixelXorXfermode.cpp b/src/effects/SkPixelXorXfermode.cpp index b4bbaf970c..7b58ed76a8 100644 --- a/src/effects/SkPixelXorXfermode.cpp +++ b/src/effects/SkPixelXorXfermode.cpp @@ -18,13 +18,13 @@ SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) { return res; } -void SkPixelXorXfermode::flatten(SkFlattenableWriteBuffer& wb) { +void SkPixelXorXfermode::flatten(SkFlattenableWriteBuffer& wb) const { this->INHERITED::flatten(wb); wb.write32(fOpColor); } SkPixelXorXfermode::SkPixelXorXfermode(SkFlattenableReadBuffer& rb) - : SkXfermode(rb) { + : INHERITED(rb) { fOpColor = rb.readU32(); } diff --git a/src/effects/SkRectShape.cpp b/src/effects/SkRectShape.cpp index d7e2628832..68d1e1f7ff 100644 --- a/src/effects/SkRectShape.cpp +++ b/src/effects/SkRectShape.cpp @@ -60,7 +60,7 @@ void SkRectShape::onDraw(SkCanvas* canvas) { } } -void SkRectShape::flatten(SkFlattenableWriteBuffer& buffer) { +void SkRectShape::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeRect(fBounds); @@ -74,7 +74,7 @@ SkRectShape::SkRectShape(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { /////////////////////////////////////////////////////////////////////////////// -void SkPaintShape::flatten(SkFlattenableWriteBuffer& buffer) { +void SkPaintShape::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); fPaint.flatten(buffer); diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp index 8b60326b40..c709dd495a 100644 --- a/src/effects/SkTableColorFilter.cpp +++ b/src/effects/SkTableColorFilter.cpp @@ -35,12 +35,12 @@ public: virtual void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) SK_OVERRIDE; - virtual void flatten(SkFlattenableWriteBuffer&) SK_OVERRIDE; SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTable_ColorFilter) protected: SkTable_ColorFilter(SkFlattenableReadBuffer& buffer); + virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; private: SkBitmap* fBitmap; @@ -145,7 +145,7 @@ static const uint8_t gCountNibBits[] = { #include "SkPackBits.h" -void SkTable_ColorFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkTable_ColorFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); uint8_t storage[5*256]; diff --git a/src/effects/SkTableMaskFilter.cpp b/src/effects/SkTableMaskFilter.cpp index 3a3d0e596a..fed0c5da72 100644 --- a/src/effects/SkTableMaskFilter.cpp +++ b/src/effects/SkTableMaskFilter.cpp @@ -71,7 +71,7 @@ SkMask::Format SkTableMaskFilter::getFormat() { return SkMask::kA8_Format; } -void SkTableMaskFilter::flatten(SkFlattenableWriteBuffer& wb) { +void SkTableMaskFilter::flatten(SkFlattenableWriteBuffer& wb) const { this->INHERITED::flatten(wb); wb.writePad(fTable, 256); } diff --git a/src/effects/SkTestImageFilters.cpp b/src/effects/SkTestImageFilters.cpp index 688e298cc1..0dd360b476 100755 --- a/src/effects/SkTestImageFilters.cpp +++ b/src/effects/SkTestImageFilters.cpp @@ -32,7 +32,7 @@ bool SkOffsetImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm return true; } -void SkOffsetImageFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkOffsetImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeScalar(fOffset.x()); buffer.writeScalar(fOffset.y()); @@ -84,7 +84,7 @@ bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, fOuter->filterBounds(tmp, ctm, dst); } -void SkComposeImageFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkComposeImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeFlattenable(fOuter); @@ -238,7 +238,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, return true; } -void SkMergeImageFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkMergeImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); int storedCount = fCount; @@ -307,7 +307,7 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, return true; } -void SkColorFilterImageFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkColorFilterImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeFlattenable(fColorFilter); @@ -369,7 +369,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, return true; } -void SkDownSampleImageFilter::flatten(SkFlattenableWriteBuffer& buffer) { +void SkDownSampleImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { this->INHERITED::flatten(buffer); buffer.writeScalar(fScale); diff --git a/src/effects/SkTransparentShader.cpp b/src/effects/SkTransparentShader.cpp index c827c111c0..28b075f4e2 100644 --- a/src/effects/SkTransparentShader.cpp +++ b/src/effects/SkTransparentShader.cpp @@ -125,8 +125,3 @@ void SkTransparentShader::shadeSpan16(int x, int y, uint16_t span[], int count) memcpy(span, src, count << 1); } } - -void SkTransparentShader::flatten(SkFlattenableWriteBuffer& buffer) { - this->INHERITED::flatten(buffer); -} - |