Beispiel #1
0
void LayerCompositingThread::drawSurface(const TransformationMatrix& drawTransform, LayerCompositingThread* mask, int positionLocation, int texCoordLocation)
{
    if (m_layerRenderer->layerAlreadyOnSurface(this)) {
        unsigned texID = layerRendererSurface()->texture()->textureId();
        if (!texID) {
            ASSERT_NOT_REACHED();
            return;
        }
        textureCacheCompositingThread()->textureAccessed(layerRendererSurface()->texture());
        glBindTexture(GL_TEXTURE_2D, texID);

        if (mask) {
            glActiveTexture(GL_TEXTURE1);
            mask->bindContentsTexture();
            glActiveTexture(GL_TEXTURE0);
        }

        FloatQuad surfaceQuad = getTransformedRect(m_bounds, IntRect(IntPoint::zero(), m_bounds), drawTransform);
        glVertexAttribPointer(positionLocation, 2, GL_FLOAT, GL_FALSE, 0, &surfaceQuad);

        static float texcoords[4 * 2] = { 0, 0,  0, 1,  1, 1,  1, 0 };
        glVertexAttribPointer(texCoordLocation, 2, GL_FLOAT, GL_FALSE, 0, texcoords);
        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
    }
}
bool LayerRendererSurface::ensureTexture()
{
    if (!m_texture)
        m_texture = textureCacheCompositingThread()->createTexture();

    return m_texture->protect(m_size);
}
void LayerTile::updateContents(BlackBerry::Platform::Graphics::Buffer* contents, double scale)
{
    m_scale = scale;
    setTexture(textureCacheCompositingThread()->updateContents(m_texture, contents));
}
void LayerTile::setContents(BlackBerry::Platform::Graphics::Buffer* contents)
{
    m_scale = 0; // Resolution independent
    setTexture(textureCacheCompositingThread()->textureForContents(contents));
}
Beispiel #5
0
static void clearMemoryCachesInCompositingThread()
{
    textureCacheCompositingThread()->prune(0);
}
Beispiel #6
0
void LayerTile::setContentsToColor(const Color& color)
{
    setTexture(textureCacheCompositingThread()->textureForColor(color));
}
Beispiel #7
0
void LayerTile::setContents(BlackBerry::Platform::Graphics::Buffer* contents)
{
    setTexture(textureCacheCompositingThread()->textureForContents(contents));
}