aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2014-08-07 11:13:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-07 11:13:45 -0700
commitb99c4a7bf2ff8d34b6adc053071a8bafdc868c73 (patch)
tree690bd72de3102732a4e3228e5e56e0addfe29021 /src/pdf
parent45a0bf505914adf0ee8c69e2647230618bbb3a63 (diff)
Assert allocation so we can catch it sooner.
R=bungeman@google.com, mtklein@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/445363007
Diffstat (limited to 'src/pdf')
-rw-r--r--src/pdf/SkPDFImage.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index 7e17f98a15..715fb4859d 100644
--- a/src/pdf/SkPDFImage.cpp
+++ b/src/pdf/SkPDFImage.cpp
@@ -374,11 +374,12 @@ static uint16_t get_argb4444_neighbor_avg_color(const SkBitmap& bitmap,
static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap,
const SkIRect& srcRect) {
SkBitmap outBitmap;
- outBitmap.allocPixels(bitmap.info().makeWH(srcRect.width(), srcRect.height()));
+ SkAssertResult(outBitmap.allocPixels(
+ bitmap.info().makeWH(srcRect.width(), srcRect.height())));
int dstRow = 0;
- outBitmap.lockPixels();
- bitmap.lockPixels();
+ SkAutoLockPixels outBitmapPixelLock(outBitmap);
+ SkAutoLockPixels bitmapPixelLock(bitmap);
switch (bitmap.colorType()) {
case kARGB_4444_SkColorType: {
for (int y = srcRect.fTop; y < srcRect.fBottom; y++) {
@@ -428,8 +429,6 @@ static SkBitmap unpremultiply_bitmap(const SkBitmap& bitmap,
default:
SkASSERT(false);
}
- bitmap.unlockPixels();
- outBitmap.unlockPixels();
outBitmap.setImmutable();