Changeset 67402 in webkit


Ignore:
Timestamp:
Sep 13, 2010 12:05:53 PM (14 years ago)
Author:
alex
Message:

2010-09-13 Alejandro G. Castro <alex@igalia.com>

Reviewed by Kenneth Rohde Christiansen.

[Gtk] Reduce the size of the shadow buffer in the paths using the clip region
https://bugs.webkit.org/show_bug.cgi?id=44699

Intersect the clip bounding rect with the path that we are going
to use to create the shadow in order to reduce the region we have
to blur.

  • platform/graphics/cairo/GraphicsContextCairo.cpp: (WebCore::drawPathShadow):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r67401 r67402  
     12010-09-13  Alejandro G. Castro  <alex@igalia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Gtk] Reduce the size of the shadow buffer in the paths using the clip region
     6        https://bugs.webkit.org/show_bug.cgi?id=44699
     7
     8        Intersect the clip bounding rect with the path that we are going
     9        to use to create the shadow in order to reduce the region we have
     10        to blur.
     11
     12        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     13        (WebCore::drawPathShadow):
     14
    115210-09-13  Darin Fisher  <darin@chromium.org>
    216
  • trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r67398 r67402  
    215215    GraphicsContext::calculateShadowBufferDimensions(shadowBufferSize, shadowRect, radius, rect, shadowOffset, shadowBlur);
    216216
     217    cairo_clip_extents(cr, &x0, &y0, &x1, &y1);
     218    FloatRect clipRect(x0, y0, x1 - x0, y1 - y0);
     219
     220    FloatPoint rectLocation = shadowRect.location();
     221
     222    // Reduce the shadow rect using the clip area.
     223    if (!clipRect.contains(shadowRect)) {
     224        shadowRect.intersect(clipRect);
     225        if (shadowRect.isEmpty())
     226            return;
     227        shadowRect.inflate(radius);
     228        shadowBufferSize = IntSize(shadowRect.width(), shadowRect.height());
     229    }
     230
     231    shadowOffset = rectLocation - shadowRect.location();
     232
    217233    // Create suitably-sized ImageBuffer to hold the shadow.
    218234    OwnPtr<ImageBuffer> shadowBuffer = ImageBuffer::create(shadowBufferSize);
     
    221237    cairo_t* shadowContext = shadowBuffer->context()->platformContext();
    222238    copyContextProperties(cr, shadowContext);
    223     cairo_translate(shadowContext, -rect.x() + radius, -rect.y() + radius);
     239    cairo_translate(shadowContext, -rect.x() + radius + shadowOffset.width(), -rect.y() + radius + shadowOffset.height());
    224240    cairo_new_path(shadowContext);
    225241    OwnPtr<cairo_path_t> path(cairo_copy_path(cr));
Note: See TracChangeset for help on using the changeset viewer.