Changeset 148200 in webkit


Ignore:
Timestamp:
Apr 11, 2013 7:28:00 AM (11 years ago)
Author:
anilsson@rim.com
Message:

[BlackBerry] Accelerated compositing debug rectangle incorrectly drawn for layers with surfaces
https://bugs.webkit.org/show_bug.cgi?id=114275

Reviewed by Carlos Garcia Campos.

The drawDebugBorder method was updated to mirror the logic in
compositeLayersRecursive, i.e. if we're compositing a surface to the
screen, use the transformed bounds stored in the surface. The bounds
stored in the layer should only be used when drawing the layer to the
surface.

Speaking of which, also update the code to skip border drawing when
drawing a layer to a surface. Drawing the borders inside the surface
would only result in messing up the surface contents, especially when
CSS filters like blur were the reason for having a surface in the first
place - the border would be blurred and hard to discern.

Only manually testable, the debug border is disabled during layout
tests.

PR 323746

  • platform/graphics/blackberry/LayerRenderer.cpp:

(WebCore::LayerRenderer::drawDebugBorder):

  • platform/graphics/blackberry/LayerRendererSurface.cpp:

(WebCore::LayerRendererSurface::drawRect):
(WebCore::LayerRendererSurface::transformedBounds): Added.
(WebCore):

  • platform/graphics/blackberry/LayerRendererSurface.h:

(LayerRendererSurface):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148199 r148200  
     12013-04-11  Arvid Nilsson  <anilsson@rim.com>
     2
     3        [BlackBerry] Accelerated compositing debug rectangle incorrectly drawn for layers with surfaces
     4        https://bugs.webkit.org/show_bug.cgi?id=114275
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        The drawDebugBorder method was updated to mirror the logic in
     9        compositeLayersRecursive, i.e. if we're compositing a surface to the
     10        screen, use the transformed bounds stored in the surface. The bounds
     11        stored in the layer should only be used when drawing the layer to the
     12        surface.
     13
     14        Speaking of which, also update the code to skip border drawing when
     15        drawing a layer to a surface. Drawing the borders inside the surface
     16        would only result in messing up the surface contents, especially when
     17        CSS filters like blur were the reason for having a surface in the first
     18        place - the border would be blurred and hard to discern.
     19
     20        Only manually testable, the debug border is disabled during layout
     21        tests.
     22
     23        PR 323746
     24
     25        * platform/graphics/blackberry/LayerRenderer.cpp:
     26        (WebCore::LayerRenderer::drawDebugBorder):
     27        * platform/graphics/blackberry/LayerRendererSurface.cpp:
     28        (WebCore::LayerRendererSurface::drawRect):
     29        (WebCore::LayerRendererSurface::transformedBounds): Added.
     30        (WebCore):
     31        * platform/graphics/blackberry/LayerRendererSurface.h:
     32        (LayerRendererSurface):
     33
    1342013-04-11  Arvid Nilsson  <anilsson@rim.com>
    235
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerRenderer.cpp

    r148192 r148200  
    596596        glDisable(GL_BLEND);
    597597
     598    // If we're rendering to a surface, don't include debug border inside the surface.
     599    if (m_currentLayerRendererSurface)
     600        return;
     601
     602    FloatQuad transformedBounds;
     603    if (layerAlreadyOnSurface(layer))
     604        transformedBounds = layer->layerRendererSurface()->transformedBounds();
     605    else
     606        transformedBounds = layer->getTransformedBounds();
     607
    598608    const GLES2Program& program = useProgram(ColorProgram);
    599     glVertexAttribPointer(program.positionLocation(), 2, GL_FLOAT, GL_FALSE, 0, &layer->getTransformedBounds());
     609    glVertexAttribPointer(program.positionLocation(), 2, GL_FLOAT, GL_FALSE, 0, &transformedBounds);
    600610    glUniform4f(m_colorColorLocation, borderColor.red() / 255.0, borderColor.green() / 255.0, borderColor.blue() / 255.0, 1);
    601611
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.cpp

    r144465 r148200  
    5151    float by = m_size.height() / 2.0;
    5252
    53     FloatQuad transformedBounds;
    54     transformedBounds.setP1(m_drawTransform.mapPoint(FloatPoint(-bx, -by)));
    55     transformedBounds.setP2(m_drawTransform.mapPoint(FloatPoint(-bx, by)));
    56     transformedBounds.setP3(m_drawTransform.mapPoint(FloatPoint(bx, by)));
    57     transformedBounds.setP4(m_drawTransform.mapPoint(FloatPoint(bx, -by)));
    58 
    59     FloatRect rect = transformedBounds.boundingBox();
     53    FloatRect rect = transformedBounds().boundingBox();
    6054
    6155    if (m_ownerLayer->replicaLayer()) {
     
    6963
    7064    return rect;
     65}
     66
     67FloatQuad LayerRendererSurface::transformedBounds() const
     68{
     69    float bx = m_size.width() / 2.0;
     70    float by = m_size.height() / 2.0;
     71
     72    FloatQuad bounds;
     73    bounds.setP1(m_drawTransform.mapPoint(FloatPoint(-bx, -by)));
     74    bounds.setP2(m_drawTransform.mapPoint(FloatPoint(-bx, by)));
     75    bounds.setP3(m_drawTransform.mapPoint(FloatPoint(bx, by)));
     76    bounds.setP4(m_drawTransform.mapPoint(FloatPoint(bx, -by)));
     77
     78    return bounds;
    7179}
    7280
  • trunk/Source/WebCore/platform/graphics/blackberry/LayerRendererSurface.h

    r148129 r148200  
    5252
    5353    FloatRect drawRect() const;
     54    FloatQuad transformedBounds() const;
    5455
    5556    bool ensureTexture();
Note: See TracChangeset for help on using the changeset viewer.