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

Unified Diff: src/images/SkImageDecoder.cpp

Issue 33573002: Revert "Revert "cache SkImage::Info calculation in lazypixelref"" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | src/lazy/SkLazyPixelRef.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/SkImageDecoder.cpp
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 3ee41124c01ef68186cd2c7d2ffdaa9395ce6aef..89bd0597c84df91439dcb4f2270b67ce30e93ae3 100644
--- a/src/images/SkImageDecoder.cpp
+++ b/src/images/SkImageDecoder.cpp
@@ -405,10 +405,6 @@ static bool decode_pixels_to_8888(SkImageDecoder* decoder, SkStream* stream,
bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size,
SkImage::Info* info,
const SkBitmapFactory::Target* target) {
- if (NULL == info) {
- return false;
- }
-
// FIXME: Just to get this working, implement in terms of existing
// ImageDecoder calls.
SkBitmap bm;
@@ -427,14 +423,17 @@ bool SkImageDecoder::DecodeMemoryToTarget(const void* buffer, size_t size,
// Now set info properly.
// Since Config is SkBitmap::kARGB_8888_Config, SkBitmapToImageInfo
// will always succeed.
- SkAssertResult(SkBitmapToImageInfo(bm, info));
+ if (info) {
+ SkAssertResult(SkBitmapToImageInfo(bm, info));
+ }
if (NULL == target) {
return true;
}
if (target->fRowBytes != SkToU32(bm.rowBytes())) {
- if (target->fRowBytes < SkImageMinRowBytes(*info)) {
+ size_t minRB = SkBitmap::ComputeRowBytes(bm.config(), bm.width());
+ if (target->fRowBytes < minRB) {
SkDEBUGFAIL("Desired row bytes is too small");
return false;
}
« no previous file with comments | « no previous file | src/lazy/SkLazyPixelRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698