| Index: Source/platform/graphics/StaticBitmapImage.cpp
|
| diff --git a/Source/platform/graphics/StaticBitmapImage.cpp b/Source/platform/graphics/StaticBitmapImage.cpp
|
| index 52b88e9fe2d976f63d0409e00fd457f47a8e1609..c30e66a9c37ec54edfd73eded8d4d5ea94b98262 100644
|
| --- a/Source/platform/graphics/StaticBitmapImage.cpp
|
| +++ b/Source/platform/graphics/StaticBitmapImage.cpp
|
| @@ -36,30 +36,22 @@ bool StaticBitmapImage::currentFrameKnownToBeOpaque()
|
| return m_image->isOpaque();
|
| }
|
|
|
| -void StaticBitmapImage::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, SkXfermode::Mode compositeOp, RespectImageOrientationEnum)
|
| +void StaticBitmapImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, bool /*shouldClampToSourceRect*/)
|
| {
|
| - FloatRect normDstRect = adjustForNegativeSize(dstRect);
|
| - FloatRect normSrcRect = adjustForNegativeSize(srcRect);
|
| + ASSERT(dstRect.width() >= 0 && dstRect.height() >= 0);
|
| + ASSERT(srcRect.width() >= 0 && srcRect.height() >= 0);
|
|
|
| - normSrcRect.intersect(FloatRect(0, 0, m_image->width(), m_image->height()));
|
| + FloatRect adjustedSrcRect = srcRect;
|
| + adjustedSrcRect.intersect(FloatRect(0, 0, m_image->width(), m_image->height()));
|
|
|
| - if (normSrcRect.isEmpty() || normDstRect.isEmpty())
|
| + if (adjustedSrcRect.isEmpty() || dstRect.isEmpty())
|
| return; // Nothing to draw.
|
|
|
| - ASSERT(normSrcRect.width() <= m_image->width() && normSrcRect.height() <= m_image->height());
|
| + ASSERT(adjustedSrcRect.width() <= m_image->width() && adjustedSrcRect.height() <= m_image->height());
|
|
|
| - {
|
| - SkCanvas* canvas = ctx->canvas();
|
| -
|
| - SkPaint paint;
|
| - int initialSaveCount = ctx->preparePaintForDrawRectToRect(&paint, srcRect, dstRect, compositeOp, !currentFrameKnownToBeOpaque());
|
| -
|
| - SkRect srcSkRect = WebCoreFloatRectToSKRect(normSrcRect);
|
| - SkRect dstSkRect = WebCoreFloatRectToSKRect(normDstRect);
|
| -
|
| - canvas->drawImageRect(m_image.get(), &srcSkRect, dstSkRect, &paint);
|
| - canvas->restoreToCount(initialSaveCount);
|
| - }
|
| + SkRect srcSkRect = adjustedSrcRect;
|
| + // TODO: Add support for shouldClampToSourceRect
|
| + canvas->drawImageRect(m_image.get(), &srcSkRect, dstRect, &paint);
|
|
|
| if (ImageObserver* observer = imageObserver())
|
| observer->didDraw(this);
|
|
|