diff options
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering')
15 files changed, 167 insertions, 156 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/GLExtras.cpp b/Source/WebCore/platform/graphics/android/rendering/GLExtras.cpp index 6498ecf..2c114d6 100644 --- a/Source/WebCore/platform/graphics/android/rendering/GLExtras.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/GLExtras.cpp @@ -42,7 +42,7 @@ GLExtras::GLExtras() : m_drawExtra(0) - , m_viewport() + , m_visibleContentRect() { } diff --git a/Source/WebCore/platform/graphics/android/rendering/GLExtras.h b/Source/WebCore/platform/graphics/android/rendering/GLExtras.h index 59a7c3c..e9f697a 100644 --- a/Source/WebCore/platform/graphics/android/rendering/GLExtras.h +++ b/Source/WebCore/platform/graphics/android/rendering/GLExtras.h @@ -43,7 +43,10 @@ public: void drawGL(const LayerAndroid* layer); void setDrawExtra(android::DrawExtra* extra) { m_drawExtra = extra; } - void setViewport(const SkRect & viewport) { m_viewport = viewport; } + void setVisibleContentRect(const SkRect & visibleContentRect) + { + m_visibleContentRect = visibleContentRect; + } void drawRegion(const SkRegion& region, bool fill, bool drawBorder, const TransformationMatrix* drawMat, Color color = COLOR_HOLO_LIGHT); @@ -52,7 +55,7 @@ private: void drawRing(SkRect& srcRect, Color color, const TransformationMatrix* drawMat); android::DrawExtra* m_drawExtra; - SkRect m_viewport; + SkRect m_visibleContentRect; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp index 6e4a82c..5098b4b 100644 --- a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp @@ -150,8 +150,8 @@ int ImageTexture::nbTextures() // TODO: take in account the visible clip (need to maintain // a list of the clients layer, etc.) - IntRect visibleArea(0, 0, m_image->width(), m_image->height()); - int nbTextures = m_tileGrid->nbTextures(visibleArea, 1.0); + IntRect visibleContentArea(0, 0, m_image->width(), m_image->height()); + int nbTextures = m_tileGrid->nbTextures(visibleContentArea, 1.0); ALOGV("ImageTexture %p, %d x %d needs %d textures", this, m_image->width(), m_image->height(), nbTextures); @@ -184,8 +184,8 @@ bool ImageTexture::prepareGL(GLWebViewState* state) if (!m_tileGrid) return false; - IntRect unclippedArea(0, 0, m_image->width(), m_image->height()); - m_tileGrid->prepareGL(state, 1.0, unclippedArea, unclippedArea, this); + IntRect fullContentArea(0, 0, m_image->width(), m_image->height()); + m_tileGrid->prepareGL(state, 1.0, fullContentArea, fullContentArea, this); if (m_tileGrid->isReady()) { m_tileGrid->swapTiles(); return false; @@ -198,7 +198,7 @@ const TransformationMatrix* ImageTexture::transform() if (!m_layer) return 0; - IntRect layerArea = m_layer->unclippedArea(); + IntRect layerArea = m_layer->fullContentArea(); float scaleW = static_cast<float>(layerArea.width()) / static_cast<float>(m_image->width()); float scaleH = static_cast<float>(layerArea.height()) / static_cast<float>(m_image->height()); TransformationMatrix d = *(m_layer->drawTransform()); @@ -239,8 +239,8 @@ void ImageTexture::drawGL(LayerAndroid* layer, float opacity) // transform and opacity, so we need to set m_layer m_layer = layer; if (m_tileGrid) { - IntRect visibleArea = m_layer->visibleArea(); - m_tileGrid->drawGL(visibleArea, opacity, transform()); + IntRect visibleContentArea = m_layer->visibleContentArea(); + m_tileGrid->drawGL(visibleContentArea, opacity, transform()); } m_layer = 0; } diff --git a/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp index 423947f..70a1afe 100644 --- a/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp @@ -370,37 +370,46 @@ void ShaderProgram::setBlendingState(bool enableBlending) // Drawing ///////////////////////////////////////////////////////////////////////////////////////// -// We have multiple coordinates to deal with, each could be inverted Y or not, and -// each could be local to webview or global to the screen. -// viewRect - global screen coordinates starting from lower left. -// visibleRect - local document coordinates starting from upper left. -// webViewRect - inverted global screen coordinates starting from upper left. -// screenClip - inverted global screen coordinates starting from upper left. +// We have multiple coordinates to deal with: first is the screen coordinates, +// second is the view coordinates and the last one is content(document) coordinates. +// Both screen and view coordinates are in pixels. +// All these coordinates start from upper left, but for the purpose of OpenGL +// operations, we may need a inverted Y version of such coordinates which +// start from lower left. +// +// invScreenRect - inv screen coordinates starting from lower left. +// visibleContentRect - local content(document) coordinates starting from upper left. +// screenRect - screen coordinates starting from upper left. +// screenClip - screen coordinates starting from upper left. // ------------------------------------------ -// |(origin of inv global screen) | +// |(origin of screen) | // |screen | // | --------------------------------- | -// | | (origin of inv local screen) | | +// | | (origin of view) | | // | | webview | | // | | -------- | | // | | | clip | | | // | | | | | | // | | -------- | | // | | | | -// | |(origin of local screen) | | +// | |(origin of inv view) | | // | --------------------------------- | -// |(origin of global screen) | +// |(origin of inv screen) | // ------------------------------------------ -void ShaderProgram::setupDrawing(const IntRect& viewRect, const SkRect& visibleRect, - const IntRect& webViewRect, int titleBarHeight, +void ShaderProgram::setupDrawing(const IntRect& invScreenRect, + const SkRect& visibleContentRect, + const IntRect& screenRect, int titleBarHeight, const IntRect& screenClip, float scale) { - m_webViewRect = webViewRect; + m_screenRect = screenRect; m_titleBarHeight = titleBarHeight; //// viewport //// - GLUtils::setOrthographicMatrix(m_visibleRectProjectionMatrix, visibleRect.fLeft, - visibleRect.fTop, visibleRect.fRight, visibleRect.fBottom, + GLUtils::setOrthographicMatrix(m_visibleContentRectProjectionMatrix, + visibleContentRect.fLeft, + visibleContentRect.fTop, + visibleContentRect.fRight, + visibleContentRect.fBottom, -1000, 1000); ALOGV("set m_clipProjectionMatrix, %d, %d, %d, %d", @@ -408,7 +417,7 @@ void ShaderProgram::setupDrawing(const IntRect& viewRect, const SkRect& visibleR screenClip.y() + screenClip.height()); // In order to incorporate the animation delta X and Y, using the clip as - // the GL viewport can save all the trouble of re-position from webViewRect + // the GL viewport can save all the trouble of re-position from screenRect // to final position. GLUtils::setOrthographicMatrix(m_clipProjectionMatrix, screenClip.x(), screenClip.y(), screenClip.x() + screenClip.width(), @@ -417,48 +426,45 @@ void ShaderProgram::setupDrawing(const IntRect& viewRect, const SkRect& visibleR glViewport(screenClip.x(), m_targetHeight - screenClip.y() - screenClip.height() , screenClip.width(), screenClip.height()); - m_viewport = visibleRect; + m_visibleContentRect = visibleContentRect; m_currentScale = scale; //// viewRect //// - m_viewRect = viewRect; - - // The following matrices transform document coordinates into screen coordinates - // and inv screen coordinates, and they are local to the webview in terms of - // coordinate origins. - // Note that GLUtils::setOrthographicMatrix is inverting the Y. So screen - // coordinates is starting from lower left, and inverted screen coordinates - // is from upper left. + m_invScreenRect = invScreenRect; + + // The following matrices transform content coordinates into view coordinates + // and inv view coordinates. + // Note that GLUtils::setOrthographicMatrix is inverting the Y. TransformationMatrix viewTranslate; viewTranslate.translate(1.0, 1.0); TransformationMatrix viewScale; - viewScale.scale3d(m_viewRect.width() * 0.5f, m_viewRect.height() * 0.5f, 1); + viewScale.scale3d(m_invScreenRect.width() * 0.5f, m_invScreenRect.height() * 0.5f, 1); - m_documentToScreenMatrix = viewScale * viewTranslate * m_visibleRectProjectionMatrix; + m_contentToInvViewMatrix = viewScale * viewTranslate * m_visibleContentRectProjectionMatrix; viewTranslate.scale3d(1, -1, 1); - m_documentToInvScreenMatrix = viewScale * viewTranslate * m_visibleRectProjectionMatrix; + m_contentToViewMatrix = viewScale * viewTranslate * m_visibleContentRectProjectionMatrix; - IntRect rect(0, 0, m_webViewRect.width(), m_webViewRect.height()); - m_documentViewport = m_documentToScreenMatrix.inverse().mapRect(rect); + IntRect invViewRect(0, 0, m_screenRect.width(), m_screenRect.height()); + m_contentViewport = m_contentToInvViewMatrix.inverse().mapRect(invViewRect); //// clipping //// - IntRect mclip = screenClip; + IntRect viewClip = screenClip; - // The incoming screenClip is in inverted global screen coordinates, we first - // translate it into inverted local screen coordinates. - // Then we convert it into local screen coordinates. + // The incoming screenClip is in screen coordinates, we first + // translate it into view coordinates. + // Then we convert it into inverted view coordinates. // Therefore, in the clip() function, we need to convert things back from - // local screen coordinates to global screen coordinates. - mclip.setX(screenClip.x() - m_webViewRect.x()); - mclip.setY(screenClip.y() - m_webViewRect.y() - m_titleBarHeight); - FloatRect tclip = convertInvScreenCoordToScreenCoord(mclip); - m_screenClip.setLocation(IntPoint(tclip.x(), tclip.y())); + // inverted view coordinates to inverted screen coordinates which is used by GL. + viewClip.setX(screenClip.x() - m_screenRect.x()); + viewClip.setY(screenClip.y() - m_screenRect.y() - m_titleBarHeight); + FloatRect invViewClip = convertViewCoordToInvViewCoord(viewClip); + m_invViewClip.setLocation(IntPoint(invViewClip.x(), invViewClip.y())); // use ceilf to handle view -> doc -> view coord rounding errors - m_screenClip.setSize(IntSize(ceilf(tclip.width()), ceilf(tclip.height()))); + m_invViewClip.setSize(IntSize(ceilf(invViewClip.width()), ceilf(invViewClip.height()))); resetBlending(); @@ -509,47 +515,47 @@ ShaderType ShaderProgram::getTextureShaderType(GLenum textureTarget) } // This function transform a clip rect extracted from the current layer -// into a clip rect in screen coordinates -- used by the clipping rects -FloatRect ShaderProgram::rectInScreenCoord(const TransformationMatrix& drawMatrix, const IntSize& size) +// into a clip rect in InvView coordinates -- used by the clipping rects +FloatRect ShaderProgram::rectInInvViewCoord(const TransformationMatrix& drawMatrix, const IntSize& size) { FloatRect srect(0, 0, size.width(), size.height()); - TransformationMatrix renderMatrix = m_documentToScreenMatrix * drawMatrix; + TransformationMatrix renderMatrix = m_contentToInvViewMatrix * drawMatrix; return renderMatrix.mapRect(srect); } // used by the partial screen invals -FloatRect ShaderProgram::rectInInvScreenCoord(const TransformationMatrix& drawMatrix, const IntSize& size) +FloatRect ShaderProgram::rectInViewCoord(const TransformationMatrix& drawMatrix, const IntSize& size) { FloatRect srect(0, 0, size.width(), size.height()); - TransformationMatrix renderMatrix = m_documentToInvScreenMatrix * drawMatrix; + TransformationMatrix renderMatrix = m_contentToViewMatrix * drawMatrix; return renderMatrix.mapRect(srect); } -FloatRect ShaderProgram::rectInInvScreenCoord(const FloatRect& rect) +FloatRect ShaderProgram::rectInViewCoord(const FloatRect& rect) { - return m_documentToInvScreenMatrix.mapRect(rect); + return m_contentToViewMatrix.mapRect(rect); } -FloatRect ShaderProgram::rectInScreenCoord(const FloatRect& rect) +FloatRect ShaderProgram::rectInInvViewCoord(const FloatRect& rect) { - return m_documentToScreenMatrix.mapRect(rect); + return m_contentToInvViewMatrix.mapRect(rect); } -FloatRect ShaderProgram::convertScreenCoordToDocumentCoord(const FloatRect& rect) +FloatRect ShaderProgram::convertInvViewCoordToContentCoord(const FloatRect& rect) { - return m_documentToScreenMatrix.inverse().mapRect(rect); + return m_contentToInvViewMatrix.inverse().mapRect(rect); } -FloatRect ShaderProgram::convertInvScreenCoordToScreenCoord(const FloatRect& rect) +FloatRect ShaderProgram::convertViewCoordToInvViewCoord(const FloatRect& rect) { - FloatRect documentRect = m_documentToInvScreenMatrix.inverse().mapRect(rect); - return rectInScreenCoord(documentRect); + FloatRect visibleContentRect = m_contentToViewMatrix.inverse().mapRect(rect); + return rectInInvViewCoord(visibleContentRect); } -FloatRect ShaderProgram::convertScreenCoordToInvScreenCoord(const FloatRect& rect) +FloatRect ShaderProgram::convertInvViewCoordToViewCoord(const FloatRect& rect) { - FloatRect documentRect = m_documentToScreenMatrix.inverse().mapRect(rect); - return rectInInvScreenCoord(documentRect); + FloatRect visibleContentRect = m_contentToInvViewMatrix.inverse().mapRect(rect); + return rectInViewCoord(visibleContentRect); } // clip is in screen coordinates @@ -568,14 +574,14 @@ void ShaderProgram::clip(const FloatRect& clip) clip.y(), clip.width(), clip.height()); - if (!m_screenClip.isEmpty()) - screenClip.intersect(m_screenClip); + if (!m_invViewClip.isEmpty()) + screenClip.intersect(m_invViewClip); // The previous intersection calculation is using local screen coordinates. // Now we need to convert things from local screen coordinates to global // screen coordinates and pass to the GL functions. - screenClip.setX(screenClip.x() + m_viewRect.x()); - screenClip.setY(screenClip.y() + m_viewRect.y()); + screenClip.setX(screenClip.x() + m_invScreenRect.x()); + screenClip.setY(screenClip.y() + m_invScreenRect.y()); if (screenClip.x() < 0) { int w = screenClip.width(); w += screenClip.x(); @@ -594,10 +600,11 @@ void ShaderProgram::clip(const FloatRect& clip) m_clipRect = clip; } -IntRect ShaderProgram::clippedRectWithViewport(const IntRect& rect, int margin) +IntRect ShaderProgram::clippedRectWithVisibleContentRect(const IntRect& rect, int margin) { - IntRect viewport(m_viewport.fLeft - margin, m_viewport.fTop - margin, - m_viewport.width() + margin, m_viewport.height() + margin); + IntRect viewport(m_visibleContentRect.fLeft - margin, m_visibleContentRect.fTop - margin, + m_visibleContentRect.width() + margin, + m_visibleContentRect.height() + margin); viewport.intersect(rect); return viewport; } @@ -606,7 +613,8 @@ float ShaderProgram::zValue(const TransformationMatrix& drawMatrix, float w, flo { TransformationMatrix modifiedDrawMatrix = drawMatrix; modifiedDrawMatrix.scale3d(w, h, 1); - TransformationMatrix renderMatrix = m_visibleRectProjectionMatrix * modifiedDrawMatrix; + TransformationMatrix renderMatrix = + m_visibleContentRectProjectionMatrix * modifiedDrawMatrix; FloatPoint3D point(0.5, 0.5, 0.0); FloatPoint3D result = renderMatrix.mapPoint(point); return result.z(); diff --git a/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.h b/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.h index 8c9e301..4243e12 100644 --- a/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.h +++ b/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.h @@ -115,8 +115,8 @@ public: void initGLResources(); void cleanupGLResources(); // Drawing - void setupDrawing(const IntRect& viewRect, const SkRect& visibleRect, - const IntRect& webViewRect, int titleBarHeight, + void setupDrawing(const IntRect& invScreenRect, const SkRect& visibleContentRect, + const IntRect& screenRect, int titleBarHeight, const IntRect& screenClip, float scale); float zValue(const TransformationMatrix& drawMatrix, float w, float h); @@ -130,20 +130,20 @@ public: void drawQuad(const DrawQuadData* data); void drawVideoLayerQuad(const TransformationMatrix& drawMatrix, float* textureMatrix, SkRect& geometry, int textureId); - FloatRect rectInScreenCoord(const TransformationMatrix& drawMatrix, + FloatRect rectInInvViewCoord(const TransformationMatrix& drawMatrix, const IntSize& size); - FloatRect rectInInvScreenCoord(const TransformationMatrix& drawMatrix, + FloatRect rectInViewCoord(const TransformationMatrix& drawMatrix, const IntSize& size); - FloatRect rectInInvScreenCoord(const FloatRect& rect); - FloatRect rectInScreenCoord(const FloatRect& rect); - FloatRect convertScreenCoordToDocumentCoord(const FloatRect& rect); - FloatRect convertInvScreenCoordToScreenCoord(const FloatRect& rect); - FloatRect convertScreenCoordToInvScreenCoord(const FloatRect& rect); + FloatRect rectInViewCoord(const FloatRect& rect); + FloatRect rectInInvViewCoord(const FloatRect& rect); + FloatRect convertInvViewCoordToContentCoord(const FloatRect& rect); + FloatRect convertViewCoordToInvViewCoord(const FloatRect& rect); + FloatRect convertInvViewCoordToViewCoord(const FloatRect& rect); void clip(const FloatRect& rect); - IntRect clippedRectWithViewport(const IntRect& rect, int margin = 0); - FloatRect documentViewport() { return m_documentViewport; } + IntRect clippedRectWithVisibleContentRect(const IntRect& rect, int margin = 0); + FloatRect contentViewport() { return m_contentViewport; } float contrast() { return m_contrast; } void setContrast(float c) @@ -185,21 +185,21 @@ private: TransformationMatrix m_surfaceProjectionMatrix; TransformationMatrix m_clipProjectionMatrix; - TransformationMatrix m_visibleRectProjectionMatrix; + TransformationMatrix m_visibleContentRectProjectionMatrix; GLuint m_textureBuffer[1]; - TransformationMatrix m_documentToScreenMatrix; - TransformationMatrix m_documentToInvScreenMatrix; - SkRect m_viewport; - IntRect m_viewRect; + TransformationMatrix m_contentToInvViewMatrix; + TransformationMatrix m_contentToViewMatrix; + SkRect m_visibleContentRect; + IntRect m_invScreenRect; FloatRect m_clipRect; - IntRect m_screenClip; + IntRect m_invViewClip; int m_titleBarHeight; // This is the layout position in screen coordinate and didn't contain the // animation offset. - IntRect m_webViewRect; + IntRect m_screenRect; - FloatRect m_documentViewport; + FloatRect m_contentViewport; float m_contrast; diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp index 652c165..16cad27 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp @@ -45,7 +45,7 @@ #include <wtf/text/CString.h> // Surfaces with an area larger than 2048*2048 should never be unclipped -#define MAX_UNCLIPPED_AREA 4194304 +#define MAX_FULL_CONTENT_AREA 4194304 namespace WebCore { @@ -131,48 +131,48 @@ void Surface::addLayer(LayerAndroid* layer, const TransformationMatrix& transfor m_hasText |= layer->hasText(); // calculate area size for comparison later - IntRect rect = layer->unclippedArea(); + IntRect rect = layer->fullContentArea(); SkPoint pos = layer->getPosition(); rect.setLocation(IntPoint(pos.fX, pos.fY)); if (layer->needsTexture()) { - if (m_unclippedArea.isEmpty()) { + if (m_fullContentArea.isEmpty()) { m_drawTransform = transform; m_drawTransform.translate3d(-pos.fX, -pos.fY, 0); - m_unclippedArea = rect; + m_fullContentArea = rect; } else - m_unclippedArea.unite(rect); + m_fullContentArea.unite(rect); ALOGV("Surf %p adding LA %p, size %d, %d %dx%d, now Surf size %d,%d %dx%d", this, layer, rect.x(), rect.y(), rect.width(), rect.height(), - m_unclippedArea.x(), m_unclippedArea.y(), - m_unclippedArea.width(), m_unclippedArea.height()); + m_fullContentArea.x(), m_fullContentArea.y(), + m_fullContentArea.width(), m_fullContentArea.height()); } if (isBase()) m_background = static_cast<BaseLayerAndroid*>(layer)->getBackgroundColor(); } -IntRect Surface::visibleArea() +IntRect Surface::visibleContentArea() { if (singleLayer()) - return getFirstLayer()->visibleArea(); + return getFirstLayer()->visibleContentArea(); - IntRect rect = m_unclippedArea; + IntRect rect = m_fullContentArea; - // clip with the viewport in documents coordinate - IntRect documentViewport(TilesManager::instance()->shader()->documentViewport()); - rect.intersect(documentViewport); + // clip with the viewport in content coordinate + IntRect contentViewport(TilesManager::instance()->shader()->contentViewport()); + rect.intersect(contentViewport); // TODO: handle recursive layer clip return rect; } -IntRect Surface::unclippedArea() +IntRect Surface::fullContentArea() { if (singleLayer()) - return getFirstLayer()->unclippedArea(); - return m_unclippedArea; + return getFirstLayer()->fullContentArea(); + return m_fullContentArea; } bool Surface::useAggressiveRendering() @@ -203,7 +203,7 @@ void Surface::prepareGL(bool layerTilesDisabled, bool updateWithBlit) } else { bool allowZoom = hasText(); // only allow for scale > 1 if painting vectors IntRect prepareArea = computePrepareArea(); - IntRect fullArea = unclippedArea(); + IntRect fullArea = fullContentArea(); ALOGV("prepareGL on Surf %p with SurfBack %p, %d layers, first layer %s (%d) " "prepareArea(%d, %d - %d x %d) fullArea(%d, %d - %d x %d)", @@ -239,7 +239,7 @@ bool Surface::drawGL(bool layerTilesDisabled) if (!isBaseLayer) { // TODO: why are clipping regions wrong for base layer? FloatRect drawClip = getFirstLayer()->drawClip(); - FloatRect clippingRect = TilesManager::instance()->shader()->rectInScreenCoord(drawClip); + FloatRect clippingRect = TilesManager::instance()->shader()->rectInInvViewCoord(drawClip); TilesManager::instance()->shader()->clip(clippingRect); } @@ -248,7 +248,7 @@ bool Surface::drawGL(bool layerTilesDisabled) ALOGV("drawGL on Surf %p with SurfBack %p, first layer %s (%d)", this, m_surfaceBacking, getFirstLayer()->subclassName().ascii().data(), getFirstLayer()->uniqueId()); - IntRect drawArea = visibleArea(); + IntRect drawArea = visibleContentArea(); m_surfaceBacking->drawGL(drawArea, opacity(), drawTransform(), useAggressiveRendering(), background()); } @@ -312,13 +312,13 @@ IntRect Surface::computePrepareArea() && !isBase() && getFirstLayer()->state()->layersRenderingMode() == GLWebViewState::kAllTextures) { - area = unclippedArea(); + area = fullContentArea(); double total = ((double) area.width()) * ((double) area.height()); - if (total > MAX_UNCLIPPED_AREA) - area = visibleArea(); + if (total > MAX_FULL_CONTENT_AREA) + area = visibleContentArea(); } else - area = visibleArea(); + area = visibleContentArea(); return area; } diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h index dc46fcf..50839ee 100644 --- a/Source/WebCore/platform/graphics/android/rendering/Surface.h +++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h @@ -71,13 +71,13 @@ public: private: IntRect computePrepareArea(); - IntRect visibleArea(); - IntRect unclippedArea(); + IntRect visibleContentArea(); + IntRect fullContentArea(); bool singleLayer() { return m_layers.size() == 1; } bool useAggressiveRendering(); const TransformationMatrix* drawTransform(); - IntRect m_unclippedArea; + IntRect m_fullContentArea; TransformationMatrix m_drawTransform; SurfaceBacking* m_surfaceBacking; diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp index 957aa63..af96560 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp @@ -56,7 +56,7 @@ SurfaceBacking::~SurfaceBacking() } void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, - const IntRect& prepareArea, const IntRect& unclippedArea, + const IntRect& prepareArea, const IntRect& fullContentArea, TilePainter* painter, bool aggressiveRendering, bool updateWithBlit) { @@ -89,7 +89,7 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, if (m_zooming && (m_zoomUpdateTime < WTF::currentTime())) { // prepare the visible portions of the back tile grid at the futureScale m_backTileGrid->prepareGL(state, m_futureScale, - prepareArea, unclippedArea, painter, + prepareArea, fullContentArea, painter, TileGrid::StandardRegion, false); if (m_backTileGrid->isReady()) { @@ -114,29 +114,29 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom, // if the front grid hasn't already prepared, or needs to prepare // expanded bounds do so now m_frontTileGrid->prepareGL(state, m_scale, - prepareArea, unclippedArea, painter, + prepareArea, fullContentArea, painter, prepareRegionFlags, false, updateWithBlit); } if (aggressiveRendering) { // prepare low res content float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER; m_lowResTileGrid->prepareGL(state, lowResPrefetchScale, - prepareArea, unclippedArea, painter, + prepareArea, fullContentArea, painter, TileGrid::StandardRegion | TileGrid::ExpandedRegion, true); m_lowResTileGrid->swapTiles(); } } } -void SurfaceBacking::drawGL(const IntRect& visibleArea, float opacity, +void SurfaceBacking::drawGL(const IntRect& visibleContentArea, float opacity, const TransformationMatrix* transform, bool aggressiveRendering, const Color* background) { // draw low res prefetch page if zooming or front texture missing content if (aggressiveRendering && isMissingContent()) - m_lowResTileGrid->drawGL(visibleArea, opacity, transform); + m_lowResTileGrid->drawGL(visibleContentArea, opacity, transform); - m_frontTileGrid->drawGL(visibleArea, opacity, transform, background); + m_frontTileGrid->drawGL(visibleContentArea, opacity, transform, background); } void SurfaceBacking::markAsDirty(const SkRegion& dirtyArea) @@ -159,14 +159,14 @@ void SurfaceBacking::computeTexturesAmount(TexturesResult* result, LayerAndroid* if (!layer) return; - IntRect unclippedArea = layer->unclippedArea(); - IntRect clippedVisibleArea = layer->visibleArea(); + IntRect fullContentArea = layer->fullContentArea(); + IntRect clippedVisibleArea = layer->visibleContentArea(); // get two numbers here: // - textures needed for a clipped area // - textures needed for an un-clipped area TileGrid* tileGrid = m_zooming ? m_backTileGrid : m_frontTileGrid; - int nbTexturesUnclipped = tileGrid->nbTextures(unclippedArea, m_scale); + int nbTexturesUnclipped = tileGrid->nbTextures(fullContentArea, m_scale); int nbTexturesClipped = tileGrid->nbTextures(clippedVisibleArea, m_scale); // Set kFixedLayers level diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h index 08cfc7c..7d3e93c 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h @@ -41,11 +41,11 @@ public: SurfaceBacking(bool isBaseSurface); ~SurfaceBacking(); void prepareGL(GLWebViewState* state, bool allowZoom, - const IntRect& prepareArea, const IntRect& unclippedArea, + const IntRect& prepareArea, const IntRect& fullContentArea, TilePainter* painter, bool aggressiveRendering, bool updateWithBlit); void swapTiles(); - void drawGL(const IntRect& visibleArea, float opacity, + void drawGL(const IntRect& visibleContentArea, float opacity, const TransformationMatrix* transform, bool aggressiveRendering, const Color* background); void markAsDirty(const SkRegion& dirtyArea); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp index cf59044..0bdbf38 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp @@ -83,9 +83,9 @@ SurfaceCollection::~SurfaceCollection() #endif } -void SurfaceCollection::prepareGL(const SkRect& visibleRect) +void SurfaceCollection::prepareGL(const SkRect& visibleContentRect) { - updateLayerPositions(visibleRect); + updateLayerPositions(visibleContentRect); bool layerTilesDisabled = m_compositedRoot->state()->layersRenderingMode() > GLWebViewState::kClippedTextures; bool updateWithBlit = true; @@ -109,14 +109,14 @@ static inline bool compareSurfaceZ(const Surface* a, const Surface* b) return (la->zValue() > lb->zValue()) && (la->getParent() == lb->getParent()); } -bool SurfaceCollection::drawGL(const SkRect& visibleRect) +bool SurfaceCollection::drawGL(const SkRect& visibleContentRect) { #ifdef DEBUG_COUNT ClassTracker::instance()->show(); #endif bool needsRedraw = false; - updateLayerPositions(visibleRect); + updateLayerPositions(visibleContentRect); bool layerTilesDisabled = m_compositedRoot->state()->layersRenderingMode() > GLWebViewState::kClippedTextures; @@ -231,10 +231,10 @@ void SurfaceCollection::updateScrollableLayer(int layerId, int x, int y) static_cast<ScrollableLayerAndroid*>(layer)->scrollTo(x, y); } -void SurfaceCollection::updateLayerPositions(const SkRect& visibleRect) +void SurfaceCollection::updateLayerPositions(const SkRect& visibleContentRect) { TransformationMatrix ident; - m_compositedRoot->updateLayerPositions(visibleRect); + m_compositedRoot->updateLayerPositions(visibleContentRect); FloatRect clip(0, 0, 1e10, 1e10); m_compositedRoot->updateGLPositionsAndScale( ident, clip, 1, m_compositedRoot->state()->scale()); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h index 7dfe140..5cfd943 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h @@ -48,8 +48,8 @@ public: virtual ~SurfaceCollection(); // Tiled painting methods (executed on groups) - void prepareGL(const SkRect& visibleRect); - bool drawGL(const SkRect& visibleRect); + void prepareGL(const SkRect& visibleContentRect); + bool drawGL(const SkRect& visibleContentRect); Color getBackgroundColor(); void swapTiles(); bool isReady(); @@ -67,7 +67,7 @@ public: void updateScrollableLayer(int layerId, int x, int y); private: - void updateLayerPositions(const SkRect& visibleRect); + void updateLayerPositions(const SkRect& visibleContentRect); LayerAndroid* m_compositedRoot; WTF::Vector<Surface*> m_surfaces; }; diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp index 52a8e44..b26be03 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp @@ -154,7 +154,7 @@ void SurfaceCollectionManager::updateScrollableLayer(int layerId, int x, int y) } int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, - SkRect& visibleRect, float scale, + SkRect& visibleContentRect, float scale, bool enterFastSwapMode, bool* collectionsSwappedPtr, bool* newCollectionHasAnimPtr, TexturesResult* texturesResultPtr, bool shouldDraw) @@ -171,7 +171,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, m_paintingCollection->evaluateAnimations(currentTime); - m_paintingCollection->prepareGL(visibleRect); + m_paintingCollection->prepareGL(visibleContentRect); m_paintingCollection->computeTexturesAmount(texturesResultPtr); if (!TilesManager::instance()->useDoubleBuffering() || m_paintingCollection->isReady()) { @@ -186,7 +186,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, } } else if (m_drawingCollection) { ALOGV("preparing drawing collection %p", m_drawingCollection); - m_drawingCollection->prepareGL(visibleRect); + m_drawingCollection->prepareGL(visibleContentRect); m_drawingCollection->computeTexturesAmount(texturesResultPtr); } @@ -254,7 +254,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect, GLUtils::clearBackgroundIfOpaque(&background); } - if (m_drawingCollection && m_drawingCollection->drawGL(visibleRect)) + if (m_drawingCollection && m_drawingCollection->drawGL(visibleContentRect)) returnFlags |= uirenderer::DrawGlInfo::kStatusDraw; ALOGV("returnFlags %d, m_paintingCollection %d ", returnFlags, m_paintingCollection); diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h index 125bf02..be4fbca 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h @@ -50,7 +50,7 @@ public: void updateScrollableLayer(int layerId, int x, int y); int drawGL(double currentTime, IntRect& viewRect, - SkRect& visibleRect, float scale, + SkRect& visibleContentRect, float scale, bool enterFastSwapMode, bool* collectionsSwappedPtr, bool* newCollectionHasAnimPtr, TexturesResult* texturesResultPtr, bool shouldDraw); diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp index bee42ae..7680fc9 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp @@ -135,7 +135,7 @@ IntRect TileGrid::computeTilesArea(const IntRect& contentArea, float scale) } void TileGrid::prepareGL(GLWebViewState* state, float scale, - const IntRect& prepareArea, const IntRect& unclippedArea, + const IntRect& prepareArea, const IntRect& fullContentArea, TilePainter* painter, int regionFlags, bool isLowResPrefetch, bool updateWithBlit) { @@ -193,7 +193,7 @@ void TileGrid::prepareGL(GLWebViewState* state, float scale, } if (regionFlags & ExpandedRegion) { - IntRect fullArea = computeTilesArea(unclippedArea, scale); + IntRect fullArea = computeTilesArea(fullContentArea, scale); IntRect expandedArea = m_area; // on systems reporting highEndGfx=true and useMinimalMemory not set, use expanded bounds @@ -285,11 +285,11 @@ int TileGrid::nbTextures(IntRect& area, float scale) return numberTextures; } -void TileGrid::drawGL(const IntRect& visibleArea, float opacity, +void TileGrid::drawGL(const IntRect& visibleContentArea, float opacity, const TransformationMatrix* transform, const Color* background) { - m_area = computeTilesArea(visibleArea, m_scale); + m_area = computeTilesArea(visibleContentArea, m_scale); if (m_area.width() == 0 || m_area.height() == 0) return; @@ -311,10 +311,10 @@ void TileGrid::drawGL(const IntRect& visibleArea, float opacity, bool usePointSampling = TilesManager::instance()->shader()->usePointSampling(m_scale, transform); - float minTileX = visibleArea.x() / tileWidth; - float minTileY = visibleArea.y() / tileWidth; - float maxTileWidth = visibleArea.maxX() / tileWidth; - float maxTileHeight = visibleArea.maxY() / tileWidth; + float minTileX = visibleContentArea.x() / tileWidth; + float minTileY = visibleContentArea.y() / tileWidth; + float maxTileWidth = visibleContentArea.maxX() / tileWidth; + float maxTileHeight = visibleContentArea.maxY() / tileWidth; ALOGV("minTileX, minTileY, maxTileWidth, maxTileHeight %f, %f, %f %f", minTileX, minTileY, maxTileWidth, maxTileHeight); for (unsigned int i = 0; i < m_tiles.size(); i++) { diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.h b/Source/WebCore/platform/graphics/android/rendering/TileGrid.h index e412979..b480419 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.h +++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.h @@ -49,11 +49,11 @@ public: static IntRect computeTilesArea(const IntRect& contentArea, float scale); void prepareGL(GLWebViewState* state, float scale, - const IntRect& prepareArea, const IntRect& unclippedArea, + const IntRect& prepareArea, const IntRect& fullContentArea, TilePainter* painter, int regionFlags = StandardRegion, bool isLowResPrefetch = false, bool updateWithBlit = false); void swapTiles(); - void drawGL(const IntRect& visibleArea, float opacity, + void drawGL(const IntRect& visibleContentArea, float opacity, const TransformationMatrix* transform, const Color* background = 0); void markAsDirty(const SkRegion& dirtyArea); |