Beispiel #1
0
static void loadBufferingImageData()
{
    static bool loaded = false;
    if (!loaded) {
        static Image* bufferingIcon = Image::loadPlatformResource("vidbuffer").leakRef();
        NativeImageSkia* nativeImage = bufferingIcon->nativeImageForCurrentFrame();
        if (!nativeImage)
            return;

        if (!nativeImage->isDataComplete())
            return;

        loaded = true;
        nativeImage->lockPixels();

        int bufSize = nativeImage->width() * nativeImage->height() * 4;
        s_bufferingImageWidth = nativeImage->width();
        s_bufferingImageHeight = nativeImage->height();
        s_bufferingImageData = static_cast<char*>(malloc(bufSize));
        memcpy(s_bufferingImageData, nativeImage->getPixels(), bufSize);

        nativeImage->unlockPixels();
        bufferingIcon->deref();
    }
}
void FrameLoaderClientBlackBerry::dispatchDidReceiveIcon()
{
    String url = m_frame->document()->url().string();
    Image* img = iconDatabase().synchronousIconForPageURL(url, IntSize(10, 10));
    if (!img || !img->data())
        return;

    NativeImageSkia* bitmap = img->nativeImageForCurrentFrame();
    if (!bitmap)
        return;
    bitmap->lockPixels();
    String iconUrl = iconDatabase().synchronousIconURLForPageURL(url);
    m_webPagePrivate->m_client->setFavicon(img->width(), img->height(), (unsigned char*)bitmap->getPixels(), iconUrl.utf8().data());
    bitmap->unlockPixels();
}