diff --git a/reactos/subsys/win32k/eng/bitblt.c b/reactos/subsys/win32k/eng/bitblt.c index 0d12791d85f..a8183cbc1c8 100644 --- a/reactos/subsys/win32k/eng/bitblt.c +++ b/reactos/subsys/win32k/eng/bitblt.c @@ -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: bitblt.c,v 1.35 2003/12/25 10:49:30 navaraf Exp $ +/* $Id: bitblt.c,v 1.36 2003/12/26 00:31:22 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1001,8 +1001,12 @@ EngMaskBitBlt(SURFOBJ *DestObj, switch(clippingType) { case DC_TRIVIAL: - Ret = AlphaBltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, SourceColorTranslation, + if(Mask->iBitmapFormat == BMF_8BPP) + Ret = AlphaBltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, SourceColorTranslation, &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin); + else + Ret = BltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, + &OutputRect, &InputPoint, MaskOrigin, Brush, BrushOrigin, 0xAACC); break; case DC_RECT: // Clip the blt to the clip rectangle @@ -1013,8 +1017,12 @@ EngMaskBitBlt(SURFOBJ *DestObj, EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect); Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left; Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top; - Ret = AlphaBltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, SourceColorTranslation, + if(Mask->iBitmapFormat == BMF_8BPP) + Ret = AlphaBltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, SourceColorTranslation, &CombinedRect, &Pt, MaskOrigin, Brush, BrushOrigin); + else + Ret = BltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, + &CombinedRect, &Pt, MaskOrigin, Brush, BrushOrigin, 0xAACC); break; case DC_COMPLEX: Ret = TRUE; @@ -1047,9 +1055,12 @@ EngMaskBitBlt(SURFOBJ *DestObj, EngIntersectRect(&CombinedRect, &OutputRect, &ClipRect); Pt.x = InputPoint.x + CombinedRect.left - OutputRect.left; Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top; - Ret = AlphaBltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, SourceColorTranslation, - &CombinedRect, &Pt, MaskOrigin, Brush, BrushOrigin) && - Ret; + if(Mask->iBitmapFormat == BMF_8BPP) + Ret = AlphaBltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, SourceColorTranslation, + &CombinedRect, &Pt, MaskOrigin, Brush, BrushOrigin) && Ret; + else + Ret = BltMask(OutputObj, OutputGDI, InputObj, InputGDI, Mask, DestColorTranslation, + &CombinedRect, &Pt, MaskOrigin, Brush, BrushOrigin, 0xAACC) && Ret; } } while(EnumMore); diff --git a/reactos/subsys/win32k/include/text.h b/reactos/subsys/win32k/include/text.h index ac35f67dc72..d2fbac525c8 100644 --- a/reactos/subsys/win32k/include/text.h +++ b/reactos/subsys/win32k/include/text.h @@ -2,5 +2,8 @@ #define _WIN32K_TEXT_H BOOL FASTCALL InitFontSupport(VOID); +BOOL FASTCALL IntIsFontRenderingEnabled(VOID); +BOOL FASTCALL IntIsFontRenderingEnabled(VOID); +VOID FASTCALL IntEnableFontRendering(BOOL Enable); #endif /* _WIN32K_TEXT_H */ diff --git a/reactos/subsys/win32k/ntuser/misc.c b/reactos/subsys/win32k/ntuser/misc.c index 5d20aa519a9..d8f23729df8 100644 --- a/reactos/subsys/win32k/ntuser/misc.c +++ b/reactos/subsys/win32k/ntuser/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.38 2003/12/25 21:14:24 weiden Exp $ +/* $Id: misc.c,v 1.39 2003/12/26 00:31:22 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -25,6 +25,7 @@ #include #include #include +#include #define NDEBUG #include @@ -540,6 +541,33 @@ NtUserSystemParametersInfo( } return TRUE; } + case SPI_SETFONTSMOOTHING: + { + BOOL Enable; + + Status = MmCopyFromCaller(&Enable, pvParam, sizeof(BOOL)); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return FALSE; + } + + IntEnableFontRendering(Enable); + + return TRUE; + } + case SPI_GETFONTSMOOTHING: + { + BOOL Enabled = IntIsFontRenderingEnabled(); + + Status = MmCopyToCaller(pvParam, &Enabled, sizeof(BOOL)); + if(!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return FALSE; + } + return TRUE; + } } return FALSE; } diff --git a/reactos/subsys/win32k/objects/text.c b/reactos/subsys/win32k/objects/text.c index c50d39eeb25..17e19bbef33 100644 --- a/reactos/subsys/win32k/objects/text.c +++ b/reactos/subsys/win32k/objects/text.c @@ -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: text.c,v 1.66 2003/12/25 00:28:09 weiden Exp $ */ +/* $Id: text.c,v 1.67 2003/12/26 00:31:22 weiden Exp $ */ #undef WIN32_LEAN_AND_MEAN @@ -29,6 +29,7 @@ #include #include #include +#include #include #include FT_FREETYPE_H #include @@ -55,10 +56,37 @@ typedef struct _FONT_ENTRY { static LIST_ENTRY FontListHead; static FAST_MUTEX FontListLock; static INT FontsLoaded = 0; /* number of all fonts loaded (including private fonts */ +static BOOL RenderingEnabled = TRUE; + +BOOL FASTCALL +IntIsFontRenderingEnabled(VOID) +{ + BOOL Ret; + HDC hDC; + PDC dc; + PSURFOBJ SurfObj; + Ret = RenderingEnabled; + hDC = IntGetScreenDC(); + if(hDC) + { + dc = DC_LockDc(hDC); + SurfObj = (PSURFOBJ)AccessUserObject((ULONG) dc->Surface); + if(SurfObj) + Ret = (SurfObj->iBitmapFormat >= BMF_8BPP); + DC_UnlockDc(hDC); + } + return Ret; +} + +VOID FASTCALL +IntEnableFontRendering(BOOL Enable) +{ + RenderingEnabled = Enable; +} FT_Render_Mode FASTCALL IntGetFontRenderMode(LOGFONTW *logfont) -{ +{ switch(logfont->lfQuality) { //case ANTIALIASED_QUALITY: @@ -1497,6 +1525,8 @@ NtGdiTextOut(HDC hDC, PPALGDI PalDestGDI; PXLATEOBJ XlateObj, XlateObj2; ULONG Mode; + FT_Render_Mode RenderMode; + BOOL Render; dc = DC_LockDc(hDC); if( !dc ) @@ -1536,7 +1566,15 @@ NtGdiTextOut(HDC hDC, error = FT_Set_Charmap(face, found); if (error) DPRINT1("WARNING: Could not set the charmap!\n"); } - + + + Render = IntIsFontRenderingEnabled(); + + if(Render) + RenderMode = IntGetFontRenderMode(&TextObj->logfont); + else + RenderMode = FT_RENDER_MODE_MONO; + error = FT_Set_Pixel_Sizes(face, /* FIXME should set character height if neg */ (TextObj->logfont.lfHeight < 0 ? @@ -1595,7 +1633,7 @@ NtGdiTextOut(HDC hDC, for(i=0; iformat == ft_glyph_format_outline) { - error = FT_Render_Glyph(glyph, IntGetFontRenderMode(&TextObj->logfont)); + error = FT_Render_Glyph(glyph, RenderMode); if(error) { EngDeleteXlate(XlateObj); EngDeleteXlate(XlateObj2); @@ -1660,7 +1698,7 @@ NtGdiTextOut(HDC hDC, // Then use memset with 0 to clear it and sourcerect to limit the work of the transbitblt HSourceGlyph = EngCreateBitmap(bitSize, pitch, (glyph->bitmap.pixel_mode == ft_pixel_mode_grays) ? BMF_8BPP : BMF_1BPP, 0, glyph->bitmap.buffer); SourceGlyphSurf = (PSURFOBJ)AccessUserObject((ULONG) HSourceGlyph); -DPRINT1("glyph->bitmap.palette_mode == 0x%x (0x%x)\n", glyph->bitmap.palette_mode, glyph->bitmap.num_grays); + // Use the font data as a mask to paint onto the DCs surface using a brush IntEngMaskBlt ( SurfObj,