diff options
author | Steve Block <steveblock@google.com> | 2011-06-08 08:26:01 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-08 08:26:01 -0700 |
commit | 3742ac093d35d923c81693096ab6671e9b147700 (patch) | |
tree | c2add9100f789dad45ef1ec5328bddde02c47a4c /Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp | |
parent | 901401d90459bc22580842455d4588b9a697514d (diff) | |
parent | e5926f4a0d6adc9ad4a75824129f117181953560 (diff) | |
download | external_webkit-3742ac093d35d923c81693096ab6671e9b147700.zip external_webkit-3742ac093d35d923c81693096ab6671e9b147700.tar.gz external_webkit-3742ac093d35d923c81693096ab6671e9b147700.tar.bz2 |
Merge changes I55c6d71a,Ifb3277d4,Ia1b847a2,I7ba9cf3f,Ida2b2a8a,I1280ec90,I72f818d5,I2e3b588b,I9a4e6289,Ia724c78b,Icd8612c8,Ie31b15d7,Ie125edae,I77941a88,I89dae78b,I3516e5ca,I1a4c17b5,I2c4ecc1a,I9c8e6537,Ifac13115,Ie1f80e09,Ia541ed77,I60ce9d78
* changes:
Merge WebKit at r82507: Update ThirdPartyProject.prop
Merge WebKit at r82507: Cherry-pick change r88166 to add INSPECTOR guards to ScriptProfiler
Merge WebKit at r82507: Work around a V8 bug
Merge WebKit at r82507: JNIType renamed to JavaType
Merge WebKit at r82507: IconDatabaseClient interface expanded
Merge WebKit at r82507: Don't use new loss-free code path in HTMLCanvasElement::toDataURL()
Merge WebKit at r82507: IcondDatabaseBase::iconForPageURL() renamed
Merge WebKit at r82507: IconDatabaseBase::Open() signature changed
Merge WebKit at r82507: Node::isContentEditable() renamed
Merge WebKit at r82507: Use icon database through IconDatabaseBase
Merge WebKit at r82507: toInputElement() is now a member of Node
Merge WebKit at r82507: FrameLoaderClient::objectContentType() signature changed
Merge WebKit at r82507: StringImpl::computeHash() removed
Merge WebKit at r82507: Stub out FontPlatformData::setOrientation()
Merge WebKit at r82507: Path::strokeBoundingRect() is now const
Merge WebKit at r82507: Add missing UnusedParam.h include in ApplicationCacheGroup.cpp
Merge WebKit at r82507: Continue to use Android's version of FontPlatformData.h
Merge WebKit at r82507: Update signature of FontCustomPlatformData::fontPlatformData()
Merge WebKit at r82507: Fix conflicts due to JNI refactoring
Merge WebKit at r82507: Fix conflicts due to new StorageTracker
Merge WebKit at r82507: Fix conflicts
Merge WebKit at r82507: Fix makefiles
Merge WebKit at r82507: Initial merge by git
Diffstat (limited to 'Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 78f93d5..4ea9c92 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -66,7 +66,7 @@ void ContentLayerChromium::cleanupResources() m_contentsTexture.clear(); } -bool ContentLayerChromium::requiresClippedUpdateRect() const +bool ContentLayerChromium::requiresClippedUpdateRect() { // To avoid allocating excessively large textures, switch into "large layer mode" if // one of the layer's dimensions is larger than 2000 pixels or the size of @@ -77,7 +77,7 @@ bool ContentLayerChromium::requiresClippedUpdateRect() const || !layerRenderer()->checkTextureSize(bounds())); } -void ContentLayerChromium::updateContentsIfDirty() +void ContentLayerChromium::paintContentsIfDirty() { RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client()); if (!backing || backing->paintingGoesToWindow()) @@ -93,34 +93,25 @@ void ContentLayerChromium::updateContentsIfDirty() // FIXME: Remove this test when tiled layers are implemented. 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. const IntRect clipRect = ccLayerImpl()->targetRenderSurface()->contentRect(); TransformationMatrix layerOriginTransform = ccLayerImpl()->drawTransform(); 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 - // or are purely translated. Their matrix is expected to be invertible. - ASSERT(layerOriginTransform.isInvertible()); - + // We compute the visible portion of the layer by back-mapping the current RenderSurface + // content area to the layer. To do that, we invert the drawing matrix of the layer + // 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(); - IntRect visibleRectInLayerCoords = targetToLayerMatrix.mapRect(clipRect); + FloatQuad mappedClipToLayer = targetToLayerMatrix.projectQuad(FloatRect(clipRect)); + IntRect visibleRectInLayerCoords = mappedClipToLayer.enclosingBoundingBox(); 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 (!layerRenderer()->checkTextureSize(visibleRectInLayerCoords.size())) { m_skipsDraw = true; @@ -256,9 +247,14 @@ void ContentLayerChromium::draw() GLC(context, context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); if (requiresClippedUpdateRect()) { - float m43 = ccLayerImpl()->drawTransform().m43(); - TransformationMatrix transform; - transform.translate3d(m_layerCenterInSurfaceCoords.x(), m_layerCenterInSurfaceCoords.y(), m43); + // Compute the offset between the layer's center point and the center of the visible portion + // of the layer. + 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(), transform, m_visibleRectInLayerCoords.width(), m_visibleRectInLayerCoords.height(), ccLayerImpl()->drawOpacity(), @@ -273,6 +269,11 @@ void ContentLayerChromium::draw() unreserveContentsTexture(); } +void ContentLayerChromium::updateCompositorResources() +{ + updateTextureIfNeeded(); +} + void ContentLayerChromium::unreserveContentsTexture() { if (!m_skipsDraw && m_contentsTexture) @@ -281,8 +282,6 @@ void ContentLayerChromium::unreserveContentsTexture() void ContentLayerChromium::bindContentsTexture() { - updateTextureIfNeeded(); - if (!m_skipsDraw && m_contentsTexture) m_contentsTexture->bindTexture(); } |