Index: src/core/SkDeviceLooper.cpp |
diff --git a/src/core/SkDeviceLooper.cpp b/src/core/SkDeviceLooper.cpp |
index 840a0504364e2b76fd1850016291d233b7e4c3fb..a8350cc0272c9f2a278ab3ff50fea96ebeca2f50 100644 |
--- a/src/core/SkDeviceLooper.cpp |
+++ b/src/core/SkDeviceLooper.cpp |
@@ -7,16 +7,17 @@ |
#include "SkDeviceLooper.h" |
-SkDeviceLooper::SkDeviceLooper(const SkPixmap& base, const SkRasterClip& rc, const SkIRect& bounds, |
- bool aa) |
- : fBaseDst(base) |
+SkDeviceLooper::SkDeviceLooper(const SkBitmap& base, |
+ const SkRasterClip& rc, |
+ const SkIRect& bounds, bool aa) |
+ : fBaseBitmap(base) |
, fBaseRC(rc) |
, fSubsetRC(rc.isForceConservativeRects()) |
, fDelta(aa ? kAA_Delta : kBW_Delta) |
{ |
// sentinels that next() has not yet been called, and so our mapper functions |
// should not be called either. |
- fCurrDst = NULL; |
+ fCurrBitmap = NULL; |
fCurrRC = NULL; |
if (!rc.isEmpty()) { |
@@ -37,11 +38,12 @@ |
} |
} |
-SkDeviceLooper::~SkDeviceLooper() {} |
+SkDeviceLooper::~SkDeviceLooper() { |
+} |
void SkDeviceLooper::mapRect(SkRect* dst, const SkRect& src) const { |
SkASSERT(kDone_State != fState); |
- SkASSERT(fCurrDst); |
+ SkASSERT(fCurrBitmap); |
SkASSERT(fCurrRC); |
*dst = src; |
@@ -51,11 +53,12 @@ |
void SkDeviceLooper::mapMatrix(SkMatrix* dst, const SkMatrix& src) const { |
SkASSERT(kDone_State != fState); |
- SkASSERT(fCurrDst); |
+ SkASSERT(fCurrBitmap); |
SkASSERT(fCurrRC); |
*dst = src; |
- dst->postTranslate(SkIntToScalar(-fCurrOffset.fX), SkIntToScalar(-fCurrOffset.fY)); |
+ dst->postTranslate(SkIntToScalar(-fCurrOffset.fX), |
+ SkIntToScalar(-fCurrOffset.fY)); |
} |
bool SkDeviceLooper::computeCurrBitmapAndClip() { |
@@ -63,14 +66,16 @@ |
SkIRect r = SkIRect::MakeXYWH(fCurrOffset.x(), fCurrOffset.y(), |
fDelta, fDelta); |
- if (!fBaseDst.extractSubset(&fSubsetDst, r)) { |
+ if (!fBaseBitmap.extractSubset(&fSubsetBitmap, r)) { |
fSubsetRC.setEmpty(); |
} else { |
+ fSubsetBitmap.lockPixels(); |
fBaseRC.translate(-r.left(), -r.top(), &fSubsetRC); |
- (void)fSubsetRC.op(SkIRect::MakeWH(fDelta, fDelta), SkRegion::kIntersect_Op); |
+ (void)fSubsetRC.op(SkIRect::MakeWH(fDelta, fDelta), |
+ SkRegion::kIntersect_Op); |
} |
- fCurrDst = &fSubsetDst; |
+ fCurrBitmap = &fSubsetBitmap; |
fCurrRC = &fSubsetRC; |
return !fCurrRC->isEmpty(); |
} |
@@ -102,8 +107,8 @@ |
case kSimple_State: |
// first time for simple |
- if (NULL == fCurrDst) { |
- fCurrDst = &fBaseDst; |
+ if (NULL == fCurrBitmap) { |
+ fCurrBitmap = &fBaseBitmap; |
fCurrRC = &fBaseRC; |
fCurrOffset.set(0, 0); |
return true; |