Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: src/pdf/SkPDFImage.cpp

Issue 445363007: Assert allocation so we can catch it sooner. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFImage.cpp
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp
index 7e17f98a1577b968171fecb9a45cba79aa730e16..715fb4859dc9bb256cd6f0196927f131e32ace87 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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698