summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp')
-rw-r--r--Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp38
1 files changed, 12 insertions, 26 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
index 5d595ad..3667fbb 100644
--- a/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
+++ b/Source/WebCore/platform/graphics/chromium/PluginLayerChromium.cpp
@@ -29,10 +29,10 @@
#include "PluginLayerChromium.h"
-#include "cc/CCLayerImpl.h"
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
-#include <GLES2/gl2.h>
+#include "cc/CCLayerImpl.h"
+#include "cc/CCPluginLayerImpl.h"
namespace WebCore {
@@ -43,40 +43,26 @@ PassRefPtr<PluginLayerChromium> PluginLayerChromium::create(GraphicsLayerChromiu
PluginLayerChromium::PluginLayerChromium(GraphicsLayerChromium* owner)
: LayerChromium(owner)
+ , m_textureId(0)
{
}
-void PluginLayerChromium::setTextureId(unsigned id)
+PassRefPtr<CCLayerImpl> PluginLayerChromium::createCCLayerImpl()
{
- m_textureId = id;
+ return CCPluginLayerImpl::create(this);
}
-void PluginLayerChromium::updateContentsIfDirty()
+void PluginLayerChromium::setTextureId(unsigned id)
{
+ m_textureId = id;
}
-void PluginLayerChromium::draw()
+void PluginLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
{
- ASSERT(layerRenderer());
- const PluginLayerChromium::Program* program = layerRenderer()->pluginLayerProgram();
- ASSERT(program && program->initialized());
- GraphicsContext3D* context = layerRendererContext();
- GLC(context, context->activeTexture(GL_TEXTURE0));
- GLC(context, context->bindTexture(GL_TEXTURE_2D, m_textureId));
-
- // FIXME: setting the texture parameters every time is redundant. Move this code somewhere
- // where it will only happen once per texture.
- GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
- GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
- GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
- GLC(context, context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
-
- layerRenderer()->useShader(program->program());
- GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(), 0));
- drawTexturedQuad(context, layerRenderer()->projectionMatrix(), ccLayerImpl()->drawTransform(),
- bounds().width(), bounds().height(), ccLayerImpl()->drawOpacity(),
- program->vertexShader().matrixLocation(),
- program->fragmentShader().alphaLocation());
+ LayerChromium::pushPropertiesTo(layer);
+
+ CCPluginLayerImpl* pluginLayer = static_cast<CCPluginLayerImpl*>(layer);
+ pluginLayer->setTextureId(m_textureId);
}
}