diff options
author | 2009-06-29 16:02:20 +0000 | |
---|---|---|
committer | 2009-06-29 16:02:20 +0000 | |
commit | 0ad336f8c6f6f0325eee309c9cd501ea432cc33e (patch) | |
tree | 5ce71598d388b28a6ea3d6f03528dc8bb2df88cf /src/core/SkShape.cpp | |
parent | 0bfffc59a0d4967a18cc3c4f429af3f706c18511 (diff) |
add shape flatten so they work properly in pictures
add flatten/unflatten to matrix
git-svn-id: http://skia.googlecode.com/svn/trunk@242 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkShape.cpp')
-rw-r--r-- | src/core/SkShape.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/core/SkShape.cpp b/src/core/SkShape.cpp index e5fa8ff487..cd405dbf61 100644 --- a/src/core/SkShape.cpp +++ b/src/core/SkShape.cpp @@ -2,6 +2,23 @@ #include "SkShape.h" #include "SkMatrix.h" +#if 0 +static int gShapeCounter; +static void inc_shape(const SkShape* s) { + SkDebugf("inc %d\n", gShapeCounter); + gShapeCounter += 1; +} +static void dec_shape(const SkShape* s) { + --gShapeCounter; + SkDebugf("dec %d\n", gShapeCounter); +} +#else +#define inc_shape(s) +#define dec_shape(s) +#endif + +/////////////////////////////////////////////////////////////////////////////// + void SkShape::draw(SkCanvas* canvas) { int saveCount = canvas->getSaveCount(); this->onDraw(canvas); @@ -24,5 +41,30 @@ void SkShape::drawMatrix(SkCanvas* canvas, const SkMatrix& matrix) { /////////////////////////////////////////////////////////////////////////////// -void SkShape::flatten(SkFlattenableWriteBuffer& buffer) {} +SkShape::SkShape() { + inc_shape(this); +} + +SkShape::~SkShape() { + dec_shape(this); +} + +SkShape::SkShape(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) { + inc_shape(this); +} + +SkFlattenable* SkShape::CreateProc(SkFlattenableReadBuffer& buffer) { + return SkNEW_ARGS(SkShape, (buffer)); +} + +SkFlattenable::Factory SkShape::getFactory() { + return CreateProc; +} + +void SkShape::flatten(SkFlattenableWriteBuffer& buffer) { + this->INHERITED::flatten(buffer); +} + +void SkShape::onDraw(SkCanvas*) {} +static SkFlattenable::Registrar gReg("SkShape", SkShape::CreateProc); |