aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-05-18 04:20:55 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-05-18 04:20:55 +0000
commitf48f2817668547563310c9e8c39d67224df0e89f (patch)
treecfa590ce65ea30e387d3f8df25a2036a5ff7fdc5 /src/core
parent3b895157070ce2c37235f59c43c480da45a48dea (diff)
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkShape.cpp59
1 files changed, 1 insertions, 58 deletions
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) {}