Remove external matrix feature.
We haven't been testing this for nearly two years.
R=reed@google.com
Review URL: https://codereview.appspot.com/6640044
git-svn-id: http://skia.googlecode.com/svn/trunk@5857 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 45db96f..0868574 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -893,8 +893,6 @@
return &fClipStack;
}
- void setExternalMatrix(const SkMatrix* = NULL);
-
class ClipVisitor {
public:
virtual ~ClipVisitor();
@@ -1042,9 +1040,6 @@
}
void computeLocalClipBoundsCompareType() const;
- SkMatrix fExternalMatrix, fExternalInverse;
- bool fUseExternalMatrix;
-
class AutoValidateClip : ::SkNoncopyable {
public:
explicit AutoValidateClip(SkCanvas* canvas) : fCanvas(canvas) {
diff --git a/include/core/SkDraw.h b/include/core/SkDraw.h
index b31f4f5..5db4bf0 100644
--- a/include/core/SkDraw.h
+++ b/include/core/SkDraw.h
@@ -115,9 +115,6 @@
SkBounder* fBounder; // optional
SkDrawProcs* fProcs; // optional
- const SkMatrix* fMVMatrix; // optional
- const SkMatrix* fExtMatrix; // optional
-
#ifdef SK_DEBUG
void validate() const;
#else
diff --git a/include/gpu/GrTextContext.h b/include/gpu/GrTextContext.h
index 29ef007..83d420b 100644
--- a/include/gpu/GrTextContext.h
+++ b/include/gpu/GrTextContext.h
@@ -23,9 +23,7 @@
class GrTextContext {
public:
- GrTextContext(GrContext*,
- const GrPaint& paint,
- const GrMatrix* extMatrix = NULL);
+ GrTextContext(GrContext*, const GrPaint&);
~GrTextContext();
void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
@@ -39,7 +37,6 @@
GrContext* fContext;
GrDrawTarget* fDrawTarget;
- GrMatrix fExtMatrix;
GrFontScaler* fScaler;
GrTextStrike* fStrike;
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 6c81041..df77063 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1045,10 +1045,6 @@
gAnimTime = SkTime::GetMSecs();
}
- const SkMatrix& localM = fGesture.localM();
- if (localM.getType() & SkMatrix::kScale_Mask) {
- canvas->setExternalMatrix(&localM);
- }
if (fGesture.isActive()) {
this->updateMatrix();
}
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 1cd29f3..5e476c6 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -77,9 +77,6 @@
SkRasterClip fClip;
const SkMatrix* fMatrix;
SkPaint* fPaint; // may be null (in the future)
- // optional, related to canvas' external matrix
- const SkMatrix* fMVMatrix;
- const SkMatrix* fExtMatrix;
DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
: fNext(NULL) {
@@ -136,20 +133,10 @@
SkASSERT(deviceR.contains(fClip.getBounds()));
}
#endif
- // default is to assume no external matrix
- fMVMatrix = NULL;
- fExtMatrix = NULL;
- }
-
- // can only be called after calling updateMC()
- void updateExternalMatrix(const SkMatrix& extM, const SkMatrix& extI) {
- fMVMatrixStorage.setConcat(extI, *fMatrix);
- fMVMatrix = &fMVMatrixStorage;
- fExtMatrix = &extM; // assumes extM has long life-time (owned by canvas)
}
private:
- SkMatrix fMatrixStorage, fMVMatrixStorage;
+ SkMatrix fMatrixStorage;
};
/* This is the record we keep for each save/restore level in the stack.
@@ -249,8 +236,6 @@
fDevice = rec->fDevice;
fBitmap = &fDevice->accessBitmap(true);
fPaint = rec->fPaint;
- fMVMatrix = rec->fMVMatrix;
- fExtMatrix = rec->fExtMatrix;
SkDEBUGCODE(this->validate();)
fCurrLayer = rec->fNext;
@@ -468,10 +453,6 @@
fMCRec->fTopLayer = fMCRec->fLayer;
fMCRec->fNext = NULL;
- fExternalMatrix.reset();
- fExternalInverse.reset();
- fUseExternalMatrix = false;
-
fSurfaceBase = NULL;
return this->setDevice(device);
@@ -673,18 +654,10 @@
if (NULL == layer->fNext) { // only one layer
layer->updateMC(totalMatrix, totalClip, fClipStack, NULL);
- if (fUseExternalMatrix) {
- layer->updateExternalMatrix(fExternalMatrix,
- fExternalInverse);
- }
} else {
SkRasterClip clip(totalClip);
do {
layer->updateMC(totalMatrix, clip, fClipStack, &clip);
- if (fUseExternalMatrix) {
- layer->updateExternalMatrix(fExternalMatrix,
- fExternalInverse);
- }
} while ((layer = layer->fNext) != NULL);
}
fDeviceCMDirty = false;
@@ -1395,21 +1368,6 @@
return fMCRec->fRasterClip->forceGetBW();
}
-void SkCanvas::setExternalMatrix(const SkMatrix* matrix) {
- if (NULL == matrix || matrix->isIdentity()) {
- if (fUseExternalMatrix) {
- fDeviceCMDirty = true;
- }
- fUseExternalMatrix = false;
- } else {
- if (matrix->invert(&fExternalInverse)) {
- fExternalMatrix = *matrix;
- fUseExternalMatrix = true;
- fDeviceCMDirty = true; // |= (fExternalMatrix != *matrix)
- }
- }
-}
-
SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque) {
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index e8d171e..31f36d4 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1547,13 +1547,6 @@
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
const SkMatrix* matrix = fMatrix;
- if (hasCustomD1GProc(*this)) {
- // only support the fMVMatrix (for now) for the GPU case, which also
- // sets the fD1GProc
- if (fMVMatrix) {
- matrix = fMVMatrix;
- }
- }
SkAutoGlyphCache autoCache(paint, matrix);
SkGlyphCache* cache = autoCache.getCache();
@@ -1747,13 +1740,6 @@
}
const SkMatrix* matrix = fMatrix;
- if (hasCustomD1GProc(*this)) {
- // only support the fMVMatrix (for now) for the GPU case, which also
- // sets the fD1GProc
- if (fMVMatrix) {
- matrix = fMVMatrix;
- }
- }
SkDrawCacheProc glyphCacheProc = paint.getDrawCacheProc();
SkAutoGlyphCache autoCache(paint, matrix);
@@ -2459,9 +2445,6 @@
br.set(0, 0, fBitmap->width(), fBitmap->height());
SkASSERT(cr.isEmpty() || br.contains(cr));
-
- // assert that both are null, or both are not-null
- SkASSERT(!fMVMatrix == !fExtMatrix);
}
#endif
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 8f2c6dd..9c59583 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -2249,8 +2249,6 @@
procs.centemPerUnit = 100.0f / SkScalarToFLOAT(paint.getTextSize());
myDraw.fProcs = &procs;
- myDraw.fMVMatrix = &SkMatrix::I();
- myDraw.fExtMatrix = &SkMatrix::I();
}
static bool text_must_be_pathed(const SkPaint& paint, const SkMatrix& matrix) {
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index e97bc8f..042e030 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -34,7 +34,7 @@
GrAssert(GrIsALIGN4(fCurrVertex));
GrAssert(fCurrTexture);
- GrTextureParams params(SkShader::kRepeat_TileMode, !fExtMatrix.isIdentity());
+ GrTextureParams params(SkShader::kRepeat_TileMode, false);
drawState->createTextureEffect(kGlyphMaskStage, fCurrTexture, params);
if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) {
@@ -70,21 +70,13 @@
fDrawTarget = NULL;
}
-GrTextContext::GrTextContext(GrContext* context,
- const GrPaint& paint,
- const GrMatrix* extMatrix) : fPaint(paint) {
+GrTextContext::GrTextContext(GrContext* context, const GrPaint& paint) : fPaint(paint) {
fContext = context;
fStrike = NULL;
fCurrTexture = NULL;
fCurrVertex = 0;
- if (NULL != extMatrix) {
- fExtMatrix = *extMatrix;
- } else {
- fExtMatrix.reset();
- }
-
const GrClipData* clipData = context->getClip();
GrRect devConservativeBound;
@@ -95,19 +87,12 @@
context->getRenderTarget()->height(),
&devConservativeBound);
- if (!fExtMatrix.isIdentity()) {
- GrMatrix inverse;
- if (fExtMatrix.invert(&inverse)) {
- inverse.mapRect(&devConservativeBound);
- }
- }
-
devConservativeBound.roundOut(&fClipRect);
// save the context's original matrix off and restore in destructor
// this must be done before getTextTarget.
fOrigViewMatrix = fContext->getMatrix();
- fContext->setMatrix(fExtMatrix);
+ fContext->setIdentityMatrix();
/*
We need to call preConcatMatrix with our viewmatrix's inverse, for each
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 8841676..9a495c9 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1857,7 +1857,7 @@
&grPaint)) {
return;
}
- GrTextContext context(fContext, grPaint, draw.fExtMatrix);
+ GrTextContext context(fContext, grPaint);
myDraw.fProcs = this->initDrawForText(&context);
this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
}
@@ -1885,7 +1885,7 @@
&grPaint)) {
return;
}
- GrTextContext context(fContext, grPaint, draw.fExtMatrix);
+ GrTextContext context(fContext, grPaint);
myDraw.fProcs = this->initDrawForText(&context);
this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
scalarsPerPos, paint);
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index ca213f2..6570450 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -319,7 +319,6 @@
kTestText.size(), kTestPath, NULL, kTestPaint));
SIMPLE_TEST_STEP(DrawTextOnPathMatrix, drawTextOnPath(kTestText.c_str(),
kTestText.size(), kTestPath, &kTestMatrix, kTestPaint));
-SIMPLE_TEST_STEP(SetExternalMatrix, setExternalMatrix(&kTestMatrix));
SIMPLE_TEST_STEP(DrawData, drawData(kTestText.c_str(), kTestText.size()));
///////////////////////////////////////////////////////////////////////////////