コード例 #1
0
bool LayerAndroid::drawGL(bool layerTilesDisabled)
{
    if (!layerTilesDisabled && m_imageCRC) {
        ImageTexture* imageTexture = ImagesManager::instance()->retainImage(m_imageCRC);
        if (imageTexture)
            imageTexture->drawGL(this, getOpacity());
        ImagesManager::instance()->releaseImage(m_imageCRC);
    }

    state()->glExtras()->drawGL(this);
    bool askScreenUpdate = false;

    if (m_hasRunningAnimations)
        askScreenUpdate = true;

    return askScreenUpdate;
}
コード例 #2
0
bool FixedBackgroundImageLayerAndroid::drawGL(bool layerTilesDisabled)
{
    if (layerTilesDisabled)
        return false;
    if (!m_imageCRC)
        return false;

    ImageTexture* imageTexture = ImagesManager::instance()->retainImage(m_imageCRC);
    if (!imageTexture) {
        ImagesManager::instance()->releaseImage(m_imageCRC);
        return false;
    }

    // We have a fixed background image, let's draw it
    if (m_fixedPosition && m_fixedPosition->isBackgroundImagePositioning()) {
        BackgroundImagePositioning* position =
            static_cast<BackgroundImagePositioning*>(m_fixedPosition);

        IntPoint repeatTimes(position->nbRepeatX(), position->nbRepeatY());
        FloatPoint startPoint(position->offsetX() * getWidth(),
                              position->offsetY() * getHeight());

        FloatPoint origin;
        origin = drawTransform()->mapPoint(origin);

        Color backgroundColor = Color((int)SkColorGetR(m_backgroundColor),
                                      (int)SkColorGetG(m_backgroundColor),
                                      (int)SkColorGetB(m_backgroundColor),
                                      (int)SkColorGetA(m_backgroundColor));

        bool drawSimpleQuadSuccess = drawSimpleQuad(imageTexture, position,
                                                    repeatTimes, startPoint,
                                                    origin, backgroundColor);

        if (!drawSimpleQuadSuccess) {
            drawRepeatedGrid(imageTexture, position, repeatTimes, startPoint,
                             origin, backgroundColor);
        }
    } else
        imageTexture->drawGL(this, getOpacity());

    ImagesManager::instance()->releaseImage(m_imageCRC);

    return false;
}