Use AutoMatrix in GrTextContext
Review URL: https://codereview.appspot.com/6691043
git-svn-id: http://skia.googlecode.com/svn/trunk@5952 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 6846721..c9944b9 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -89,38 +89,7 @@
devConservativeBound.roundOut(&fClipRect);
- // save the context's original matrix off and restore in destructor
- // this must be done before getTextTarget.
- fOrigViewMatrix = fContext->getMatrix();
- fContext->setIdentityMatrix();
-
- /*
- We need to call preConcatMatrix with our viewmatrix's inverse, for each
- texture and mask in the paint. However, computing the inverse can be
- expensive, and its possible we may not have any textures or masks, so these
- two loops are written such that we only compute the inverse (once) if we
- need it. We do this on our copy of the paint rather than directly on the
- draw target because we re-provide the paint to the context when we have
- to flush our glyphs or draw a glyph as a path midstream.
- */
- bool invVMComputed = false;
- GrMatrix invVM;
- for (int t = 0; t < GrPaint::kMaxColorStages; ++t) {
- if (fPaint.isColorStageEnabled(t)) {
- if (invVMComputed || fOrigViewMatrix.invert(&invVM)) {
- invVMComputed = true;
- fPaint.colorSampler(t)->preConcatMatrix(invVM);
- }
- }
- }
- for (int m = 0; m < GrPaint::kMaxCoverageStages; ++m) {
- if (fPaint.isCoverageStageEnabled(m)) {
- if (invVMComputed || fOrigViewMatrix.invert(&invVM)) {
- invVMComputed = true;
- fPaint.coverageSampler(m)->preConcatMatrix(invVM);
- }
- }
- }
+ fAutoMatrix.setIdentity(fContext, &fPaint);
fDrawTarget = NULL;
@@ -137,7 +106,6 @@
if (fDrawTarget) {
fDrawTarget->drawState()->disableStages();
}
- fContext->setMatrix(fOrigViewMatrix);
}
void GrTextContext::flush() {