diff options
Diffstat (limited to 'src/effects/SkAlphaThresholdFilter.cpp')
-rw-r--r-- | src/effects/SkAlphaThresholdFilter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index 32de52250a..e7a4c4ffd4 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); |