Commit 1b022b83 authored by vangelis@chromium.org's avatar vangelis@chromium.org

2011-03-11 Vangelis Kokkevis <vangelis@chromium.org>

        Reviewed by James Robinson.

        [chromium] Adding a test for rotated large layers.
        https://bugs.webkit.org/show_bug.cgi?id=55984

        * platform/chromium/compositing/huge-layer-rotated-expected.checksum: Added.
        * platform/chromium/compositing/huge-layer-rotated-expected.png: Added.
        * platform/chromium/compositing/huge-layer-rotated-expected.txt: Added.
        * platform/chromium/compositing/huge-layer-rotated.html: Added.
2011-03-11  Vangelis Kokkevis  <vangelis@chromium.org>

        Reviewed by James Robinson.

        [chromium] Allow large layers with non-identity transforms to be drawn
        as long as their visible portion is smaller than the largest supported
        texture size. This code will soon be replaced by tiled layers.
        https://bugs.webkit.org/show_bug.cgi?id=55984

        Test: platform/chromium/compositing/huge-layer-rotated.html

        * platform/graphics/chromium/ContentLayerChromium.cpp:
        (WebCore::ContentLayerChromium::updateContentsIfDirty):
        (WebCore::ContentLayerChromium::draw):
        * platform/graphics/chromium/ContentLayerChromium.h:


