CCPluginLayerImpl.cpp [plain text]
#include "config.h"
#if USE(ACCELERATED_COMPOSITING)
#include "cc/CCPluginLayerImpl.h"
#include "GraphicsContext3D.h"
#include "LayerRendererChromium.h"
#include "PluginLayerChromium.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
CCPluginLayerImpl::CCPluginLayerImpl(LayerChromium* owner, int id)
: CCLayerImpl(owner, id)
, m_textureId(0)
{
}
CCPluginLayerImpl::~CCPluginLayerImpl()
{
}
void CCPluginLayerImpl::draw(const IntRect&)
{
ASSERT(layerRenderer());
const CCPluginLayerImpl::Program* program = layerRenderer()->pluginLayerProgram();
ASSERT(program && program->initialized());
GraphicsContext3D* context = layerRenderer()->context();
GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0));
GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId));
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR));
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR));
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE));
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE));
layerRenderer()->useShader(program->program());
GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(), 0));
LayerChromium::drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(),
bounds().width(), bounds().height(), drawOpacity(),
program->vertexShader().matrixLocation(),
program->fragmentShader().alphaLocation());
}
void CCPluginLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const
{
writeIndent(ts, indent);
ts << "plugin layer texture id: " << m_textureId << "\n";
CCLayerImpl::dumpLayerProperties(ts, indent);
}
}
#endif // USE(ACCELERATED_COMPOSITING)