Changeset 28345 in webkit


Ignore:
Timestamp:
Dec 3, 2007 4:57:14 AM (16 years ago)
Author:
alp@webkit.org
Message:

2007-12-03 Alp Toker <alp@atoker.com>

Reviewed by Mark Rowe.

Don't delete the decoder if it's already been created. The one we have
is fine.

Cairo image cleanups. Nothing substantial.

Notify ImageObservers where appropriate.

  • platform/graphics/cairo/ImageCairo.cpp: (WebCore::BitmapImage::draw): (WebCore::Image::drawPattern):
  • platform/graphics/cairo/ImageSourceCairo.cpp: (WebCore::ImageSource::setData):
  • platform/graphics/gtk/ImageGtk.cpp:
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r28344 r28345  
     12007-12-03  Alp Toker  <alp@atoker.com>
     2
     3        Reviewed by Mark Rowe.
     4
     5        Don't delete the decoder if it's already been created. The one we have
     6        is fine.
     7
     8        Cairo image cleanups. Nothing substantial.
     9
     10        Notify ImageObservers where appropriate.
     11
     12        * platform/graphics/cairo/ImageCairo.cpp:
     13        (WebCore::BitmapImage::draw):
     14        (WebCore::Image::drawPattern):
     15        * platform/graphics/cairo/ImageSourceCairo.cpp:
     16        (WebCore::ImageSource::setData):
     17        * platform/graphics/gtk/ImageGtk.cpp:
     18
    1192007-12-03  Simon Hausmann  <hausmann@webkit.org>
    220
  • trunk/WebCore/platform/graphics/cairo/ImageCairo.cpp

    r24016 r28345  
    3333#include "FloatRect.h"
    3434#include "GraphicsContext.h"
     35#include "ImageObserver.h"
    3536#include <cairo.h>
    3637#include <math.h>
     
    4849}
    4950
    50 // ================================================
    51 // Image Class
    52 // ================================================
    53 
    54 // Drawing Routines
    55 
    5651void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, CompositeOperator op)
    5752{
    58     cairo_t* cr = context->platformContext();
    59 
    6053    if (!m_source.initialized())
    6154        return;
     55
     56    FloatRect srcRect(src);
     57    FloatRect dstRect(dst);
    6258
    6359    cairo_surface_t* image = frameAtIndex(m_currentFrame);
     
    6561        return;
    6662
     63    if (mayFillWithSolidColor()) {
     64        fillWithSolidColor(context, dstRect, solidColor(), op);
     65        return;
     66    }
     67
    6768    IntSize selfSize = size();
    68     FloatRect srcRect(src);
    69     FloatRect dstRect(dst);
    7069
     70    cairo_t* cr = context->platformContext();
    7171    cairo_save(cr);
    7272
     
    9090    float scaleX = srcRect.width() / dstRect.width();
    9191    float scaleY = srcRect.height() / dstRect.height();
    92     cairo_matrix_t matrix = { scaleX,  0, 0 , scaleY, srcRect.x(), srcRect.y() };
     92    cairo_matrix_t matrix = { scaleX, 0, 0, scaleY, srcRect.x(), srcRect.y() };
    9393    cairo_pattern_set_matrix(pattern, &matrix);
    9494
     
    9696    cairo_translate(cr, dstRect.x(), dstRect.y());
    9797    cairo_set_source(cr, pattern);
     98    cairo_pattern_destroy(pattern);
    9899    cairo_rectangle(cr, 0, 0, dstRect.width(), dstRect.height());
    99100    cairo_fill(cr);
    100101
    101     cairo_pattern_destroy(pattern);
    102102    cairo_restore(cr);
    103103
    104104    startAnimation();
     105
     106    if (imageObserver())
     107        imageObserver()->didDraw(this);
    105108}
    106109
     
    132135    context->setCompositeOperation(op);
    133136    cairo_set_source(cr, pattern);
     137    cairo_pattern_destroy(pattern);
    134138    cairo_rectangle(cr, destRect.x(), destRect.y(), destRect.width(), destRect.height());
    135139    cairo_fill(cr);
    136140
    137     cairo_pattern_destroy(pattern);
    138141    context->restore();
     142
     143    if (imageObserver())
     144        imageObserver()->didDraw(this);
    139145}
    140146
  • trunk/WebCore/platform/graphics/cairo/ImageSourceCairo.cpp

    r28114 r28345  
    113113    // If insufficient bytes are available to determine the image type, no decoder plugin will be
    114114    // made.
    115     delete m_decoder;
    116     m_decoder = createDecoder(data->buffer());
     115    if (!m_decoder)
     116        m_decoder = createDecoder(data->buffer());
     117
    117118    if (!m_decoder)
    118119        return;
     120
    119121    m_decoder->setData(data, allDataReceived);
    120122}
  • trunk/WebCore/platform/graphics/gtk/ImageGtk.cpp

    r25703 r28345  
    2525
    2626#include "config.h"
    27 #include "Image.h"
    2827
    2928#include "BitmapImage.h"
     29#include "Image.h"
    3030#include "NotImplemented.h"
    31 #include <cairo.h>
    32  
     31
    3332// This function loads resources from WebKit
    3433Vector<char> loadResourceIntoArray(const char*);
Note: See TracChangeset for help on using the changeset viewer.