git-svn-id: svn://svn.chromium.org/blink/trunk@80867 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 05f9d249
2011-03-11 Vangelis Kokkevis <vangelis@chromium.org>
Reviewed by James Robinson.
[chromium] Adding a test for rotated large layers.
https://bugs.webkit.org/show_bug.cgi?id=55984
* platform/chromium/compositing/huge-layer-rotated-expected.checksum: Added.
* platform/chromium/compositing/huge-layer-rotated-expected.png: Added.
* platform/chromium/compositing/huge-layer-rotated-expected.txt: Added.
* platform/chromium/compositing/huge-layer-rotated.html: Added.
2011-03-08 Dimitri Glazkov <dglazkov@chromium.org> 2011-03-08 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Eric Carlson. Reviewed by Eric Carlson.
<html>
<head>
<style type="text/css" media="screen">
.large {
-webkit-perspective: 100;
-webkit-transform-origin: left top;
-webkit-transform: rotateY(53deg) rotateZ(10deg);
width: 1000px;
height: 30000px;
background: -webkit-gradient(linear, left top, left bottom, from(#00abeb), to(#fff));
}
</style>
<script type="text/javascript" charset="utf-8">
if (window.layoutTestController)
layoutTestController.dumpAsText(true);
</script>
</head>
<body style="overflow:hidden">
<div class="large">
</div>
</body>
</html>
2011-03-11 Vangelis Kokkevis <vangelis@chromium.org>
Reviewed by James Robinson.
[chromium] Allow large layers with non-identity transforms to be drawn
as long as their visible portion is smaller than the largest supported
texture size. This code will soon be replaced by tiled layers.
https://bugs.webkit.org/show_bug.cgi?id=55984
Test: platform/chromium/compositing/huge-layer-rotated.html
* platform/graphics/chromium/ContentLayerChromium.cpp:
(WebCore::ContentLayerChromium::updateContentsIfDirty):
(WebCore::ContentLayerChromium::draw):
* platform/graphics/chromium/ContentLayerChromium.h:
2011-03-09 Chris Marrin <cmarrin@apple.com> 2011-03-09 Chris Marrin <cmarrin@apple.com>
Reviewed by Adam Roben. Reviewed by Adam Roben.
......
...@@ -93,34 +93,25 @@ void ContentLayerChromium::updateContentsIfDirty() ...@@ -93,34 +93,25 @@ void ContentLayerChromium::updateContentsIfDirty()
// FIXME: Remove this test when tiled layers are implemented. // FIXME: Remove this test when tiled layers are implemented.
if (requiresClippedUpdateRect()) { if (requiresClippedUpdateRect()) {
// A layer with 3D transforms could require an arbitrarily large number
// of texels to be repainted, so ignore these layers until tiling is
// implemented.
if (!ccLayerImpl()->drawTransform().isIdentityOrTranslation()) {
m_skipsDraw = true;
return;
}
// Calculate the region of this layer that is currently visible. // Calculate the region of this layer that is currently visible.
const IntRect clipRect = ccLayerImpl()->targetRenderSurface()->contentRect(); const IntRect clipRect = ccLayerImpl()->targetRenderSurface()->contentRect();
TransformationMatrix layerOriginTransform = ccLayerImpl()->drawTransform(); TransformationMatrix layerOriginTransform = ccLayerImpl()->drawTransform();
layerOriginTransform.translate3d(-0.5 * bounds().width(), -0.5 * bounds().height(), 0); layerOriginTransform.translate3d(-0.5 * bounds().width(), -0.5 * bounds().height(), 0);
// For now we apply the large layer treatment only for layers that are either untransformed // We compute the visible portion of the layer by back-mapping the current RenderSurface
// or are purely translated. Their matrix is expected to be invertible. // content area to the layer. To do that, we invert the drawing matrix of the layer
ASSERT(layerOriginTransform.isInvertible()); // and project the content area rectangle to it. If the layer transform is not invertible
// then we skip rendering the layer.
if (!layerOriginTransform.isInvertible()) {
m_skipsDraw = true;
return;
}
TransformationMatrix targetToLayerMatrix = layerOriginTransform.inverse(); TransformationMatrix targetToLayerMatrix = layerOriginTransform.inverse();
IntRect visibleRectInLayerCoords = targetToLayerMatrix.mapRect(clipRect); FloatQuad mappedClipToLayer = targetToLayerMatrix.projectQuad(FloatRect(clipRect));
IntRect visibleRectInLayerCoords = mappedClipToLayer.enclosingBoundingBox();
visibleRectInLayerCoords.intersect(IntRect(0, 0, bounds().width(), bounds().height())); visibleRectInLayerCoords.intersect(IntRect(0, 0, bounds().width(), bounds().height()));
// For normal layers, the center of the texture corresponds with the center of the layer.
// In large layers the center of the texture is the center of the visible region so we have
// to keep track of the offset in order to render correctly.
IntRect visibleRectInSurfaceCoords = layerOriginTransform.mapRect(visibleRectInLayerCoords);
m_layerCenterInSurfaceCoords = FloatRect(visibleRectInSurfaceCoords).center();
// If this is still too large to render, then skip the layer completely. // If this is still too large to render, then skip the layer completely.
if (!layerRenderer()->checkTextureSize(visibleRectInLayerCoords.size())) { if (!layerRenderer()->checkTextureSize(visibleRectInLayerCoords.size())) {
m_skipsDraw = true; m_skipsDraw = true;
...@@ -256,9 +247,14 @@ void ContentLayerChromium::draw() ...@@ -256,9 +247,14 @@ void ContentLayerChromium::draw()
GLC(context, context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); GLC(context, context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
if (requiresClippedUpdateRect()) { if (requiresClippedUpdateRect()) {
float m43 = ccLayerImpl()->drawTransform().m43(); // Compute the offset between the layer's center point and the center of the visible portion
TransformationMatrix transform; // of the layer.
transform.translate3d(m_layerCenterInSurfaceCoords.x(), m_layerCenterInSurfaceCoords.y(), m43); FloatPoint visibleRectCenterOffset = FloatRect(m_visibleRectInLayerCoords).center();
visibleRectCenterOffset.move(-0.5 * bounds().width(), -0.5 * bounds().height());
TransformationMatrix transform = ccLayerImpl()->drawTransform();
transform.translate(visibleRectCenterOffset.x(), visibleRectCenterOffset.y());
drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTexturedQuad(context, layerRenderer()->projectionMatrix(),
transform, m_visibleRectInLayerCoords.width(), transform, m_visibleRectInLayerCoords.width(),
m_visibleRectInLayerCoords.height(), ccLayerImpl()->drawOpacity(), m_visibleRectInLayerCoords.height(), ccLayerImpl()->drawOpacity(),
......
...@@ -82,7 +82,6 @@ private: ...@@ -82,7 +82,6 @@ private:
PlatformCanvas m_canvas; PlatformCanvas m_canvas;
IntRect m_visibleRectInLayerCoords; IntRect m_visibleRectInLayerCoords;
FloatPoint m_layerCenterInSurfaceCoords;
}; };
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment