diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-15 14:25:50 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-15 14:25:50 +0000 |
commit | 858804dfe62c957050080a6fdce9226387ae7b7d (patch) | |
tree | 00b7be7d7eb781e7d266f97f71a21b2238526c9f /src | |
parent | 1e269b5a08610da13c3aee23809bb45b17e7b663 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrTextContext.cpp | 34 |
1 files changed, 1 insertions, 33 deletions
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() { |