summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.cpp12
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.h3
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h5
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp17
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h3
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp17
6 files changed, 43 insertions, 14 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
index 3ed3aad..f0d9e58 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
@@ -30,6 +30,7 @@
#include "Surface.h"
#include "AndroidLog.h"
+#include "BaseLayerAndroid.h"
#include "ClassTracker.h"
#include "LayerAndroid.h"
#include "GLWebViewState.h"
@@ -140,6 +141,9 @@ void Surface::addLayer(LayerAndroid* layer, const TransformationMatrix& transfor
m_unclippedArea.x(), m_unclippedArea.y(),
m_unclippedArea.width(), m_unclippedArea.height());
}
+
+ if (isBase())
+ m_background = static_cast<BaseLayerAndroid*>(layer)->getBackgroundColor();
}
IntRect Surface::visibleArea()
@@ -250,6 +254,14 @@ bool Surface::isReady()
return m_surfaceBacking->isReady();
}
+bool Surface::isMissingContent()
+{
+ if (!m_surfaceBacking)
+ return true;
+
+ return m_surfaceBacking->isMissingContent();
+}
+
IntRect Surface::computePrepareArea() {
IntRect area;
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h
index 756fabd..d197d43 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.h
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h
@@ -53,6 +53,7 @@ public:
bool drawGL(bool layerTilesDisabled);
void swapTiles();
bool isReady();
+ bool isMissingContent();
void computeTexturesAmount(TexturesResult* result);
@@ -60,7 +61,6 @@ public:
bool needsTexture() { return m_needsTexture; }
bool hasText() { return m_hasText; }
bool isBase();
- void setBackground(Color background) { m_background = background; }
// TilePainter methods
virtual bool paint(Tile* tile, SkCanvas* canvas);
@@ -72,7 +72,6 @@ private:
IntRect visibleArea();
IntRect unclippedArea();
bool singleLayer() { return m_layers.size() == 1; }
- void updateBackground(const Color& background);
bool useAggressiveRendering();
const TransformationMatrix* drawTransform();
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
index b04e462..ec01dbe 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
@@ -59,6 +59,11 @@ public:
return !m_zooming && m_frontTexture->isReady() && m_scale > 0;
}
+ bool isMissingContent()
+ {
+ return !m_zooming && m_frontTexture->isMissingContent();
+ }
+
int nbTextures(IntRect& area, float scale)
{
// TODO: consider the zooming case for the backTexture
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp
index cd5ceef..24e196b 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp
@@ -63,11 +63,8 @@ SurfaceCollection::SurfaceCollection(LayerAndroid* layer)
// set the layersurfaces' update count, to be drawn on painted tiles
unsigned int updateCount = TilesManager::instance()->incWebkitContentUpdates();
- for (unsigned int i = 0; i < m_surfaces.size(); i++) {
+ for (unsigned int i = 0; i < m_surfaces.size(); i++)
m_surfaces[i]->setUpdateCount(updateCount);
- if (m_surfaces[i]->isBase())
- m_surfaces[i]->setBackground(getBackground());
- }
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("SurfaceCollection");
@@ -128,7 +125,7 @@ bool SurfaceCollection::drawGL(const SkRect& visibleRect)
return needsRedraw;
}
-Color SurfaceCollection::getBackground()
+Color SurfaceCollection::getBackgroundColor()
{
return static_cast<BaseLayerAndroid*>(m_compositedRoot)->getBackgroundColor();
}
@@ -156,6 +153,16 @@ bool SurfaceCollection::isReady()
return true;
}
+bool SurfaceCollection::isMissingBackgroundContent()
+{
+ if (!m_compositedRoot)
+ return true;
+
+ // return true when the first surface is missing content (indicating the
+ // entire viewport isn't covered)
+ return m_surfaces[0]->isMissingContent();
+}
+
void SurfaceCollection::computeTexturesAmount(TexturesResult* result)
{
for (unsigned int i = 0; i < m_surfaces.size(); i++)
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h
index 6450c9c..7dfe140 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h
@@ -50,9 +50,10 @@ public:
// Tiled painting methods (executed on groups)
void prepareGL(const SkRect& visibleRect);
bool drawGL(const SkRect& visibleRect);
- Color getBackground();
+ Color getBackgroundColor();
void swapTiles();
bool isReady();
+ bool isMissingBackgroundContent();
void computeTexturesAmount(TexturesResult* result);
// Recursive tree methods (animations, invals, etc)
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
index 91335c7..8c9cad5 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
@@ -224,6 +224,7 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect,
// ===========================================================================
// Don't have a drawing collection, draw white background
Color background = Color::white;
+ bool drawBackground = true;
if (m_drawingCollection) {
bool drawingReady = didCollectionSwap || m_drawingCollection->isReady();
@@ -245,17 +246,21 @@ int SurfaceCollectionManager::drawGL(double currentTime, IntRect& viewRect,
m_drawingCollection->evaluateAnimations(currentTime);
ALOGV("drawing collection %p", m_drawingCollection);
- background = m_drawingCollection->getBackground();
+ background = m_drawingCollection->getBackgroundColor();
+ drawBackground = m_drawingCollection->isMissingBackgroundContent();
} else if (m_paintingCollection) {
// Use paintingCollection background color while tiles are not done painting.
- background = m_paintingCollection->getBackground();
+ background = m_paintingCollection->getBackgroundColor();
}
// Start doing the actual GL drawing.
- ALOGV("background is %x", background.rgb());
- // If background is opaque, we can safely and efficiently clear it here.
- // Otherwise, we have to calculate all the missing tiles and blend the background.
- GLUtils::clearBackgroundIfOpaque(&background);
+ if (drawBackground) {
+ ALOGV("background is %x", background.rgb());
+ // If background is opaque, we can safely and efficiently clear it here.
+ // Otherwise, we have to calculate all the missing tiles and blend the background.
+ GLUtils::clearBackgroundIfOpaque(&background);
+ }
+
if (m_drawingCollection && m_drawingCollection->drawGL(visibleRect))
returnFlags |= uirenderer::DrawGlInfo::kStatusDraw;