Commit 57ef91e7 authored by krit@webkit.org's avatar krit@webkit.org

2009-04-25 Dirk Schulze <krit@webkit.org>

        Reviewed by Oliver Hunt.

        A width or height of zero for the destination or source rect of an
        image causes a not invertible pattern matrix.
        This crahes newer versions of Cairo and give some graphic gliches in
        Canvas.
        With this patch we check if there is something to draw and return if not.

        * platform/graphics/cairo/ImageCairo.cpp:
        (WebCore::BitmapImage::draw):


git-svn-id: svn://svn.chromium.org/blink/trunk@42875 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent ea9b5424
2009-04-25 Dirk Schulze <krit@webkit.org>
Reviewed by Oliver Hunt.
A width or height of zero for the destination or source rect of an
image causes a not invertible pattern matrix.
This crahes newer versions of Cairo and give some graphic gliches in
Canvas.
With this patch we check if there is something to draw and return if not.
* platform/graphics/cairo/ImageCairo.cpp:
(WebCore::BitmapImage::draw):
2009-04-25 Simon Fraser <simon.fraser@apple.com> 2009-04-25 Simon Fraser <simon.fraser@apple.com>
Reviewed by Darin Adler Reviewed by Darin Adler
...@@ -89,15 +89,19 @@ BitmapImage::BitmapImage(cairo_surface_t* surface, ImageObserver* observer) ...@@ -89,15 +89,19 @@ BitmapImage::BitmapImage(cairo_surface_t* surface, ImageObserver* observer)
void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, CompositeOperator op) void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, CompositeOperator op)
{ {
FloatRect srcRect(src);
FloatRect dstRect(dst);
if (dstRect.width() == 0.0f || dstRect.height() == 0.0f ||
srcRect.width() == 0.0f || srcRect.height() == 0.0f)
return;
startAnimation(); startAnimation();
cairo_surface_t* image = frameAtIndex(m_currentFrame); cairo_surface_t* image = frameAtIndex(m_currentFrame);
if (!image) // If it's too early we won't have an image yet. if (!image) // If it's too early we won't have an image yet.
return; return;
FloatRect srcRect(src);
FloatRect dstRect(dst);
if (mayFillWithSolidColor()) { if (mayFillWithSolidColor()) {
fillWithSolidColor(context, dstRect, solidColor(), op); fillWithSolidColor(context, dstRect, solidColor(), op);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment