aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-02-09 13:06:29 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-02-09 13:06:29 +0000
commit218521e15706c4377b1be49d931c4d7c8d597445 (patch)
tree5d3a5ee33e19714e9a47aea42cbc3effd128de3f
parent985dfad8ec197c2a86942435d804dd2a776cdc1a (diff)
check bounder before lockPixels on the bitmap
git-svn-id: http://skia.googlecode.com/svn/trunk@493 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/core/SkDraw.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 78c282e13d..8bf4c084f6 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1042,12 +1042,21 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
return;
}
- // do I need to call the bounder first???
if (clipped_out(matrix, *fClip, bitmap.width(), bitmap.height())) {
return;
}
- // only lock the pixels if we passed the clip test
+ if (fBounder && just_translate(matrix, bitmap)) {
+ SkIRect ir;
+ int32_t ix = SkScalarRound(matrix.getTranslateX());
+ int32_t iy = SkScalarRound(matrix.getTranslateY());
+ ir.set(ix, iy, ix + bitmap.width(), iy + bitmap.height());
+ if (!fBounder->doIRect(ir)) {
+ return;
+ }
+ }
+
+ // only lock the pixels if we passed the clip and bounder tests
SkAutoLockPixels alp(bitmap);
// after the lock, check if we are valid
if (!bitmap.readyToDraw()) {
@@ -1066,10 +1075,6 @@ void SkDraw::drawBitmap(const SkBitmap& bitmap, const SkMatrix& prematrix,
SkIRect ir;
ir.set(ix, iy, ix + bitmap.width(), iy + bitmap.height());
-
- if (fBounder && !fBounder->doIRect(ir)) {
- return;
- }
SkRegion::Cliperator iter(*fClip, ir);
const SkIRect& cr = iter.rect();