Index: src/gpu/SkGpuDevice.cpp |
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
index 3c91101b346376b50e190079e5a19c1ac1057f51..0a6621a77d94174d8cd5f6350fa7987407f44c7b 100644 |
--- a/src/gpu/SkGpuDevice.cpp |
+++ b/src/gpu/SkGpuDevice.cpp |
@@ -1167,6 +1167,8 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw, |
return; |
} |
+ |
robertphillips
2013/10/20 21:21:39
How does this get undone?
bsalomon
2013/10/21 13:19:10
It doesn't :) But SkGpuDevice sets the canvas matr
|
+ fContext->concatMatrix(m); |
GrTextureParams params; |
SkPaint::FilterLevel paintFilterLevel = paint.getFilterLevel(); |
@@ -1199,9 +1201,9 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw, |
if (!this->shouldTileBitmap(bitmap, params, srcRectPtr)) { |
// take the simple case |
- this->internalDrawBitmap(bitmap, srcRect, m, params, paint, flags); |
+ this->internalDrawBitmap(bitmap, srcRect, params, paint, flags); |
} else { |
- this->drawTiledBitmap(bitmap, srcRect, m, params, paint, flags); |
+ this->drawTiledBitmap(bitmap, srcRect, params, paint, flags); |
} |
} |
@@ -1209,7 +1211,6 @@ void SkGpuDevice::drawBitmapCommon(const SkDraw& draw, |
// been determined to be too large to fit in VRAM |
void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, |
const SkRect& srcRect, |
- const SkMatrix& m, |
const GrTextureParams& params, |
const SkPaint& paint, |
SkCanvas::DrawBitmapRectFlags flags) { |
@@ -1230,9 +1231,8 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, |
if (!fContext->getClip()->fClipStack->intersectRectWithClip(&clipRect)) { |
return; |
} |
- SkMatrix matrix, inverse; |
- matrix.setConcat(fContext->getMatrix(), m); |
- if (!matrix.invert(&inverse)) { |
+ SkMatrix inverse; |
+ if (!fContext->getMatrix().invert(&inverse)) { |
return; |
} |
inverse.mapRect(&clipRect); |
@@ -1282,10 +1282,11 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap, |
if (bitmap.extractSubset(&tmpB, iTileR)) { |
// now offset it to make it "local" to our tmp bitmap |
tileR.offset(-offset.fX, -offset.fY); |
- SkMatrix tmpM(m); |
- tmpM.preTranslate(offset.fX, offset.fY); |
- |
- this->internalDrawBitmap(tmpB, tileR, tmpM, params, paint, flags); |
+ SkMatrix tmpM; |
+ tmpM.setTranslate(offset.fX, offset.fY); |
+ GrContext::AutoMatrix am; |
+ am.setPreConcat(fContext, tmpM); |
+ this->internalDrawBitmap(tmpB, tileR, params, paint, flags); |
} |
} |
} |
@@ -1342,7 +1343,6 @@ static bool may_color_bleed(const SkRect& srcRect, |
*/ |
void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, |
const SkRect& srcRect, |
- const SkMatrix& m, |
const GrTextureParams& params, |
const SkPaint& paint, |
SkCanvas::DrawBitmapRectFlags flags) { |
@@ -1370,19 +1370,18 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, |
// Need texture domain if drawing a sub rect. |
needsTextureDomain = srcRect.width() < bitmap.width() || |
srcRect.height() < bitmap.height(); |
- if (needsTextureDomain && m.rectStaysRect() && fContext->getMatrix().rectStaysRect()) { |
+ if (needsTextureDomain && fContext->getMatrix().rectStaysRect()) { |
+ const SkMatrix& matrix = fContext->getMatrix(); |
// sampling is axis-aligned |
SkRect transformedRect; |
- SkMatrix srcToDeviceMatrix(m); |
- srcToDeviceMatrix.postConcat(fContext->getMatrix()); |
- srcToDeviceMatrix.mapRect(&transformedRect, srcRect); |
- |
+ matrix.mapRect(&transformedRect, srcRect); |
+ |
if (has_aligned_samples(srcRect, transformedRect)) { |
// We could also turn off filtering here (but we already did a cache lookup with |
// params). |
needsTextureDomain = false; |
} else { |
- needsTextureDomain = may_color_bleed(srcRect, transformedRect, m); |
+ needsTextureDomain = may_color_bleed(srcRect, transformedRect, matrix); |
bsalomon
2013/10/20 14:14:18
I think this was supposed take the full matrix and
robertphillips
2013/10/20 21:21:39
I agree
|
} |
} |
} |
@@ -1425,7 +1424,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap, |
return; |
} |
- fContext->drawRectToRect(grPaint, dstRect, paintRect, &m); |
+ fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); |
} |
static bool filter_texture(SkBaseDevice* device, GrContext* context, |