Index: src/effects/SkAlphaThresholdFilter.cpp |
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp |
index 32de52250a36f081e7ecc7232a8bfe92cab97ec1..e7a4c4ffd46b7c22c0c7999ef835714ceb80854d 100644 |
--- a/src/effects/SkAlphaThresholdFilter.cpp |
+++ b/src/effects/SkAlphaThresholdFilter.cpp |
@@ -7,6 +7,7 @@ |
#include "SkAlphaThresholdFilter.h" |
#include "SkBitmap.h" |
+#include "SkDevice.h" |
#include "SkReadBuffer.h" |
#include "SkWriteBuffer.h" |
#include "SkRegion.h" |
@@ -303,7 +304,7 @@ void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const { |
buffer.writeRegion(fRegion); |
} |
-bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src, |
+bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy* proxy, const SkBitmap& src, |
const Context& ctx, SkBitmap* dst, |
SkIPoint* offset) const { |
SkASSERT(src.colorType() == kN32_SkColorType); |
@@ -323,9 +324,12 @@ bool SkAlphaThresholdFilterImpl::onFilterImage(Proxy*, const SkBitmap& src, |
return false; |
} |
- if (!dst->tryAllocPixels(src.info())) { |
+ SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(src.width(), src.height())); |
+ if (!device) { |
return false; |
} |
+ *dst = device->accessBitmap(false); |
+ SkAutoLockPixels alp_dst(*dst); |
U8CPU innerThreshold = (U8CPU)(fInnerThreshold * 0xFF); |
U8CPU outerThreshold = (U8CPU)(fOuterThreshold * 0xFF); |