Show
Ignore:
Timestamp:
04/26/07 22:11:50 (21 months 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.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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}