CL_Texture ContainerRenderer::getTexture(CL_GraphicContext& gc) {
    if (renderQueue_->requireWorldRepaint() || texture_.is_null()) {
        checkTextureSize(gc);
        CL_FrameBuffer origBuffer = gc.get_write_frame_buffer();

        gc.set_frame_buffer(frameBuffer_);

        render(gc);

        gc.set_frame_buffer(origBuffer);
    }

    return texture_;
}
PathTexture* PathCache::addTexture(const PathDescription& entry, const SkPath *path,
        const SkPaint* paint) {
    ATRACE_CALL();

    float left, top, offset;
    uint32_t width, height;
    computePathBounds(path, paint, left, top, offset, width, height);

    if (!checkTextureSize(width, height)) return NULL;

    purgeCache(width, height);

    SkBitmap bitmap;
    drawPath(path, paint, bitmap, left, top, offset, width, height);

    PathTexture* texture = createTexture(left, top, offset, width, height,
            path->getGenerationID());
    generateTexture(entry, &bitmap, texture);

    return texture;
}