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

Unified Diff: src/images/SkImageDecoder_libpng.cpp

Issue 17620004: Remove bitmap reuse from SkImageDecoder. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add documentation. Created 7 years, 6 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 | « src/images/SkImageDecoder_libjpeg.cpp ('k') | src/images/SkImageDecoder_libwebp.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder_libpng.cpp
diff --git a/src/images/SkImageDecoder_libpng.cpp b/src/images/SkImageDecoder_libpng.cpp
index 729f87169a435cceb2ffa3ebd0be4ebd6f485314..d59a67bf8ef8090e4268de40a788c04086e7d087 100644
--- a/src/images/SkImageDecoder_libpng.cpp
+++ b/src/images/SkImageDecoder_libpng.cpp
@@ -299,21 +299,8 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
const int sampleSize = this->getSampleSize();
SkScaledBitmapSampler sampler(origWidth, origHeight, sampleSize);
+ decodedBitmap->setConfig(config, sampler.scaledWidth(), sampler.scaledHeight());
- decodedBitmap->lockPixels();
- void* rowptr = (void*) decodedBitmap->getPixels();
- bool reuseBitmap = (rowptr != NULL);
- decodedBitmap->unlockPixels();
- if (reuseBitmap && (sampler.scaledWidth() != decodedBitmap->width() ||
- sampler.scaledHeight() != decodedBitmap->height())) {
- // Dimensions must match
- return false;
- }
-
- if (!reuseBitmap) {
- decodedBitmap->setConfig(config, sampler.scaledWidth(),
- sampler.scaledHeight());
- }
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return true;
}
@@ -332,11 +319,9 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
SkAutoUnref aur(colorTable);
- if (!reuseBitmap) {
- if (!this->allocPixelRef(decodedBitmap,
- SkBitmap::kIndex8_Config == config ? colorTable : NULL)) {
- return false;
- }
+ if (!this->allocPixelRef(decodedBitmap,
+ SkBitmap::kIndex8_Config == config ? colorTable : NULL)) {
+ return false;
}
SkAutoLockPixels alp(*decodedBitmap);
@@ -445,9 +430,6 @@ bool SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
return false;
}
decodedBitmap->setIsOpaque(!reallyHasAlpha);
- if (reuseBitmap) {
- decodedBitmap->notifyPixelsChanged();
- }
return true;
}
« no previous file with comments | « src/images/SkImageDecoder_libjpeg.cpp ('k') | src/images/SkImageDecoder_libwebp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698