From 858804dfe62c957050080a6fdce9226387ae7b7d Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Mon, 15 Oct 2012 14:25:50 +0000 Subject: 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 --- src/gpu/GrTextContext.cpp | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) (limited to 'src') diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp index 684672152b..c9944b9942 100644 --- a/src/gpu/GrTextContext.cpp +++ b/src/gpu/GrTextContext.cpp @@ -89,38 +89,7 @@ GrTextContext::GrTextContext(GrContext* context, const GrPaint& paint) : fPaint( 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 @@ GrTextContext::~GrTextContext() { if (fDrawTarget) { fDrawTarget->drawState()->disableStages(); } - fContext->setMatrix(fOrigViewMatrix); } void GrTextContext::flush() { -- cgit v1.2.3