summaryrefslogtreecommitdiffstats
path: root/webkit/port/platform
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 00:50:45 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-12 00:50:45 +0000
commitb89e36066f99f22dca4c15724ba0b8331a946234 (patch)
tree20fadb2990cf4b9015ae92825f6e036e272ba39c /webkit/port/platform
parentc5f2c6e775461e078b4011e125457242a4abe582 (diff)
downloadchromium_src-b89e36066f99f22dca4c15724ba0b8331a946234.zip
chromium_src-b89e36066f99f22dca4c15724ba0b8331a946234.tar.gz
chromium_src-b89e36066f99f22dca4c15724ba0b8331a946234.tar.bz2
Some fixes to parallel upstream changes in our last merge.
This doesn't seem to make the crashing on large animated images go away but it does make animation work a bit better. Review URL: http://codereview.chromium.org/10819 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/platform')
-rw-r--r--webkit/port/platform/graphics/ImageSkia.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/webkit/port/platform/graphics/ImageSkia.cpp b/webkit/port/platform/graphics/ImageSkia.cpp
index 5ffd3e3..e84ec8f5 100644
--- a/webkit/port/platform/graphics/ImageSkia.cpp
+++ b/webkit/port/platform/graphics/ImageSkia.cpp
@@ -328,8 +328,9 @@ void FrameData::clear()
{
// The frame data is released in ImageSource::clear.
m_frame = 0;
- m_duration = 0.0f;
- m_hasAlpha = true;
+ // NOTE: We purposefully don't reset metadata here, so that even if we
+ // throw away previously-decoded data, animation loops can still access
+ // properties like frame durations without re-decoding.
}
static inline PassRefPtr<Image> loadImageWithResourceId(int resourceId)
@@ -471,6 +472,11 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
if (!m_source.initialized())
return;
+ // Spin the animation to the correct frame before we try to draw it, so we
+ // don't draw an old frame and then immediately need to draw a newer one,
+ // causing flicker and wasting CPU.
+ startAnimation();
+
const NativeImageSkia* bm = nativeImageForCurrentFrame();
if (!bm)
return; // It's too early and we don't have an image yet.
@@ -483,8 +489,6 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
enclosingIntRect(srcRect),
enclosingIntRect(dstRect),
WebCoreCompositeToSkiaComposite(compositeOp));
-
- startAnimation();
}
void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt,