Changeset 21134 in webkit


Ignore:
Timestamp:
Apr 26, 2007 10:11:50 PM (17 years ago)
Author:
bdash
Message:

2007-04-26 Alp Toker <alp@atoker.com>

Reviewed by Maciej.

http://bugs.webkit.org/show_bug.cgi?id=13505
Cast loses precision on x86_64

  • platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::GraphicsContext::beginTransparencyLayer): (WebCore::GraphicsContext::endTransparencyLayer): Use a stack of opacity values instead of Cairo user data.
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r21132 r21134  
     12007-04-26  Alp Toker  <alp@atoker.com>
     2
     3        Reviewed by Maciej.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=13505
     6        Cast loses precision on x86_64
     7
     8        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     9        (WebCore::GraphicsContext::beginTransparencyLayer):
     10        (WebCore::GraphicsContext::endTransparencyLayer):
     11        Use a stack of opacity values instead of Cairo user data.
     12
    1132007-04-26  Mitz Pettel  <mitz@webkit.org>
    214
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r21041 r21134  
    6666
    6767    cairo_t* context;
    68     cairo_user_data_key_t opacityKey;
     68    Vector<float> layers;
    6969};
    7070
     
    575575        return;
    576576
    577     ASSERT(opacity >= 0 && opacity <= 1);
    578 
    579577    cairo_t* context = m_data->context;
    580578    cairo_save(context);
    581579    cairo_push_group(context);
    582     // We insert the opacity into a Cairo surface data slot.
    583     // Rather than passing a pointer, we store the opacity value directly.
    584     void* odata = reinterpret_cast<void*>(static_cast<unsigned int>(opacity * UINT_MAX));
    585     cairo_surface_set_user_data(cairo_get_target(context), &m_data->opacityKey, odata, NULL);
     580    m_data->layers.append(opacity);
    586581}
    587582
     
    592587
    593588    cairo_t* context = m_data->context;
    594     void* odata = cairo_surface_get_user_data(cairo_get_target(context), &m_data->opacityKey);
    595     float opacity = static_cast<float>(reinterpret_cast<unsigned int>(odata)) / UINT_MAX;
    596 
    597     ASSERT(opacity >= 0 && opacity <= 1);
    598589
    599590    cairo_pop_group_to_source(context);
    600     cairo_paint_with_alpha(context, opacity);
     591    cairo_paint_with_alpha(context, m_data->layers.last());
     592    m_data->layers.removeLast();
    601593    cairo_restore(context);
    602594}
Note: See TracChangeset for help on using the changeset viewer.