Closed Bug 726818 Opened 12 years ago Closed 12 years ago

Results of nsNativeThemeWin's GetWidgetNativeDrawingFlags aren't always accurate

Categories

(Core :: Widget: Win32, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jimm, Unassigned)

References

Details

Came across this today. In certain cases GetWidgetNativeDrawingFlags returns CANNOT_DRAW_TO_COLOR_ALPHA on cairo surfaces that support alpha channel. The specific case I found was with D2D surfaces and NS_THEME_TOOLBAR_BUTTONs, which supported alpha yet we render them as if they don't resulting in double pass alpha extraction occurring. There may be other cases. The results of GetWidgetNativeDrawingFlags are based entirely on the widget type, but it seems we should be checking the cairo content flags instead.
Depends on: 373266
NS_THEME_TOOLBAR_BUTTON
NS_THEME_WINDOW_BUTTON_BOX
NS_THEME_MENUITEM
NS_THEME_TOOLTIP

Found these using the following test code in DrawWidgetBackground:

> nsRefPtr<gfxContext> ctx = aContext->ThebesContext();
> PRUint32 flags = GetWidgetNativeDrawingFlags(aWidgetType);
> nsRefPtr<gfxASurface> surface = ctx->CurrentSurface();
> if (surface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA) {
>   printf("adding alpha flag for widget %d\n", aWidgetType);
>   flags |= gfxWindowsNativeDrawing::CANNOT_DRAW_TO_COLOR_ALPHA;
> }
> gfxWindowsNativeDrawing nativeDrawing(ctx, dr, GetWidgetNativeDrawingFlags(aWidgetType));
Hmm, in addition to this, gfxWindowsNativeDrawing::IsDoublePass() assumes that D2D surfaces don't support alpha. Not sure why this is set this way.
Closing this out - D2d always does double pass (although often we can render alpha to the main surface) but I guess that's by design. GetWidgetNativeDrawingFlags seems unrelated to underlying surfaces we render to in nsNativeThemeWin.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.