aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/images
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-21 20:13:42 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-10-21 20:13:42 +0000
commit114038a2e29a6d20b780a05281a16242892c94e8 (patch)
treeadc0bd072d54a9ddc39e2d7c1639846e5400b318 /src/images
parente986b221ee4c6678180367a6c34ca781ed8b3152 (diff)
Revert "Revert "cache SkImage::Info calculation in lazypixelref""
This reverts commit 81eba32ab10f9210c742938819cf1218be5611c9. ImageDecoder is changed to allow info to be NULL, since it is an output-only parameter. R=scroggo@google.com Review URL: https://codereview.chromium.org/33573002 git-svn-id: http://skia.googlecode.com/svn/trunk@11896 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/images')
-rw-r--r--src/images/SkImageDecoder.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/images/SkImageDecoder.cpp b/src/images/SkImageDecoder.cpp
index 3ee41124c0..89bd0597c8 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;
}