diff options
Diffstat (limited to 'WebCore/platform/graphics/android/ImageAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/ImageAndroid.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/WebCore/platform/graphics/android/ImageAndroid.cpp b/WebCore/platform/graphics/android/ImageAndroid.cpp index da52d67..3a3312f 100644 --- a/WebCore/platform/graphics/android/ImageAndroid.cpp +++ b/WebCore/platform/graphics/android/ImageAndroid.cpp @@ -67,8 +67,6 @@ bool FrameData::clear(bool clearMetadata) if (m_frame) { m_frame->unref(); m_frame = 0; - m_duration = 0.; - m_hasAlpha = true; return true; } return false; @@ -157,11 +155,16 @@ void BitmapImage::checkForSolidColor() void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp) { + if (!m_source.initialized()) + return; + + startAnimation(); + SkBitmapRef* image = this->nativeImageForCurrentFrame(); if (!image) { // If it's too early we won't have an image yet. return; } - + // in case we get called with an incomplete bitmap const SkBitmap& bitmap = image->bitmap(); if (bitmap.getPixels() == NULL && bitmap.pixelRef() == NULL) { @@ -172,12 +175,12 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, #endif return; } - + SkIRect srcR; SkRect dstR; float invScaleX = (float)bitmap.width() / image->origWidth(); float invScaleY = (float)bitmap.height() / image->origHeight(); - + android_setrect(&dstR, dstRect); android_setrect_scaled(&srcR, srcRect, invScaleX, invScaleY); if (srcR.isEmpty() || dstR.isEmpty()) { @@ -188,16 +191,14 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, #endif return; } - + SkCanvas* canvas = ctxt->platformContext()->mCanvas; SkPaint paint; - + paint.setFilterBitmap(true); paint.setPorterDuffXfermode(android_convert_compositeOp(compositeOp)); canvas->drawBitmapRect(bitmap, &srcR, dstR, &paint); - - startAnimation(); - + #ifdef TRACE_SUBSAMPLED_BITMAPS if (bitmap.width() != image->origWidth() || bitmap.height() != image->origHeight()) { |