void BackingStore::incorporateUpdate(ShareableBitmap* bitmap, const UpdateInfo& updateInfo)
{
    if (!m_backend)
        m_backend = createBackend();

    scroll(updateInfo.scrollRect, updateInfo.scrollOffset);

    // Paint all update rects.
    IntPoint updateRectLocation = updateInfo.updateRectBounds.location();
    RefPtr<cairo_t> context = adoptRef(cairo_create(m_backend->surface()));
    GraphicsContext graphicsContext(context.get());
    for (const auto& updateRect : updateInfo.updateRects) {
        IntRect srcRect = updateRect;
        srcRect.move(-updateRectLocation.x(), -updateRectLocation.y());
#if PLATFORM(GTK)
        if (!m_webPageProxy.drawsBackground()) {
            const WebCore::Color color = m_webPageProxy.backgroundColor();
            if (color.hasAlpha())
                graphicsContext.clearRect(srcRect);
            if (color.alpha() > 0)
                graphicsContext.fillRect(srcRect, color, ColorSpaceDeviceRGB);
        }
#endif
        bitmap->paint(graphicsContext, deviceScaleFactor(), updateRect.location(), srcRect);
    }
}
Exemplo n.º 2
0
void PlatformCAAnimation::setToValue(const WebCore::Color& value)
{
    if (animationType() != Basic)
        return;

    float a[4] = { value.red(), value.green(), value.blue(), value.alpha() };
    RetainPtr<CACFVectorRef> v(AdoptCF, CACFVectorCreate(4, a));
    CACFAnimationSetToValue(m_animation.get(), v.get());
}
Exemplo n.º 3
0
void SetThemeParameters(const ThemeParameters& themeParams)
{
    // Set Custom focus ring    
    WebCore::Color focusRingColor;  
    if (themeParams.mCustomFocusRingColor) 
    {
        focusRingColor.setRGB( (WebCore::RGBA32) themeParams.mCustomFocusRingColor); 
    }

    WebCore::RenderTheme::setCustomFocusRingColor(focusRingColor);   // RenderTheme checks if the Color is valid to determine if a custom color should be used.
}
Exemplo n.º 4
0
/* SDL ttf implementation may be lighter ??? */
void Font::drawSimpleText(BIGraphicsContext* context, const TextRun& run, const TextStyle& style, const FloatPoint& point) const
{
    WebCore::Color  color = context->strokeColor();
    BCNativeImage*  text_surface = static_cast<BCNativeImage*>(context->getNativeImage())->getSurface();

    // FIXME: Process normal, bold, italic styles
//     if (m_fontDescription.italic())
//     {
//         if (m_fontDescription.bold())
//         { // Bold && italic
//             TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_BOLD | TTF_STYLE_ITALIC);
//         }
//         else
//         { // Only italic
//             TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_ITALIC);
//         }
//     }
//     else if (m_fontDescription.bold())
//     { // Only bold
//         TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_BOLD);
//     }
//     else
//     {
//         TTF_SetFontStyle(d->m_ttfFont, TTF_STYLE_NORMAL);
//     }

    DFBCHECK(text_surface->SetFont(text_surface, d->m_ttfFont));

    // Set font color
    DFBCHECK(text_surface->SetColor(text_surface, color.red(), color.green(), color.blue(), color.alpha()));

    // Draw font
    int wordSize = run.length() - run.from();
    UChar word[wordSize];
    copyTextRunTo(run, word);

    DFBCHECK(text_surface->DrawString(text_surface, word, -1, point.x(), point.y(), DSTF_TOP | DSTF_LEFT));
}
Exemplo n.º 5
0
void ColorChooserUIController::setSelectedColor(const WebCore::Color& color)
{
    ASSERT(m_chooser);
    m_chooser->setSelectedColor(static_cast<WebColor>(color.rgb()));
}
Exemplo n.º 6
0
void NonCompositedContentHost::setBackgroundColor(const WebCore::Color& color)
{
    m_graphicsLayer->platformLayer()->setBackgroundColor(color.rgb());
}
Exemplo n.º 7
0
static void showColorPicker(WKPageRef, WKStringRef initialColor, WKColorPickerResultListenerRef listener, const void* clientInfo)
{
    WebCore::Color color = WebCore::Color(WebKit::toWTFString(initialColor));
    ewk_view_color_picker_request(toEwkView(clientInfo), color.red(), color.green(), color.blue(), color.alpha(), listener);
}
void WebColorPickerEfl::showColorPicker(const WebCore::Color& color)
{
    m_webView->colorPickerClient().showColorPicker(m_webView, color.serialized(), toAPI(m_colorPickerResultListener.get()));
}
Exemplo n.º 9
0
// TODO: draw points instead of lines for nicer circles
inline void drawArc(EA::Raster::ISurface* pSurface, const WebCore::Color color, int zone, int xc, int yc, float& x0, float& y0, float x1, float y1, bool doSwap = true)
{

    EA::Raster::IEARaster* pRaster =EA::WebKit::GetEARasterInstance();

    // Mean First draw => will not draw just a point.
    if (x0 != x1)
    {
        switch(zone)
        {
            case 0:
                pRaster->LineRGBA(pSurface,
                            static_cast<int>(xc + ceilf(x0)), static_cast<int>(yc - ceilf(y0)),
                            static_cast<int>(xc + ceilf(x1)), static_cast<int>(yc - ceilf(y1)),
                            color.red(),
                            color.green(),
                            color.blue(),
                            color.alpha());
                break;

            case 1:
                pRaster->LineRGBA(pSurface,
                            static_cast<int>(xc - ceilf(y0)), static_cast<int>(yc - ceilf(x0)),
                            static_cast<int>(xc - ceilf(y1)), static_cast<int>(yc - ceilf(x1)),
                            color.red(),
                            color.green(),
                            color.blue(),
                            color.alpha());
                break;

            case 2:
                pRaster->LineRGBA(pSurface,
                            static_cast<int>(xc - ceilf(x0)), static_cast<int>(yc + ceilf(y0)),
                            static_cast<int>(xc - ceilf(x1)), static_cast<int>(yc + ceilf(y1)),
                            color.red(),
                            color.green(),
                            color.blue(),
                            color.alpha());
                break;

            case 3:
                pRaster->LineRGBA(pSurface,
                            static_cast<int>(xc + ceilf(y0)), static_cast<int>(yc + ceilf(x0)),
                            static_cast<int>(xc + ceilf(y1)), static_cast<int>(yc + ceilf(x1)),
                            color.red(),
                            color.green(),
                            color.blue(),
                            color.alpha());
                break;
        }

        if (doSwap)
        {
            x0 = x1;
            y0 = y1;
        }
    }
}