From 641f8b19a6799b6d73ac17b9c2d2f8a5e6f5ad4d Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Tue, 31 Jul 2012 19:15:58 +0000 Subject: Replace GrClip with SkClipStack http://codereview.appspot.com/6449070/ git-svn-id: http://skia.googlecode.com/svn/trunk@4865 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/GrTextContext.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src/gpu/GrTextContext.cpp') diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp index 576a5bdeae..23b16dd3ae 100644 --- a/src/gpu/GrTextContext.cpp +++ b/src/gpu/GrTextContext.cpp @@ -70,20 +70,6 @@ void GrTextContext::flushGlyphs() { fDrawTarget = NULL; } -namespace { - -// 'rect' enters in canvas coordinates and leaves in device coordinates -void canvas_to_device(SkRect* rect, const SkIPoint& origin) { - GrAssert(NULL != rect); - - rect->fLeft -= SkIntToScalar(origin.fX); - rect->fTop -= SkIntToScalar(origin.fY); - rect->fRight -= SkIntToScalar(origin.fX); - rect->fBottom -= SkIntToScalar(origin.fY); -} - -}; - GrTextContext::GrTextContext(GrContext* context, const GrPaint& paint, const GrMatrix* extMatrix) : fPaint(paint) { @@ -101,17 +87,22 @@ GrTextContext::GrTextContext(GrContext* context, const GrClipData* clipData = context->getClip(); - GrRect conservativeBound = clipData->fClipStack->getConservativeBounds(); - canvas_to_device(&conservativeBound, clipData->fOrigin); + GrRect devConservativeBound; + clipData->fClipStack->getConservativeBounds( + -clipData->fOrigin.fX, + -clipData->fOrigin.fY, + context->getRenderTarget()->width(), + context->getRenderTarget()->height(), + &devConservativeBound); if (!fExtMatrix.isIdentity()) { GrMatrix inverse; if (fExtMatrix.invert(&inverse)) { - inverse.mapRect(&conservativeBound); + inverse.mapRect(&devConservativeBound); } } - conservativeBound.roundOut(&fClipRect); + devConservativeBound.roundOut(&fClipRect); // save the context's original matrix off and restore in destructor // this must be done before getTextTarget. -- cgit v1.2.3