summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-09-20 14:27:34 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2011-09-20 14:41:09 -0700
commit2bed0484fa3b4cac5cad82dc69affc5c49113fc4 (patch)
tree8518fbb7a28086ef5688005fb526a9b7cdc3922c /Source/WebCore/platform
parentb94237ebf14cf9e894b24cfcc613960625b30494 (diff)
downloadexternal_webkit-2bed0484fa3b4cac5cad82dc69affc5c49113fc4.zip
external_webkit-2bed0484fa3b4cac5cad82dc69affc5c49113fc4.tar.gz
external_webkit-2bed0484fa3b4cac5cad82dc69affc5c49113fc4.tar.bz2
Support drawing the quad in GL_NEAREST mode.
This can save the draw call perf up to about 20-40% for each quad. We should make more draw calls using NEAREST mode when it is 1 to 1 mapping. bug:5347539 Change-Id: I1ae206716f2b1352775e0079e25e54f46bc18578
Diffstat (limited to 'Source/WebCore/platform')
-rw-r--r--Source/WebCore/platform/graphics/android/ShaderProgram.cpp9
-rw-r--r--Source/WebCore/platform/graphics/android/ShaderProgram.h6
-rw-r--r--Source/WebCore/platform/graphics/android/TransferQueue.cpp2
3 files changed, 10 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
index bf5f760..3f265fc 100644
--- a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
+++ b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
@@ -294,6 +294,7 @@ void ShaderProgram::drawQuadInternal(SkRect& geometry,
GLenum textureTarget,
GLint position,
GLint alpha,
+ GLint texFilter,
GLint contrast)
{
glUseProgram(program);
@@ -330,26 +331,26 @@ void ShaderProgram::drawQuadInternal(SkRect& geometry,
}
void ShaderProgram::drawQuad(SkRect& geometry, int textureId, float opacity,
- GLenum textureTarget)
+ GLenum textureTarget, GLint texFilter)
{
if (textureTarget == GL_TEXTURE_2D) {
drawQuadInternal(geometry, textureId, opacity, m_program,
m_hProjectionMatrix,
m_hTexSampler, GL_TEXTURE_2D,
- m_hPosition, alpha());
+ m_hPosition, alpha(), texFilter);
} else if (textureTarget == GL_TEXTURE_EXTERNAL_OES
&& !TilesManager::instance()->invertedScreen()) {
drawQuadInternal(geometry, textureId, opacity, m_surfTexOESProgram,
m_hSTOESProjectionMatrix,
m_hSTOESTexSampler, GL_TEXTURE_EXTERNAL_OES,
- m_hSTOESPosition, m_hSTOESAlpha);
+ m_hSTOESPosition, m_hSTOESAlpha, texFilter);
} else if (textureTarget == GL_TEXTURE_EXTERNAL_OES
&& TilesManager::instance()->invertedScreen()) {
drawQuadInternal(geometry, textureId, opacity, m_surfTexOESProgramInverted,
m_hSTOESProjectionMatrixInverted,
m_hSTOESTexSamplerInverted, GL_TEXTURE_EXTERNAL_OES,
m_hSTOESPositionInverted, m_hSTOESAlphaInverted,
- m_hSTOESContrastInverted);
+ texFilter, m_hSTOESContrastInverted);
}
GLUtils::checkGlError("drawQuad");
}
diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.h b/Source/WebCore/platform/graphics/android/ShaderProgram.h
index d8447bf..5f5ce9f 100644
--- a/Source/WebCore/platform/graphics/android/ShaderProgram.h
+++ b/Source/WebCore/platform/graphics/android/ShaderProgram.h
@@ -54,7 +54,8 @@ public:
// support Surface texture in GL_TEXTURE_EXTERNAL_OES target on all
// platforms.
void drawQuad(SkRect& geometry, int textureId, float opacity,
- GLenum textureTarget = GL_TEXTURE_2D);
+ GLenum textureTarget = GL_TEXTURE_2D,
+ GLint texFilter = GL_LINEAR);
void drawLayerQuad(const TransformationMatrix& drawMatrix,
SkRect& geometry, int textureId, float opacity,
bool forceBlending = false,
@@ -99,7 +100,8 @@ private:
void drawQuadInternal(SkRect& geometry, GLint textureId, float opacity,
GLint program, GLint projectionMatrixHandle,
GLint texSampler, GLenum textureTarget,
- GLint position, GLint alpha, GLint contrast = -1);
+ GLint position, GLint alpha,
+ GLint texFilter, GLint contrast = -1);
void drawLayerQuadInternal(const GLfloat* projectionMatrix, int textureId,
float opacity, GLenum textureTarget, GLint program,
diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
index 26b20dc..a8451a6 100644
--- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp
+++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp
@@ -154,7 +154,7 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex,
// Use empty rect to set up the special matrix to draw.
SkRect rect = SkRect::MakeEmpty();
TilesManager::instance()->shader()->drawQuad(rect, srcTexId, 1.0,
- srcTexTarget);
+ srcTexTarget, GL_NEAREST);
// To workaround a sync issue on some platforms, we should insert the sync
// here while in the current FBO.