mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Simplified handling of palettes selected into device contexts. Now DC->w.hPalette should always point to palette object and shoudn't be NULL.
- Fixed bitfield conversion when creating Color -> Mono XLATEOBJs. Fixes bug #275. svn path=/trunk/; revision=9235
This commit is contained in:
parent
3f814d3837
commit
47b812dde4
4 changed files with 23 additions and 42 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: xlate.c,v 1.32 2004/04/09 20:39:10 navaraf Exp $
|
||||
/* $Id: xlate.c,v 1.33 2004/04/28 18:38:07 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -445,9 +445,9 @@ XLATEOBJ * STDCALL IntEngCreateMonoXlate(
|
|||
SourcePalGDI = PALETTE_LockPalette(PaletteSource);
|
||||
BitMasksFromPal(SourcePalType, SourcePalGDI, &XlateGDI->RedMask,
|
||||
&XlateGDI->BlueMask, &XlateGDI->GreenMask);
|
||||
XlateGDI->RedShift = CalculateShift(0xFF0000) - CalculateShift(XlateGDI->RedMask);
|
||||
XlateGDI->RedShift = CalculateShift(0xFF) - CalculateShift(XlateGDI->RedMask);
|
||||
XlateGDI->GreenShift = CalculateShift(0xFF00) - CalculateShift(XlateGDI->GreenMask);
|
||||
XlateGDI->BlueShift = CalculateShift(0xFF) - CalculateShift(XlateGDI->BlueMask);
|
||||
XlateGDI->BlueShift = CalculateShift(0xFF0000) - CalculateShift(XlateGDI->BlueMask);
|
||||
XlateGDI->BackgroundColor = ShiftAndMask(XlateGDI, BackgroundColor);
|
||||
PALETTE_UnlockPalette(PaletteSource);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: bitmaps.c,v 1.70 2004/04/25 11:34:13 weiden Exp $ */
|
||||
/* $Id: bitmaps.c,v 1.71 2004/04/28 18:38:07 navaraf Exp $ */
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -153,22 +153,10 @@ NtGdiBitBlt(
|
|||
}
|
||||
|
||||
if (DCDest->w.hPalette != 0)
|
||||
{
|
||||
DestPalette = DCDest->w.hPalette;
|
||||
}
|
||||
else
|
||||
{
|
||||
DestPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
}
|
||||
|
||||
if (UsesSource && DCSrc->w.hPalette != 0)
|
||||
{
|
||||
SourcePalette = DCSrc->w.hPalette;
|
||||
}
|
||||
else
|
||||
{
|
||||
SourcePalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
}
|
||||
|
||||
PalSourceGDI = PALETTE_LockPalette(SourcePalette);
|
||||
if (NULL == PalSourceGDI)
|
||||
|
@ -319,13 +307,9 @@ NtGdiTransparentBlt(
|
|||
|
||||
if(DCDest->w.hPalette)
|
||||
DestPalette = DCDest->w.hPalette;
|
||||
else
|
||||
DestPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
|
||||
if(DCSrc->w.hPalette)
|
||||
SourcePalette = DCSrc->w.hPalette;
|
||||
else
|
||||
SourcePalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
|
||||
if(!(PalSourceGDI = PALETTE_LockPalette(SourcePalette)))
|
||||
{
|
||||
|
@ -652,8 +636,6 @@ NtGdiGetPixel(HDC hDC, INT XPos, INT YPos)
|
|||
{
|
||||
if ( dc->w.hPalette != 0 )
|
||||
Pal = dc->w.hPalette;
|
||||
else
|
||||
Pal = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
PalGDI = PALETTE_LockPalette(Pal);
|
||||
if ( PalGDI )
|
||||
{
|
||||
|
@ -1203,22 +1185,10 @@ NtGdiStretchBlt(
|
|||
}
|
||||
|
||||
if (DCDest->w.hPalette != 0)
|
||||
{
|
||||
DestPalette = DCDest->w.hPalette;
|
||||
}
|
||||
else
|
||||
{
|
||||
DestPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
}
|
||||
|
||||
if (UsesSource && DCSrc->w.hPalette != 0)
|
||||
{
|
||||
SourcePalette = DCSrc->w.hPalette;
|
||||
}
|
||||
else
|
||||
{
|
||||
SourcePalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
}
|
||||
|
||||
PalSourceGDI = PALETTE_LockPalette(SourcePalette);
|
||||
if (NULL == PalSourceGDI)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: color.c,v 1.36 2004/04/09 20:03:20 navaraf Exp $ */
|
||||
/* $Id: color.c,v 1.37 2004/04/28 18:38:07 navaraf Exp $ */
|
||||
|
||||
// FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping
|
||||
|
||||
|
@ -167,7 +167,7 @@ COLORREF STDCALL NtGdiGetNearestColor(HDC hDC,
|
|||
dc = DC_LockDc(hDC);
|
||||
if (NULL != dc)
|
||||
{
|
||||
HPALETTE hpal = (dc->w.hPalette) ? dc->w.hPalette : NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
HPALETTE hpal = dc->w.hPalette;
|
||||
palGDI = (PPALGDI) PALETTE_LockPalette(hpal);
|
||||
if (!palGDI)
|
||||
{
|
||||
|
@ -538,6 +538,15 @@ INT STDCALL COLOR_PaletteLookupPixel(PALETTEENTRY *palPalEntry, INT size,
|
|||
|
||||
COLORREF STDCALL COLOR_LookupNearestColor( PALETTEENTRY* palPalEntry, int size, COLORREF color )
|
||||
{
|
||||
#if 1
|
||||
INT index;
|
||||
|
||||
index = COLOR_PaletteLookupPixel(palPalEntry, size, NULL, color, FALSE);
|
||||
return RGB(
|
||||
palPalEntry[index].peRed,
|
||||
palPalEntry[index].peGreen,
|
||||
palPalEntry[index].peBlue);
|
||||
#else
|
||||
unsigned char spec_type = color >> 24;
|
||||
int i;
|
||||
PALETTEENTRY *COLOR_sysPal = (PALETTEENTRY*)ReturnSystemPalette();
|
||||
|
@ -559,6 +568,7 @@ COLORREF STDCALL COLOR_LookupNearestColor( PALETTEENTRY* palPalEntry, int size,
|
|||
|
||||
color &= 0x00ffffff;
|
||||
return (0x00ffffff & *(COLORREF*)(COLOR_sysPal + COLOR_PaletteLookupPixel(COLOR_sysPal, 256, NULL, color, FALSE)));
|
||||
#endif
|
||||
}
|
||||
|
||||
int STDCALL COLOR_PaletteLookupExactIndex( PALETTEENTRY* palPalEntry, int size,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: dc.c,v 1.132 2004/04/25 20:05:30 weiden Exp $
|
||||
/* $Id: dc.c,v 1.133 2004/04/28 18:38:07 navaraf Exp $
|
||||
*
|
||||
* DC.C - Device context functions
|
||||
*
|
||||
|
@ -37,6 +37,7 @@
|
|||
#include <win32k/region.h>
|
||||
#include <win32k/gdiobj.h>
|
||||
#include <win32k/paint.h>
|
||||
#include <win32k/color.h>
|
||||
#include <win32k/pen.h>
|
||||
#include <win32k/text.h>
|
||||
#include "../eng/clip.h"
|
||||
|
@ -1102,8 +1103,8 @@ NtGdiGetDCState(HDC hDC)
|
|||
newdc->w.hFirstBitmap = dc->w.hFirstBitmap;
|
||||
#if 0
|
||||
newdc->w.hDevice = dc->w.hDevice;
|
||||
newdc->w.hPalette = dc->w.hPalette;
|
||||
#endif
|
||||
newdc->w.hPalette = dc->w.hPalette;
|
||||
newdc->w.totalExtent = dc->w.totalExtent;
|
||||
newdc->w.bitsPerPixel = dc->w.bitsPerPixel;
|
||||
newdc->w.ROPmode = dc->w.ROPmode;
|
||||
|
@ -1271,6 +1272,8 @@ NtGdiSetDCState ( HDC hDC, HDC hDCSave )
|
|||
NtGdiSetBkColor( hDC, dcs->w.backgroundColor);
|
||||
NtGdiSetTextColor( hDC, dcs->w.textColor);
|
||||
|
||||
NtGdiSelectPalette( hDC, dcs->w.hPalette, FALSE );
|
||||
|
||||
#if 0
|
||||
GDISelectPalette16( hDC, dcs->w.hPalette, FALSE );
|
||||
#endif
|
||||
|
@ -2085,6 +2088,8 @@ DC_AllocDC(PUNICODE_STRING Driver)
|
|||
NewDC->w.hFont = NtGdiGetStockObject(SYSTEM_FONT);
|
||||
TextIntRealizeFont(NewDC->w.hFont);
|
||||
|
||||
NewDC->w.hPalette = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
|
||||
DC_UnlockDc(hDC);
|
||||
|
||||
return hDC;
|
||||
|
@ -2294,8 +2299,6 @@ IntGetDCColor(HDC hDC, ULONG Object)
|
|||
|
||||
if(dc->w.hPalette)
|
||||
Pal = dc->w.hPalette;
|
||||
else
|
||||
Pal = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
|
||||
Result = CLR_INVALID;
|
||||
|
||||
|
@ -2432,8 +2435,6 @@ IntSetDCColor(HDC hDC, ULONG Object, COLORREF Color)
|
|||
|
||||
if(dc->w.hPalette)
|
||||
Pal = dc->w.hPalette;
|
||||
else
|
||||
Pal = NtGdiGetStockObject(DEFAULT_PALETTE);
|
||||
|
||||
Result = CLR_INVALID;
|
||||
|
||||
|
|
Loading…
Reference in a new issue