From 218521e15706c4377b1be49d931c4d7c8d597445 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Tue, 9 Feb 2010 13:06:29 +0000 Subject: [PATCH] check bounder before lockPixels on the bitmap git-svn-id: http://skia.googlecode.com/svn/trunk@493 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkDraw.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 78c282e13..8bf4c084f 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();