Changeset 38001 in webkit


Ignore:
Timestamp:
Oct 30, 2008 7:09:59 AM (15 years ago)
Author:
alp@webkit.org
Message:

2008-10-30 Dirk Schulze <vbs85@gmx.de>

Reviewed by Alp Toker.

https://bugs.webkit.org/show_bug.cgi?id=21883
[CAIRO] globalAlpha has to be stored and restored

Cairo's globalAlpha has to be stored and reloaded on calling
save() and restore(). We use the power of GraphicsContextState for this.

  • platform/graphics/GraphicsContextPrivate.h: (WebCore::GraphicsContextState::GraphicsContextState):
  • platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::fillPath): (WebCore::GraphicsContext::strokePath): (WebCore::GraphicsContext::setAlpha): (WebCore::GraphicsContext::getAlpha):
  • platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r37993 r38001  
     12008-10-30  Dirk Schulze  <vbs85@gmx.de>
     2
     3        Reviewed by Alp Toker.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=21883
     6        [CAIRO] globalAlpha has to be stored and restored
     7
     8        Cairo's globalAlpha has to be stored and reloaded on calling
     9        save() and restore(). We use the power of GraphicsContextState for this.
     10
     11        * platform/graphics/GraphicsContextPrivate.h:
     12        (WebCore::GraphicsContextState::GraphicsContextState):
     13        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     14        (WebCore::GraphicsContext::fillPath):
     15        (WebCore::GraphicsContext::strokePath):
     16        (WebCore::GraphicsContext::setAlpha):
     17        (WebCore::GraphicsContext::getAlpha):
     18        * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h:
     19        (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
     20
    1212008-10-29  Alexey Proskuryakov  <ap@webkit.org>
    222
  • trunk/WebCore/platform/graphics/GraphicsContextPrivate.h

    r37605 r38001  
    5151            , strokeStyle(SolidStroke)
    5252            , strokeThickness(0)
     53#if PLATFORM(CAIRO)
     54            , globalAlpha(1.0f)
     55#endif
    5356            , strokeColorSpace(SolidColorSpace)
    5457            , strokeColor(Color::black)
     
    6669        StrokeStyle strokeStyle;
    6770        float strokeThickness;
     71#if PLATFORM(CAIRO)
     72        float globalAlpha;
     73#endif
    6874        ColorSpace strokeColorSpace;
    6975        Color strokeColor;
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r37778 r38001  
    448448            setColor(cr, fillColor());
    449449            cairo_clip(cr);
    450             cairo_paint_with_alpha(cr, m_data->globalAlpha);
     450            cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
    451451        }
    452452        break;
     
    454454        cairo_set_source(cr, m_common->state.fillPattern.get()->createPlatformPattern(getCTM()));
    455455        cairo_clip(cr);
    456         cairo_paint_with_alpha(cr, m_data->globalAlpha);
     456        cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
    457457        break;
    458458    case GradientColorSpace:
     
    461461        cairo_set_source(cr, pattern);
    462462        cairo_clip(cr);
    463         cairo_paint_with_alpha(cr, m_data->globalAlpha);
     463        cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
    464464        break;
    465465    }
     
    478478        if (strokeColor().alpha()) {
    479479            setColor(cr, strokeColor());
    480             if (m_data->globalAlpha < 1.0f) {
     480            if (m_common->state.globalAlpha < 1.0f) {
    481481                cairo_push_group(cr);
    482                 cairo_paint_with_alpha(cr, m_data->globalAlpha);
     482                cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
    483483                cairo_pop_group_to_source(cr);
    484484            }
     
    488488    case PatternColorSpace:
    489489        cairo_set_source(cr, m_common->state.strokePattern.get()->createPlatformPattern(getCTM()));
    490         if (m_data->globalAlpha < 1.0f) {
     490        if (m_common->state.globalAlpha < 1.0f) {
    491491            cairo_push_group(cr);
    492             cairo_paint_with_alpha(cr, m_data->globalAlpha);
     492            cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
    493493            cairo_pop_group_to_source(cr);
    494494        }
     
    499499        pattern = applySpreadMethod(pattern, spreadMethod());
    500500        cairo_set_source(cr, pattern);
    501         if (m_data->globalAlpha < 1.0f) {
     501        if (m_common->state.globalAlpha < 1.0f) {
    502502            cairo_push_group(cr);
    503             cairo_paint_with_alpha(cr, m_data->globalAlpha);
     503            cairo_paint_with_alpha(cr, m_common->state.globalAlpha);
    504504            cairo_pop_group_to_source(cr);
    505505        }
     
    888888void GraphicsContext::setAlpha(float alpha)
    889889{
    890     m_data->globalAlpha = alpha;
     890    m_common->state.globalAlpha = alpha;
    891891}
    892892
    893893float GraphicsContext::getAlpha()
    894894{
    895     return m_data->globalAlpha;
     895    return m_common->state.globalAlpha;
    896896}
    897897
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h

    r36010 r38001  
    4646    GraphicsContextPlatformPrivate()
    4747        : cr(0)
    48         , globalAlpha(1.0f)
    4948#if PLATFORM(GTK)
    5049        , expose(0)
     
    8988
    9089    cairo_t* cr;
    91     float globalAlpha;
    9290    Vector<float> layers;
    9391
Note: See TracChangeset for help on using the changeset viewer.