Changeset 146906 in webkit
- Timestamp:
- Mar 26, 2013 10:44:19 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r146905 r146906 1 2013-03-26 Arvid Nilsson <anilsson@rim.com> 2 3 [BlackBerry] WebOverlay::pixelViewportRect() should return pixel viewport coordinates 4 https://bugs.webkit.org/show_bug.cgi?id=113263 5 6 Reviewed by Rob Buis. 7 8 PR 312404 9 10 Fix WebOverlay::pixelViewportRect() to return the pixel viewport rect 11 instead of the window rect. These are different if the web page is 12 rendered starting at a window coordinate other than 0,0. The clip rect 13 encodes the position we're rendered at, and can be used to translate 14 the rect expressed in window coordinates to the pixel viewport 15 coordinate system. 16 17 Also perform some cleanup of related code. 18 19 Only manually testable. 20 21 * platform/graphics/blackberry/LayerCompositingThread.cpp: 22 (WebCore::LayerCompositingThread::getTransformedHolePunchRect): 23 (WebCore::LayerCompositingThread::drawTextures): 24 * platform/graphics/blackberry/LayerRenderer.cpp: 25 (WebCore::toPixelCoordinates): 26 (WebCore): 27 (WebCore::LayerRenderer::toWindowCoordinates): 28 (WebCore::LayerRenderer::toPixelViewportCoordinates): 29 (WebCore::LayerRenderer::toDocumentViewportCoordinates): 30 (WebCore::LayerRenderer::updateLayersRecursive): 31 * platform/graphics/blackberry/LayerRenderer.h: 32 (LayerRenderer): 33 1 34 2013-03-26 Sheriff Bot <webkit.review.bot@gmail.com> 2 35 -
trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp
r146343 r146906 183 183 // In order to clip we need to determine the current position of this layer, which 184 184 // is encoded in the m_drawTransform value, which was used to initialize m_drawRect. 185 IntRect drawRect = m_layerRenderer->to WebKitDocumentCoordinates(m_drawRect);185 IntRect drawRect = m_layerRenderer->toDocumentViewportCoordinates(m_drawRect); 186 186 187 187 // Assert that in this case, where the hole punch rectangle equals the size of the layer, … … 253 253 -m_transformedBounds.p1().y() * vrh2 + vrh2 + visibleRect.y()); 254 254 paintRect = IntRect(roundedIntPoint(p), m_bounds); 255 } else { 256 FloatRect r = m_layerRenderer->toWebKitWindowCoordinates(m_drawRect); 257 paintRect = enclosingIntRect(r); 258 } 255 } else 256 paintRect = m_layerRenderer->toWindowCoordinates(m_drawRect); 257 259 258 m_mediaPlayer->paint(0, paintRect); 260 259 MediaPlayerPrivate* mpp = static_cast<MediaPlayerPrivate*>(m_mediaPlayer->platformMedia().media.qnxMediaPlayer); -
trunk/Source/WebCore/platform/graphics/blackberry/LayerRenderer.cpp
r146366 r146906 546 546 } 547 547 548 static FloatRect toPixelCoordinates(const FloatRect& rect, const IntRect& viewport, int surfaceHeight) 549 { 550 float vw2 = viewport.width() / 2.0; 551 float vh2 = viewport.height() / 2.0; 552 float ox = viewport.x() + vw2; 553 float oy = surfaceHeight - (viewport.y() + vh2); 554 return FloatRect(rect.x() * vw2 + ox, -(rect.y() + rect.height()) * vh2 + oy, rect.width() * vw2, rect.height() * vh2); 555 } 556 548 557 // Transform normalized device coordinates to window coordinates as WebKit understands them. 549 558 // … … 551 560 // have origin in bottom left while WebKit window coordinates origin is in top left. 552 561 // The viewport is setup to cover the upper portion of the larger OpenGL surface. 553 IntRect LayerRenderer::toWebKitWindowCoordinates(const FloatRect& r) const 554 { 555 float vw2 = m_viewport.width() / 2.0; 556 float vh2 = m_viewport.height() / 2.0; 557 float ox = m_viewport.x() + vw2; 558 float oy = m_client->context()->surfaceSize().height() - (m_viewport.y() + vh2); 559 return enclosingIntRect(FloatRect(r.x() * vw2 + ox, -(r.y()+r.height()) * vh2 + oy, r.width() * vw2, r.height() * vh2)); 560 } 561 562 // Similar to toWebKitWindowCoordinates except that this also takes any zoom into account. 563 IntRect LayerRenderer::toWebKitDocumentCoordinates(const FloatRect& r) const 564 { 565 // The zoom is the ratio between visibleRect (or layoutRect) and dstRect parameters which are passed to drawLayers 566 float zoom = m_visibleRect.width() / m_viewport.width(); 567 // Could assert here that it doesn't matter whether we choose width or height in the above statement: 568 // because both rectangles should have very similar shapes (subject only to pixel rounding error). 569 570 IntRect result = toWebKitWindowCoordinates(r); 571 result.scale(zoom); 572 return result; 562 IntRect LayerRenderer::toWindowCoordinates(const FloatRect& rect) const 563 { 564 return enclosingIntRect(toPixelCoordinates(rect, m_viewport, m_client->context()->surfaceSize().height())); 565 } 566 567 IntRect LayerRenderer::toPixelViewportCoordinates(const FloatRect& rect) const 568 { 569 // The clip rect defines the web page's pixel viewport (to use ViewportAccessor terminology), 570 // not to be confused with the GL viewport. So translate from window coordinates to pixel 571 // viewport coordinates. 572 int surfaceHeight = m_client->context()->surfaceSize().height(); 573 FloatRect pixelViewport = toPixelCoordinates(m_clipRect, m_viewport, surfaceHeight); 574 FloatRect result = toPixelCoordinates(rect, m_viewport, surfaceHeight); 575 result.move(-pixelViewport.x(), -pixelViewport.y()); 576 return enclosingIntRect(result); 577 } 578 579 IntRect LayerRenderer::toDocumentViewportCoordinates(const FloatRect& rect) const 580 { 581 // Similar to toPixelViewportCoordinates except that this also takes any zoom into account. 582 FloatRect result = toPixelViewportCoordinates(rect); 583 result.scale(1 / m_scale); 584 return enclosingIntRect(result); 573 585 } 574 586 … … 800 812 801 813 if (layer->needsTexture() && layerVisible) { 802 IntRect dirtyRect = toW ebKitWindowCoordinates(intersection(layer->getDrawRect(), clipRect));814 IntRect dirtyRect = toWindowCoordinates(intersection(layer->getDrawRect(), clipRect)); 803 815 m_lastRenderingResults.addDirtyRect(dirtyRect); 804 816 } -
trunk/Source/WebCore/platform/graphics/blackberry/LayerRenderer.h
r145953 r146906 127 127 void setNeedsCommit() { m_needsCommit = true; } 128 128 129 IntRect toWebKitWindowCoordinates(const FloatRect&) const; 130 IntRect toWebKitDocumentCoordinates(const FloatRect&) const; 129 IntRect toWindowCoordinates(const FloatRect&) const; 130 IntRect toPixelViewportCoordinates(const FloatRect&) const; 131 IntRect toDocumentViewportCoordinates(const FloatRect&) const; 131 132 132 133 // If the layer has already been drawed on a surface. -
trunk/Source/WebKit/blackberry/Api/WebOverlay.cpp
r146058 r146906 627 627 { 628 628 if (LayerRenderer* renderer = m_layerCompositingThread->layerRenderer()) 629 return renderer->to WebKitWindowCoordinates(m_layerCompositingThread->getDrawRect());629 return renderer->toPixelViewportCoordinates(m_layerCompositingThread->getDrawRect()); 630 630 631 631 return Platform::IntRect(); -
trunk/Source/WebKit/blackberry/ChangeLog
r146865 r146906 1 2013-03-26 Arvid Nilsson <anilsson@rim.com> 2 3 [BlackBerry] WebOverlay::pixelViewportRect() should return pixel viewport coordinates 4 https://bugs.webkit.org/show_bug.cgi?id=113263 5 6 Reviewed by Rob Buis. 7 8 PR 312404 9 10 Fixed by returning pixel viewport coordinates instead of window 11 coordinates. 12 13 * Api/WebOverlay.cpp: 14 (BlackBerry::WebKit::WebOverlayPrivateCompositingThread::pixelViewportRect): 15 1 16 2013-03-26 Xiaobo Wang <xbwang@torchmobile.com.cn> 2 17
Note: See TracChangeset
for help on using the changeset viewer.