aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuDevice.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-25 12:10:42 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-07-25 12:10:42 +0000
commit9bf380ce7f848dfb5886dd52b82746521454b739 (patch)
treeb54c0fb5c026b791e4114e7d47dd43904674a9fb /src/gpu/SkGpuDevice.cpp
parent5c561cb8d8151d38c69128345106cbf225033a1a (diff)
drawBitmap* cleanup
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r--src/gpu/SkGpuDevice.cpp35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 4456f513c4..000efee84b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1078,21 +1078,10 @@ bool SkGpuDevice::shouldTileBitmap(const SkBitmap& bitmap,
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 @@ void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
}
}
-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 @@ bool hasAlignedSamples(const SkRect& srcRect, const SkRect& transformedRect) {
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 @@ bool mayColorBleed(const SkRect& srcRect, const SkRect& transformedRect,
return inner != outer;
}
-} // unnamed namespace
/*
* This is called by drawBitmap(), which has to handle images that may be too
@@ -1294,20 +1282,19 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
// 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);
}
}
}