Make the Windows widget code report 24-bit color depth when the display driver reports 32, since it's the same number of bits per pixel. (Bug 466669) r=vlad

This commit is contained in:
L. David Baron 2008-12-23 09:06:56 -05:00
parent dd347ca597
commit bac01a39da
3 changed files with 10 additions and 8 deletions

View File

@ -240,7 +240,7 @@ nsThebesDeviceContext::SetDPI()
dpi = 96;
#elif defined(MOZ_WIDGET_QT)
// TODO: get real DPI here with Qt methods
// TODO: get real DPI here with Qt methods
dpi = 96;
#else
#error undefined platform dpi
@ -445,8 +445,8 @@ nsThebesDeviceContext::CheckFontExistence(const nsString& aFaceName)
NS_IMETHODIMP
nsThebesDeviceContext::GetDepth(PRUint32& aDepth)
{
nsCOMPtr<nsIScreen> primaryScreen;
if (mDepth == 0) {
nsCOMPtr<nsIScreen> primaryScreen;
mScreenManager->GetPrimaryScreen(getter_AddRefs(primaryScreen));
primaryScreen->GetColorDepth(reinterpret_cast<PRInt32 *>(&mDepth));
}

View File

@ -193,11 +193,6 @@ GetColor(nsPresContext* aPresContext, nsCSSValue& aResult)
nsIDeviceContext *dx = GetDeviceContextFor(aPresContext);
PRUint32 depth;
dx->GetDepth(depth);
// Some graphics backends may claim 32-bit depth when it's really 24
// (because they're counting the Alpha component).
if (depth == 32) {
depth = 24;
}
// The spec says to use bits *per color component*, so divide by 3,
// and round down, since the spec says to use the smallest when the
// color components differ.

View File

@ -147,7 +147,14 @@ nsScreenWin :: GetPixelDepth(PRInt32 *aPixelDepth)
HDC hDCScreen = ::GetDC(nsnull);
NS_ASSERTION(hDCScreen,"GetDC Failure");
*aPixelDepth = ::GetDeviceCaps(hDCScreen, BITSPIXEL);
PRInt32 depth = ::GetDeviceCaps(hDCScreen, BITSPIXEL);
if (depth == 32) {
// If a device uses 32 bits per pixel, it's still only using 8 bits
// per color component, which is what our callers want to know.
// (Some devices report 32 and some devices report 24.)
depth = 24;
}
*aPixelDepth = depth;
::ReleaseDC(nsnull, hDCScreen);
return NS_OK;