From f48f2817668547563310c9e8c39d67224df0e89f Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Mon, 18 May 2009 04:20:55 +0000 Subject: shapes checkpoint: move matrix into groupshape and out of shape git-svn-id: http://skia.googlecode.com/svn/trunk@178 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkShape.cpp | 59 +--------------------------------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) (limited to 'src/core') diff --git a/src/core/SkShape.cpp b/src/core/SkShape.cpp index a6d19af96b..e5fa8ff487 100644 --- a/src/core/SkShape.cpp +++ b/src/core/SkShape.cpp @@ -2,46 +2,8 @@ #include "SkShape.h" #include "SkMatrix.h" -SkShape::~SkShape() { - if (fMatrix) { - SkDELETE(fMatrix); - } -} - -void SkShape::getMatrix(SkMatrix* matrix) const { - if (matrix) { - if (fMatrix) { - *matrix = *fMatrix; - } else { - matrix->reset(); - } - } -} - -void SkShape::setMatrix(const SkMatrix& matrix) { - if (matrix.isIdentity()) { - this->resetMatrix(); - } else { - if (NULL == fMatrix) { - fMatrix = SkNEW(SkMatrix); - } - *fMatrix = matrix; - } -} - -void SkShape::resetMatrix() { - if (fMatrix) { - SkDELETE(fMatrix); - fMatrix = NULL; - } -} - void SkShape::draw(SkCanvas* canvas) { int saveCount = canvas->getSaveCount(); - if (fMatrix) { - canvas->save(SkCanvas::kMatrix_SaveFlag); - canvas->concat(*fMatrix); - } this->onDraw(canvas); canvas->restoreToCount(saveCount); } @@ -49,9 +11,6 @@ void SkShape::draw(SkCanvas* canvas) { void SkShape::drawXY(SkCanvas* canvas, SkScalar dx, SkScalar dy) { int saveCount = canvas->save(SkCanvas::kMatrix_SaveFlag); canvas->translate(dx, dy); - if (fMatrix) { - canvas->concat(*fMatrix); - } this->onDraw(canvas); canvas->restoreToCount(saveCount); } @@ -59,27 +18,11 @@ void SkShape::drawXY(SkCanvas* canvas, SkScalar dx, SkScalar dy) { void SkShape::drawMatrix(SkCanvas* canvas, const SkMatrix& matrix) { int saveCount = canvas->save(SkCanvas::kMatrix_SaveFlag); canvas->concat(matrix); - if (fMatrix) { - canvas->concat(*fMatrix); - } this->onDraw(canvas); canvas->restoreToCount(saveCount); } /////////////////////////////////////////////////////////////////////////////// -void SkShape::flatten(SkFlattenableWriteBuffer& buffer) { - buffer.writeBool(fMatrix != NULL); - if (fMatrix) { - *(SkMatrix*)buffer.reserve(sizeof(SkMatrix)) = *fMatrix; - } -} - -SkShape::SkShape(SkFlattenableReadBuffer& buffer) { - fMatrix = NULL; - if (buffer.readBool()) { - fMatrix = SkNEW(SkMatrix); - buffer.read(fMatrix, sizeof(*fMatrix)); - } -} +void SkShape::flatten(SkFlattenableWriteBuffer& buffer) {} -- cgit v1.2.3