aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-08 20:44:25 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-08 20:44:25 +0000
commit0e354aacd84d3bede3f97cbde35a54ba62a89533 (patch)
tree8ca5215852c9b98026695bef8eeeed5b039eb466 /src
parenta834746cc1bd92301fd0840a221ca1623c0bbb29 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/core/SkCanvas.cpp44
-rw-r--r--src/core/SkDraw.cpp17
-rw-r--r--src/device/xps/SkXPSDevice.cpp2
-rw-r--r--src/gpu/GrTextContext.cpp21
-rw-r--r--src/gpu/SkGpuDevice.cpp4
5 files changed, 6 insertions, 82 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 1cd29f3d6a..5e476c6c9e 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -77,9 +77,6 @@ struct DeviceCM {
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 @@ struct DeviceCM {
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 @@ public:
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 @@ SkDevice* SkCanvas::init(SkDevice* device) {
fMCRec->fTopLayer = fMCRec->fLayer;
fMCRec->fNext = NULL;
- fExternalMatrix.reset();
- fExternalInverse.reset();
- fUseExternalMatrix = false;
-
fSurfaceBase = NULL;
return this->setDevice(device);
@@ -673,18 +654,10 @@ void SkCanvas::updateDeviceCMCache() {
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 @@ const SkRegion& SkCanvas::getTotalClip() const {
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 e8d171e543..31f36d4b6f 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1547,13 +1547,6 @@ void SkDraw::drawText(const char text[], size_t byteLength,
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 @@ void SkDraw::drawPosText(const char text[], size_t byteLength,
}
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 @@ void SkDraw::validate() const {
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 8f2c6ddaa0..9c5958394c 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -2249,8 +2249,6 @@ static void text_draw_init(const SkPaint& paint,
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 e97bc8f3a2..042e0307d9 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -34,7 +34,7 @@ void GrTextContext::flushGlyphs() {
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 @@ void GrTextContext::flushGlyphs() {
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 @@ GrTextContext::GrTextContext(GrContext* context,
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 88416769de..9a495c9703 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1857,7 +1857,7 @@ void SkGpuDevice::drawText(const SkDraw& draw, const void* text,
&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 @@ void SkGpuDevice::drawPosText(const SkDraw& draw, const void* text,
&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);