Example #1
0
bool RenderThemeWin::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
    // Get the correct theme data for a button
    ThemeData themeData = getThemeData(o);

    // Now paint the button.
    HDC hdc = prepareForDrawing(i.context);  
    RECT widgetRect = r;
    if (m_themeDLL && !m_buttonTheme)
        m_buttonTheme = openTheme(0, L"Button");
    if (m_buttonTheme && drawThemeBG) {
        drawThemeBG(m_buttonTheme, hdc, themeData.m_part, themeData.m_state, &widgetRect, NULL);
    } else {
        if ((themeData.m_part == BP_BUTTON) && isFocused(o)) {
            // Draw black focus rect around button outer edge
            HBRUSH brush = GetSysColorBrush(COLOR_3DDKSHADOW);
            if (brush) {
                FrameRect(hdc, &widgetRect, brush);
                InflateRect(&widgetRect, -1, -1);
            }
        }
        DrawFrameControl(hdc, &widgetRect, DFC_BUTTON, themeData.m_classicState);
        if ((themeData.m_part != BP_BUTTON) && isFocused(o)) {
            DrawFocusRect(hdc, &widgetRect);
        }
    }
    doneDrawing(i.context, hdc);

    return false;
}
Example #2
0
bool FECustomFilter::applyShader()
{
    Uint8ClampedArray* dstPixelArray = m_customFilterRenderer->premultipliedAlpha() ? createPremultipliedImageResult() : createUnmultipliedImageResult();
    if (!dstPixelArray)
        return false;

    if (!prepareForDrawing())
        return false;

    FilterEffect* in = inputEffect(0);
    IntRect effectDrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect());
    IntSize newContextSize(effectDrawingRect.size());
    if (!resizeContextIfNeeded(newContextSize))
        return false;

    bool needsInputTexture = m_customFilterRenderer->programNeedsInputTexture();
    if (needsInputTexture) {
        RefPtr<Uint8ClampedArray> srcPixelArray = in->asUnmultipliedImage(effectDrawingRect);
        uploadInputTexture(srcPixelArray.get());
    }
    drawFilterMesh(needsInputTexture ? m_inputTexture : 0);

    ASSERT(static_cast<size_t>(newContextSize.width() * newContextSize.height() * 4) == dstPixelArray->length());
    m_context->readPixels(0, 0, newContextSize.width(), newContextSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, dstPixelArray->data());

    return true;
}
Example #3
0
bool RenderThemeWin::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
    HDC hdc = prepareForDrawing(i.context);
    RECT widgetRect = r;
    if (m_themeDLL && !m_menuListTheme)
        m_menuListTheme = openTheme(0, L"Combobox");
    if (m_menuListTheme && drawThemeBG)
        drawThemeBG(m_menuListTheme, hdc, CP_DROPDOWNBUTTON, determineState(o), &widgetRect, NULL);
    else
        DrawFrameControl(hdc, &widgetRect, DFC_SCROLL, DFCS_SCROLLCOMBOBOX | determineClassicState(o));
    doneDrawing(i.context, hdc);

    return false;
}
Example #4
0
bool RenderThemeWin::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
{
    // Get the correct theme data for a textfield
    ThemeData themeData = getThemeData(o);

    // Now paint the text field.
    HDC hdc = prepareForDrawing(i.context);
    RECT widgetRect = r;
    if (m_themeDLL && !m_textFieldTheme)
        m_textFieldTheme = openTheme(0, L"Edit");
    if (m_textFieldTheme && drawThemeBG) {
        drawThemeBG(m_textFieldTheme, hdc, themeData.m_part, themeData.m_state, &widgetRect, NULL);
    } else {
        DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
        FillRect(hdc, &widgetRect, reinterpret_cast<HBRUSH>(((themeData.m_classicState & DFCS_INACTIVE) ? COLOR_BTNFACE : COLOR_WINDOW) + 1));
    }
    doneDrawing(i.context, hdc);

    return false;
}