summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-03-02 14:53:26 -0800
committerChris Craik <ccraik@google.com>2012-03-02 15:42:06 -0800
commite6a08abad427194f5eb95ba75b77211fa8498997 (patch)
tree4a9216322806398f961b5edc1f18ebb8181bd39a /Source/WebCore/platform/graphics
parenta5814187e4b55a2682707ab4d69cdb586c0a9210 (diff)
downloadexternal_webkit-e6a08abad427194f5eb95ba75b77211fa8498997.zip
external_webkit-e6a08abad427194f5eb95ba75b77211fa8498997.tar.gz
external_webkit-e6a08abad427194f5eb95ba75b77211fa8498997.tar.bz2
Pass transform matrix in draw instead of through painter
bug:6105013 Since BaseTile's painter pointer may be stale, pass transform through draw rename transparency->opacity where needed added const for drawing path rects Change-Id: Ie08cef63c656e95887a3230af18b5b6a4513c10d
Diffstat (limited to 'Source/WebCore/platform/graphics')
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.cpp5
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.h5
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTileTexture.cpp16
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTileTexture.h4
-rw-r--r--Source/WebCore/platform/graphics/android/ImageTexture.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/ImageTexture.h2
-rw-r--r--Source/WebCore/platform/graphics/android/LayerGroup.cpp8
-rw-r--r--Source/WebCore/platform/graphics/android/LayerGroup.h1
-rw-r--r--Source/WebCore/platform/graphics/android/ShaderProgram.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/ShaderProgram.h2
-rw-r--r--Source/WebCore/platform/graphics/android/TilePainter.h1
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp8
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.h6
-rw-r--r--Source/WebCore/platform/graphics/android/TiledTexture.cpp10
-rw-r--r--Source/WebCore/platform/graphics/android/TiledTexture.h4
15 files changed, 37 insertions, 39 deletions
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp
index 0990d03..7466d64 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp
@@ -236,7 +236,8 @@ void BaseTile::setRepaintPending(bool pending)
m_repaintPending = pending;
}
-void BaseTile::draw(float transparency, SkRect& rect, float scale)
+void BaseTile::drawGL(float opacity, const SkRect& rect, float scale,
+ const TransformationMatrix* transform)
{
if (m_x < 0 || m_y < 0 || m_scale != scale)
return;
@@ -255,7 +256,7 @@ void BaseTile::draw(float transparency, SkRect& rect, float scale)
return;
if (m_frontTexture->readyFor(this))
- m_frontTexture->draw(isLayerTile(), m_painter, rect, transparency);
+ m_frontTexture->drawGL(isLayerTile(), rect, opacity, transform);
else {
XLOG("tile %p at %d, %d not readyfor (at draw),", this, m_x, m_y);
}
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.h b/Source/WebCore/platform/graphics/android/BaseTile.h
index ed06332..6ba66ef 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.h
+++ b/Source/WebCore/platform/graphics/android/BaseTile.h
@@ -54,7 +54,7 @@ class GLWebViewState;
* the BaseLayer's most recent PictureSet to a bitmap which is then uploaded
* to the GPU.
* 3. After the bitmap is uploaded to the GPU the main GL thread then uses the
- * tile's draw() function to display the tile to the screen.
+ * tile's drawGL() function to display the tile to the screen.
* 4. Steps 2-3 are repeated as necessary.
* 5. The tile is destroyed when the user navigates to a new page.
*
@@ -101,7 +101,8 @@ public:
bool isTileReady();
- void draw(float transparency, SkRect& rect, float scale);
+ void drawGL(float opacity, const SkRect& rect, float scale,
+ const TransformationMatrix* transform);
// the only thread-safe function called by the background thread
void paintBitmap();
diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
index 5e0668e..7c04c74 100644
--- a/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.cpp
@@ -171,23 +171,23 @@ bool BaseTileTexture::readyFor(BaseTile* baseTile)
return false;
}
-void BaseTileTexture::draw(bool isLayer, TilePainter* painter,
- SkRect& rect, float transparency)
+void BaseTileTexture::drawGL(bool isLayer, const SkRect& rect, float opacity,
+ const TransformationMatrix* transform)
{
ShaderProgram* shader = TilesManager::instance()->shader();
- if (isLayer && painter && painter->transform()) {
+ if (isLayer && transform) {
if (isPureColor()) {
- shader->drawLayerQuad(*painter->transform(), rect, 0, transparency,
+ shader->drawLayerQuad(*transform, rect, 0, opacity,
true, GL_TEXTURE_2D, pureColor());
} else {
- shader->drawLayerQuad(*painter->transform(), rect, m_ownTextureId,
- transparency, true);
+ shader->drawLayerQuad(*transform, rect, m_ownTextureId,
+ opacity, true);
}
} else {
if (isPureColor())
- shader->drawQuad(rect, 0,transparency, pureColor());
+ shader->drawQuad(rect, 0, opacity, pureColor());
else
- shader->drawQuad(rect, m_ownTextureId, transparency);
+ shader->drawQuad(rect, m_ownTextureId, opacity);
}
}
diff --git a/Source/WebCore/platform/graphics/android/BaseTileTexture.h b/Source/WebCore/platform/graphics/android/BaseTileTexture.h
index 67eeeb9..3e4f872 100644
--- a/Source/WebCore/platform/graphics/android/BaseTileTexture.h
+++ b/Source/WebCore/platform/graphics/android/BaseTileTexture.h
@@ -103,8 +103,8 @@ public:
void setPureColor(const Color& color) { m_pureColor = color; setPure(true); }
Color pureColor() { return m_pureColor; }
- void draw(bool isLayer, TilePainter* painter, SkRect& rect,
- float transparency);
+ void drawGL(bool isLayer, const SkRect& rect, float opacity,
+ const TransformationMatrix* transform);
private:
TextureTileInfo m_ownTextureTileInfo;
// TODO: Merge this info into the TextureTileInfo.
diff --git a/Source/WebCore/platform/graphics/android/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/ImageTexture.cpp
index c2b70b2..25dd6f3 100644
--- a/Source/WebCore/platform/graphics/android/ImageTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/ImageTexture.cpp
@@ -255,7 +255,7 @@ void ImageTexture::drawGL(LayerAndroid* layer, float opacity)
m_layer = layer;
if (m_texture) {
IntRect visibleArea = m_layer->visibleArea();
- m_texture->drawGL(visibleArea, opacity);
+ m_texture->drawGL(visibleArea, opacity, transform());
}
m_layer = 0;
}
diff --git a/Source/WebCore/platform/graphics/android/ImageTexture.h b/Source/WebCore/platform/graphics/android/ImageTexture.h
index 9c2c79c..f2f99dd 100644
--- a/Source/WebCore/platform/graphics/android/ImageTexture.h
+++ b/Source/WebCore/platform/graphics/android/ImageTexture.h
@@ -86,7 +86,6 @@ public:
// methods used by TiledTexture
virtual bool paint(BaseTile* tile, SkCanvas* canvas, unsigned int* pictureUsed);
- virtual const TransformationMatrix* transform();
virtual float opacity();
int nbTextures();
@@ -94,6 +93,7 @@ public:
virtual SurfaceType type() { return TilePainter::Image; }
private:
+ const TransformationMatrix* transform();
SkBitmapRef* m_imageRef;
SkBitmap* m_image;
diff --git a/Source/WebCore/platform/graphics/android/LayerGroup.cpp b/Source/WebCore/platform/graphics/android/LayerGroup.cpp
index e9f8967..cb1cf9b 100644
--- a/Source/WebCore/platform/graphics/android/LayerGroup.cpp
+++ b/Source/WebCore/platform/graphics/android/LayerGroup.cpp
@@ -128,7 +128,8 @@ bool LayerGroup::drawGL(bool layerTilesDisabled)
if (m_dualTiledTexture && !layerTilesDisabled) {
XLOG("drawGL on LG %p with DTT %p", this, m_dualTiledTexture);
IntRect visibleArea = TEMP_LAYER->visibleArea();
- askRedraw |= m_dualTiledTexture->drawGL(visibleArea, opacity());
+ const TransformationMatrix* transform = TEMP_LAYER->drawTransform();
+ askRedraw |= m_dualTiledTexture->drawGL(visibleArea, opacity(), transform);
}
askRedraw |= TEMP_LAYER->drawGL(layerTilesDisabled);
@@ -190,11 +191,6 @@ bool LayerGroup::paint(BaseTile* tile, SkCanvas* canvas, unsigned int* pictureUs
return true;
}
-const TransformationMatrix* LayerGroup::transform()
-{
- return TEMP_LAYER->drawTransform();
-}
-
float LayerGroup::opacity()
{
return TEMP_LAYER->getOpacity();
diff --git a/Source/WebCore/platform/graphics/android/LayerGroup.h b/Source/WebCore/platform/graphics/android/LayerGroup.h
index 1b90f4b..0546139 100644
--- a/Source/WebCore/platform/graphics/android/LayerGroup.h
+++ b/Source/WebCore/platform/graphics/android/LayerGroup.h
@@ -58,7 +58,6 @@ public:
// TilePainter methods
virtual bool paint(BaseTile* tile, SkCanvas* canvas, unsigned int* pictureUsed);
- virtual const TransformationMatrix* transform();
virtual float opacity();
private:
bool m_hasText;
diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
index ba728ad..b09701b 100644
--- a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
+++ b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
@@ -483,7 +483,7 @@ ShaderType ShaderProgram::getTextureShaderType(GLenum textureTarget)
return type;
}
-void ShaderProgram::drawQuad(SkRect& geometry, int textureId, float opacity,
+void ShaderProgram::drawQuad(const SkRect& geometry, int textureId, float opacity,
Color pureColor, GLenum textureTarget, GLint texFilter)
{
ShaderType type = UndefinedShader;
diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.h b/Source/WebCore/platform/graphics/android/ShaderProgram.h
index 5a0c52b..98d45b5 100644
--- a/Source/WebCore/platform/graphics/android/ShaderProgram.h
+++ b/Source/WebCore/platform/graphics/android/ShaderProgram.h
@@ -118,7 +118,7 @@ public:
// Surface texture in GL_TEXTURE_EXTERNAL_OES target.
// 3) textureId == 0
// No texture needed, just a pureColor quad.
- void drawQuad(SkRect& geometry, int textureId, float opacity, Color pureColor = Color(),
+ void drawQuad(const SkRect& geometry, int textureId, float opacity, Color pureColor = Color(),
GLenum textureTarget = GL_TEXTURE_2D,
GLint texFilter = GL_LINEAR);
void drawLayerQuad(const TransformationMatrix& drawMatrix,
diff --git a/Source/WebCore/platform/graphics/android/TilePainter.h b/Source/WebCore/platform/graphics/android/TilePainter.h
index 04d8bf0..e2ae66c 100644
--- a/Source/WebCore/platform/graphics/android/TilePainter.h
+++ b/Source/WebCore/platform/graphics/android/TilePainter.h
@@ -40,7 +40,6 @@ class TilePainter : public SkRefCnt {
public:
virtual ~TilePainter() { }
virtual bool paint(BaseTile* tile, SkCanvas*, unsigned int*) = 0;
- virtual const TransformationMatrix* transform() { return 0; }
virtual float opacity() { return 1.0; }
enum SurfaceType { Painted, Image };
virtual SurfaceType type() { return Painted; }
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index cd23a7f..820cd56 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -352,16 +352,16 @@ bool TiledPage::swapBuffersIfReady(const SkIRect& tileBounds, float scale)
return fullSwap;
}
-void TiledPage::prepareForDrawGL(float transparency, const SkIRect& tileBounds)
+void TiledPage::prepareForDrawGL(float opacity, const SkIRect& tileBounds)
{
m_willDraw = true;
- m_transparency = transparency;
+ m_opacity = opacity;
m_tileBounds = tileBounds;
}
void TiledPage::drawGL()
{
- if (!m_glWebViewState || m_transparency == 0 || !m_willDraw)
+ if (!m_glWebViewState || m_opacity == 0 || !m_willDraw)
return;
const float tileWidth = TilesManager::tileWidth() * m_invScale;
@@ -377,7 +377,7 @@ void TiledPage::drawGL()
rect.fRight = rect.fLeft + tileWidth;
rect.fBottom = rect.fTop + tileHeight;
- tile.draw(m_transparency, rect, m_scale);
+ tile.drawGL(m_opacity, rect, m_scale, 0);
}
TilesManager::instance()->getProfiler()->nextTile(tile, m_invScale, tileInView);
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.h b/Source/WebCore/platform/graphics/android/TiledPage.h
index 791e1f6..e6269ae 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.h
+++ b/Source/WebCore/platform/graphics/android/TiledPage.h
@@ -76,8 +76,8 @@ public:
// swap 'buffers' by swapping each modified texture
bool swapBuffersIfReady(const SkIRect& tileBounds, float scale);
- // save the transparency and bounds to be drawn in drawGL()
- void prepareForDrawGL(float transparency, const SkIRect& tileBounds);
+ // save the opacity and bounds to be drawn in drawGL()
+ void prepareForDrawGL(float opacity, const SkIRect& tileBounds);
// draw the page on the screen
void drawGL();
@@ -132,7 +132,7 @@ private:
// info saved in prepare, used in drawGL()
bool m_willDraw;
SkIRect m_tileBounds;
- float m_transparency;
+ float m_opacity;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.cpp b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
index 31a439d..3edc93c 100644
--- a/Source/WebCore/platform/graphics/android/TiledTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
@@ -225,7 +225,8 @@ int TiledTexture::nbTextures(IntRect& area, float scale)
return numberTextures;
}
-bool TiledTexture::drawGL(IntRect& visibleArea, float opacity)
+bool TiledTexture::drawGL(const IntRect& visibleArea, float opacity,
+ const TransformationMatrix* transform)
{
#ifdef DEBUG
TilesManager::instance()->getTilesTracker()->trackLayer();
@@ -258,7 +259,7 @@ bool TiledTexture::drawGL(IntRect& visibleArea, float opacity)
XLOG("tile %p (layer tile: %d) %d,%d at scale %.2f vs %.2f [ready: %d] dirty: %d",
tile, tile->isLayerTile(), tile->x(), tile->y(),
tile->scale(), m_scale, tile->isTileReady(), tile->isDirty());
- tile->draw(opacity, rect, m_scale);
+ tile->drawGL(opacity, rect, m_scale, transform);
if (tile->frontTexture())
drawn++;
#ifdef DEBUG
@@ -367,9 +368,10 @@ void DualTiledTexture::swap()
m_backTexture->discardTextures();
}
-bool DualTiledTexture::drawGL(IntRect& visibleArea, float opacity)
+bool DualTiledTexture::drawGL(const IntRect& visibleArea, float opacity,
+ const TransformationMatrix* transform)
{
- bool needsRepaint = m_frontTexture->drawGL(visibleArea, opacity);
+ bool needsRepaint = m_frontTexture->drawGL(visibleArea, opacity, transform);
needsRepaint |= m_zooming;
needsRepaint |= (m_scale <= 0);
return needsRepaint;
diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.h b/Source/WebCore/platform/graphics/android/TiledTexture.h
index ee1c28c..cf7c77c 100644
--- a/Source/WebCore/platform/graphics/android/TiledTexture.h
+++ b/Source/WebCore/platform/graphics/android/TiledTexture.h
@@ -61,7 +61,7 @@ public:
void prepareGL(GLWebViewState* state, float scale,
const IntRect& prepareArea, TilePainter* painter);
void swapTiles();
- bool drawGL(IntRect& visibleArea, float opacity);
+ bool drawGL(const IntRect& visibleArea, float opacity, const TransformationMatrix* transform);
void prepareTile(int x, int y, TilePainter* painter);
void markAsDirty(const SkRegion& dirtyArea);
@@ -103,7 +103,7 @@ public:
const IntRect& prepareArea, TilePainter* painter);
void swapTiles();
void swap();
- bool drawGL(IntRect& visibleArea, float opacity);
+ bool drawGL(const IntRect& visibleArea, float opacity, const TransformationMatrix* transform);
void markAsDirty(const SkRegion& dirtyArea);
bool owns(BaseTileTexture* texture);
void computeTexturesAmount(TexturesResult* result, LayerAndroid* layer);