summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp14
-rw-r--r--Source/WebCore/platform/graphics/android/layers/LayerAndroid.h2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp8
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/GLUtils.h1
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp3
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.cpp7
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.h2
7 files changed, 26 insertions, 11 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
index 5655ef6..aef53a2 100644
--- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
@@ -772,16 +772,21 @@ IntRect LayerAndroid::fullContentArea()
return area;
}
-IntRect LayerAndroid::visibleContentArea()
+IntRect LayerAndroid::visibleContentArea(bool force3dContentVisible)
{
IntRect area = fullContentArea();
if (subclassType() == LayerAndroid::FixedBackgroundBaseLayer)
return area;
+
+ // If transform isn't limited to 2D space, return the entire content area.
+ // Transforming from layers to content coordinates and back doesn't
+ // preserve 3D.
+ if (force3dContentVisible && GLUtils::has3dTransform(m_drawTransform))
+ return area;
+
// First, we get the transformed area of the layer,
// in content coordinates
IntRect rect = m_drawTransform.mapRect(area);
- int dx = rect.x();
- int dy = rect.y();
// Then we apply the clipping
IntRect clip(m_clippingRect);
@@ -792,8 +797,7 @@ IntRect LayerAndroid::visibleContentArea()
rect.intersect(contentViewport);
// Finally, let's return the visible area, in layers coordinate
- rect.move(-dx, -dy);
- return rect;
+ return m_drawTransform.inverse().mapRect(rect);
}
bool LayerAndroid::drawCanvas(SkCanvas* canvas, bool drawChildren, PaintStyle style)
diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h
index 170ef41..b6e5e5b 100644
--- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h
@@ -141,7 +141,7 @@ public:
bool outsideViewport();
IntRect fullContentArea();
- IntRect visibleContentArea();
+ IntRect visibleContentArea(bool force3dContentVisible = false);
virtual bool needsTexture();
diff --git a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
index 32f353c..19dc1f8 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/GLUtils.cpp
@@ -107,6 +107,14 @@ void GLUtils::setOrthographicMatrix(TransformationMatrix& ortho, float left, flo
ortho.setM43(-(nearZ + farZ) / deltaZ);
}
+bool GLUtils::has3dTransform(const TransformationMatrix& matrix)
+{
+ return matrix.m13() != 0 || matrix.m23() != 0
+ || matrix.m31() != 0 || matrix.m32() != 0
+ || matrix.m33() != 1 || matrix.m34() != 0
+ || matrix.m43() != 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// GL & EGL error checks
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/Source/WebCore/platform/graphics/android/rendering/GLUtils.h b/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
index 1b69d6c..c2dec7d 100644
--- a/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
+++ b/Source/WebCore/platform/graphics/android/rendering/GLUtils.h
@@ -56,6 +56,7 @@ public:
static void toSkMatrix(SkMatrix& skmatrix, const TransformationMatrix& matrix);
static void setOrthographicMatrix(TransformationMatrix& ortho, float left, float top,
float right, float bottom, float nearZ, float farZ);
+ static bool has3dTransform(const TransformationMatrix& matrix);
// GL & EGL error checks
static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE);
diff --git a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp
index 5098b4b..2ec78d2 100644
--- a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp
@@ -239,7 +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 visibleContentArea = m_layer->visibleContentArea();
+ bool force3dContentVisible = true;
+ IntRect visibleContentArea = m_layer->visibleContentArea(force3dContentVisible);
m_tileGrid->drawGL(visibleContentArea, opacity, transform());
}
m_layer = 0;
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
index 2617bae..173b8af 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
@@ -152,10 +152,10 @@ void Surface::addLayer(LayerAndroid* layer, const TransformationMatrix& transfor
m_background = static_cast<BaseLayerAndroid*>(layer)->getBackgroundColor();
}
-IntRect Surface::visibleContentArea()
+IntRect Surface::visibleContentArea(bool force3dContentVisible)
{
if (singleLayer())
- return getFirstLayer()->visibleContentArea();
+ return getFirstLayer()->visibleContentArea(force3dContentVisible);
IntRect rect = m_fullContentArea;
@@ -246,7 +246,8 @@ 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 = visibleContentArea();
+ bool force3dContentVisible = true;
+ IntRect drawArea = visibleContentArea(force3dContentVisible);
m_surfaceBacking->drawGL(drawArea, opacity(), drawTransform(),
useAggressiveRendering(), background());
}
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h
index 50839ee..bd1d21c 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.h
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h
@@ -71,7 +71,7 @@ public:
private:
IntRect computePrepareArea();
- IntRect visibleContentArea();
+ IntRect visibleContentArea(bool force3dContentVisible = false);
IntRect fullContentArea();
bool singleLayer() { return m_layers.size() == 1; }
bool useAggressiveRendering();