diff options
author | 2011-03-04 22:27:10 +0000 | |
---|---|---|
committer | 2011-03-04 22:27:10 +0000 | |
commit | 6f8f292aa768869a9e85c314b124875f57504f2c (patch) | |
tree | f6131fb47de094839c6a3defecabf8c0fec6e26d /src/gpu | |
parent | f966fd35cf37562df7aaaf08a490582b764ba170 (diff) |
add origin to device
used for interpreting the clipstack when a device is a layer
git-svn-id: http://skia.googlecode.com/svn/trunk@894 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 990c24ba69..86082c5e50 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -267,29 +267,24 @@ void SkGpuDevice::writePixels(const SkBitmap& bitmap, int x, int y) { /////////////////////////////////////////////////////////////////////////////// -#define USE_CLIP_STACK 0 - static void convert_matrixclip(GrContext* context, const SkMatrix& matrix, const SkClipStack& clipStack, - const SkRegion& clipRegion) { + const SkRegion& clipRegion, + const SkIPoint& origin) { GrMatrix grmat; SkGr::SkMatrix2GrMatrix(matrix, &grmat); context->setMatrix(grmat); -#if USE_CLIP_STACK SkGrClipIterator iter; iter.reset(clipStack); -#else - SkGrRegionIterator iter; - iter.reset(clipRegion); -#endif const SkIRect& skBounds = clipRegion.getBounds(); GrRect bounds; bounds.setLTRB(GrIntToScalar(skBounds.fLeft), GrIntToScalar(skBounds.fTop), GrIntToScalar(skBounds.fRight), GrIntToScalar(skBounds.fBottom)); - GrClip grc(&iter, &bounds); + GrClip grc(&iter, GrIntToScalar(-origin.x()), GrIntToScalar(-origin.y()), + &bounds); context->setClip(grc); } @@ -302,7 +297,7 @@ void SkGpuDevice::prepareRenderTarget(const SkDraw& draw) { fContext->setRenderTarget(fRenderTarget); SkASSERT(draw.fClipStack); convert_matrixclip(fContext, *draw.fMatrix, - *draw.fClipStack, *draw.fClip); + *draw.fClipStack, *draw.fClip, this->getOrigin()); fNeedPrepareRenderTarget = false; } } @@ -311,7 +306,7 @@ void SkGpuDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& clip, const SkClipStack& clipStack) { this->INHERITED::setMatrixClip(matrix, clip, clipStack); - convert_matrixclip(fContext, matrix, clipStack, clip); + convert_matrixclip(fContext, matrix, clipStack, clip, this->getOrigin()); } void SkGpuDevice::gainFocus(SkCanvas* canvas, const SkMatrix& matrix, @@ -321,7 +316,7 @@ void SkGpuDevice::gainFocus(SkCanvas* canvas, const SkMatrix& matrix, this->INHERITED::gainFocus(canvas, matrix, clip, clipStack); - convert_matrixclip(fContext, matrix, clipStack, clip); + convert_matrixclip(fContext, matrix, clipStack, clip, this->getOrigin()); if (fNeedClear) { fContext->eraseColor(0x0); |