Index: src/gpu/SkGpuDevice.cpp |
=================================================================== |
--- src/gpu/SkGpuDevice.cpp (revision 10315) |
+++ src/gpu/SkGpuDevice.cpp (working copy) |
@@ -1078,21 +1078,10 @@ |
void SkGpuDevice::drawBitmap(const SkDraw& draw, |
const SkBitmap& bitmap, |
- const SkIRect* srcRectPtr, |
const SkMatrix& m, |
const SkPaint& paint) { |
- |
- SkRect tmp; |
- SkRect* tmpPtr = NULL; |
- |
- // convert from SkIRect to SkRect |
- if (NULL != srcRectPtr) { |
- tmp.set(*srcRectPtr); |
- tmpPtr = &tmp; |
- } |
- |
// We cannot call drawBitmapRect here since 'm' could be anything |
- this->drawBitmapCommon(draw, bitmap, tmpPtr, m, paint); |
+ this->drawBitmapCommon(draw, bitmap, NULL, m, paint); |
} |
void SkGpuDevice::drawBitmapCommon(const SkDraw& draw, |
@@ -1216,9 +1205,8 @@ |
} |
} |
-namespace { |
- |
-bool hasAlignedSamples(const SkRect& srcRect, const SkRect& transformedRect) { |
+static bool has_aligned_samples(const SkRect& srcRect, |
+ const SkRect& transformedRect) { |
// detect pixel disalignment |
if (SkScalarAbs(SkScalarRoundToScalar(transformedRect.left()) - |
transformedRect.left()) < COLOR_BLEED_TOLERANCE && |
@@ -1233,11 +1221,12 @@ |
return false; |
} |
-bool mayColorBleed(const SkRect& srcRect, const SkRect& transformedRect, |
- const SkMatrix& m) { |
- // Only gets called if hasAlignedSamples returned false. |
+static bool may_color_bleed(const SkRect& srcRect, |
+ const SkRect& transformedRect, |
+ const SkMatrix& m) { |
+ // Only gets called if has_aligned_samples returned false. |
// So we can assume that sampling is axis aligned but not texel aligned. |
- GrAssert(!hasAlignedSamples(srcRect, transformedRect)); |
+ GrAssert(!has_aligned_samples(srcRect, transformedRect)); |
SkRect innerSrcRect(srcRect), innerTransformedRect, |
outerTransformedRect(transformedRect); |
innerSrcRect.inset(SK_ScalarHalf, SK_ScalarHalf); |
@@ -1257,7 +1246,6 @@ |
return inner != outer; |
} |
-} // unnamed namespace |
/* |
* This is called by drawBitmap(), which has to handle images that may be too |
@@ -1294,20 +1282,19 @@ |
// Need texture domain if drawing a sub rect. |
needsTextureDomain = srcRect.width() < bitmap.width() || |
srcRect.height() < bitmap.height(); |
- if (m.rectStaysRect() && fContext->getMatrix().rectStaysRect()) { |
+ if (needsTextureDomain && m.rectStaysRect() && fContext->getMatrix().rectStaysRect()) { |
// sampling is axis-aligned |
SkRect transformedRect; |
SkMatrix srcToDeviceMatrix(m); |
srcToDeviceMatrix.postConcat(fContext->getMatrix()); |
srcToDeviceMatrix.mapRect(&transformedRect, srcRect); |
- if (hasAlignedSamples(srcRect, transformedRect)) { |
+ 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 = needsTextureDomain && |
- mayColorBleed(srcRect, transformedRect, m); |
+ needsTextureDomain = may_color_bleed(srcRect, transformedRect, m); |
} |
} |
} |