mirror of
https://github.com/reactos/wine.git
synced 2025-02-10 14:23:52 +00:00
Specify sizes for stock fonts again; removed the FixStockFontSize
hack. Ignore mapping modes when selecting stock fonts into a DC. Removed a few direct accesses to GDI structures from x11drv.
This commit is contained in:
parent
717433854e
commit
e811f9c353
@ -13,6 +13,14 @@
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(psdrv);
|
||||
|
||||
/***********************************************************************
|
||||
* is_stock_font
|
||||
*/
|
||||
inline static BOOL is_stock_font( HFONT font )
|
||||
{
|
||||
return (font >= FIRST_STOCK_FONT && font <= LAST_STOCK_FONT);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* ScaleFont
|
||||
*
|
||||
@ -232,7 +240,9 @@ HFONT PSDRV_FONT_SelectObject( DC * dc, HFONT hfont )
|
||||
TRACE("Got font '%s'\n", afmle->afm->FontName);
|
||||
|
||||
physDev->font.afm = afmle->afm;
|
||||
ScaleFont(physDev->font.afm, INTERNAL_YWSTODS(dc, lf.lfHeight),
|
||||
/* stock fonts ignore the mapping mode */
|
||||
if (!is_stock_font( hfont )) lf.lfHeight = INTERNAL_YWSTODS(dc, lf.lfHeight);
|
||||
ScaleFont(physDev->font.afm, lf.lfHeight,
|
||||
&(physDev->font), &(physDev->font.tm));
|
||||
|
||||
physDev->font.escapement = lf.lfEscapement;
|
||||
|
@ -62,27 +62,37 @@ BOOL X11DRV_BITMAP_Init(void)
|
||||
/***********************************************************************
|
||||
* X11DRV_BITMAP_SelectObject
|
||||
*/
|
||||
HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
|
||||
BITMAPOBJ * bmp )
|
||||
HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap )
|
||||
{
|
||||
BITMAPOBJ *bmp;
|
||||
HRGN hrgn;
|
||||
HBITMAP prevHandle = dc->hBitmap;
|
||||
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
||||
|
||||
|
||||
if (!(dc->flags & DC_MEMORY)) return 0;
|
||||
|
||||
if (!(bmp = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) return 0;
|
||||
|
||||
if(!bmp->physBitmap)
|
||||
{
|
||||
if(!X11DRV_CreateBitmap(hbitmap))
|
||||
return 0;
|
||||
{
|
||||
GDI_ReleaseObj( hbitmap );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(bmp->funcs != dc->funcs) {
|
||||
WARN("Trying to select non-X11 DDB into an X11 dc\n");
|
||||
GDI_ReleaseObj( hbitmap );
|
||||
return 0;
|
||||
}
|
||||
|
||||
hrgn = CreateRectRgn(0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight);
|
||||
if (!hrgn) return 0;
|
||||
if (!(hrgn = CreateRectRgn(0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight)))
|
||||
{
|
||||
GDI_ReleaseObj( hbitmap );
|
||||
return 0;
|
||||
}
|
||||
|
||||
dc->totalExtent.left = 0;
|
||||
dc->totalExtent.top = 0;
|
||||
@ -109,6 +119,7 @@ HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
|
||||
dc->bitsPerPixel = bmp->bitmap.bmBitsPixel;
|
||||
DC_InitDC( dc );
|
||||
}
|
||||
GDI_ReleaseObj( hbitmap );
|
||||
return prevHandle;
|
||||
}
|
||||
|
||||
@ -441,11 +452,16 @@ LONG X11DRV_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags)
|
||||
/***********************************************************************
|
||||
* X11DRV_BITMAP_DeleteObject
|
||||
*/
|
||||
BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ * bmp )
|
||||
BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap )
|
||||
{
|
||||
TSXFreePixmap( gdi_display, (Pixmap)bmp->physBitmap );
|
||||
bmp->physBitmap = NULL;
|
||||
bmp->funcs = NULL;
|
||||
BITMAPOBJ *bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
|
||||
if (bmp)
|
||||
{
|
||||
TSXFreePixmap( gdi_display, (Pixmap)bmp->physBitmap );
|
||||
bmp->physBitmap = NULL;
|
||||
bmp->funcs = NULL;
|
||||
GDI_ReleaseObj( hbitmap );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "ts_xlib.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "brush.h"
|
||||
#include "bitmap.h"
|
||||
#include "color.h"
|
||||
#include "x11drv.h"
|
||||
@ -17,6 +16,8 @@
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(gdi);
|
||||
|
||||
#define NB_HATCH_STYLES (HS_DIAGCROSS+1)
|
||||
|
||||
static const char HatchBrushes[NB_HATCH_STYLES + 1][8] =
|
||||
{
|
||||
{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HS_HORIZONTAL */
|
||||
@ -216,15 +217,17 @@ static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap )
|
||||
/***********************************************************************
|
||||
* BRUSH_SelectObject
|
||||
*/
|
||||
HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
|
||||
HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
|
||||
{
|
||||
LOGBRUSH logbrush;
|
||||
HBITMAP16 hBitmap;
|
||||
BITMAPINFO * bmpInfo;
|
||||
HBRUSH16 prevHandle = dc->hBrush;
|
||||
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
||||
|
||||
TRACE("hdc=%04x hbrush=%04x\n",
|
||||
dc->hSelf,hbrush);
|
||||
|
||||
if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0;
|
||||
|
||||
TRACE("hdc=%04x hbrush=%04x\n", dc->hSelf,hbrush);
|
||||
|
||||
dc->hBrush = hbrush;
|
||||
|
||||
@ -233,9 +236,9 @@ HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
|
||||
TSXFreePixmap( gdi_display, physDev->brush.pixmap );
|
||||
physDev->brush.pixmap = 0;
|
||||
}
|
||||
physDev->brush.style = brush->logbrush.lbStyle;
|
||||
physDev->brush.style = logbrush.lbStyle;
|
||||
|
||||
switch(brush->logbrush.lbStyle)
|
||||
switch(logbrush.lbStyle)
|
||||
{
|
||||
case BS_NULL:
|
||||
TRACE("BS_NULL\n" );
|
||||
@ -243,34 +246,34 @@ HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush, BRUSHOBJ * brush )
|
||||
|
||||
case BS_SOLID:
|
||||
TRACE("BS_SOLID\n" );
|
||||
BRUSH_SelectSolidBrush( dc, brush->logbrush.lbColor );
|
||||
BRUSH_SelectSolidBrush( dc, logbrush.lbColor );
|
||||
break;
|
||||
|
||||
case BS_HATCHED:
|
||||
TRACE("BS_HATCHED\n" );
|
||||
physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( dc, brush->logbrush.lbColor );
|
||||
physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( dc, logbrush.lbColor );
|
||||
physDev->brush.pixmap = TSXCreateBitmapFromData( gdi_display, root_window,
|
||||
HatchBrushes[brush->logbrush.lbHatch], 8, 8 );
|
||||
HatchBrushes[logbrush.lbHatch], 8, 8 );
|
||||
physDev->brush.fillStyle = FillStippled;
|
||||
break;
|
||||
|
||||
case BS_PATTERN:
|
||||
TRACE("BS_PATTERN\n");
|
||||
BRUSH_SelectPatternBrush( dc, (HBRUSH16)brush->logbrush.lbHatch );
|
||||
BRUSH_SelectPatternBrush( dc, (HBRUSH16)logbrush.lbHatch );
|
||||
break;
|
||||
|
||||
case BS_DIBPATTERN:
|
||||
TRACE("BS_DIBPATTERN\n");
|
||||
if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)brush->logbrush.lbHatch )))
|
||||
if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch )))
|
||||
{
|
||||
int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor );
|
||||
int size = DIB_BitmapInfoSize( bmpInfo, logbrush.lbColor );
|
||||
hBitmap = CreateDIBitmap( dc->hSelf, &bmpInfo->bmiHeader,
|
||||
CBM_INIT, ((char *)bmpInfo) + size,
|
||||
bmpInfo,
|
||||
(WORD)brush->logbrush.lbColor );
|
||||
(WORD)logbrush.lbColor );
|
||||
BRUSH_SelectPatternBrush( dc, hBitmap );
|
||||
DeleteObject( hBitmap );
|
||||
GlobalUnlock16( (HGLOBAL16)brush->logbrush.lbHatch );
|
||||
GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch );
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -9,58 +9,28 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bitmap.h"
|
||||
#include "brush.h"
|
||||
#include "font.h"
|
||||
#include "pen.h"
|
||||
#include "x11drv.h"
|
||||
|
||||
#include "debugtools.h"
|
||||
|
||||
DEFAULT_DEBUG_CHANNEL(gdi);
|
||||
|
||||
|
||||
extern HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
|
||||
BITMAPOBJ * bmp );
|
||||
extern HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush,
|
||||
BRUSHOBJ * brush );
|
||||
extern HFONT X11DRV_FONT_SelectObject( DC * dc, HFONT hfont,
|
||||
FONTOBJ * font );
|
||||
extern HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen );
|
||||
|
||||
extern BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ *bmp );
|
||||
|
||||
/***********************************************************************
|
||||
* X11DRV_SelectObject
|
||||
*/
|
||||
HGDIOBJ X11DRV_SelectObject( DC *dc, HGDIOBJ handle )
|
||||
{
|
||||
GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
|
||||
HGDIOBJ ret = 0;
|
||||
|
||||
if (!ptr) return 0;
|
||||
TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
|
||||
|
||||
switch(GDIMAGIC(ptr->wMagic))
|
||||
|
||||
switch(GetObjectType( handle ))
|
||||
{
|
||||
case PEN_MAGIC:
|
||||
ret = X11DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
|
||||
break;
|
||||
case BRUSH_MAGIC:
|
||||
ret = X11DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
|
||||
break;
|
||||
case BITMAP_MAGIC:
|
||||
ret = X11DRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
|
||||
break;
|
||||
case FONT_MAGIC:
|
||||
ret = X11DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
|
||||
break;
|
||||
case REGION_MAGIC:
|
||||
ret = (HGDIOBJ)SelectClipRgn( dc->hSelf, handle );
|
||||
break;
|
||||
case OBJ_PEN: return X11DRV_PEN_SelectObject( dc, handle );
|
||||
case OBJ_BRUSH: return X11DRV_BRUSH_SelectObject( dc, handle );
|
||||
case OBJ_BITMAP: return X11DRV_BITMAP_SelectObject( dc, handle );
|
||||
case OBJ_FONT: return X11DRV_FONT_SelectObject( dc, handle );
|
||||
case OBJ_REGION: return (HGDIOBJ)SelectClipRgn( dc->hSelf, handle );
|
||||
}
|
||||
GDI_ReleaseObj( handle );
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -69,22 +39,13 @@ HGDIOBJ X11DRV_SelectObject( DC *dc, HGDIOBJ handle )
|
||||
*/
|
||||
BOOL X11DRV_DeleteObject( HGDIOBJ handle )
|
||||
{
|
||||
GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
|
||||
BOOL ret = 0;
|
||||
|
||||
if (!ptr) return FALSE;
|
||||
|
||||
switch(GDIMAGIC(ptr->wMagic)) {
|
||||
case BITMAP_MAGIC:
|
||||
ret = X11DRV_BITMAP_DeleteObject( handle, (BITMAPOBJ *)ptr );
|
||||
break;
|
||||
|
||||
switch(GetObjectType( handle ))
|
||||
{
|
||||
case OBJ_BITMAP:
|
||||
return X11DRV_BITMAP_DeleteObject( handle );
|
||||
default:
|
||||
ERR("Shouldn't be here!\n");
|
||||
ret = FALSE;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
GDI_ReleaseObj( handle );
|
||||
return ret;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "pen.h"
|
||||
#include "color.h"
|
||||
#include "x11drv.h"
|
||||
#include "debugtools.h"
|
||||
|
||||
@ -22,23 +20,26 @@ static const char PEN_alternate[] = { 1,1 };
|
||||
/***********************************************************************
|
||||
* PEN_SelectObject
|
||||
*/
|
||||
HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen )
|
||||
HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen )
|
||||
{
|
||||
LOGPEN logpen;
|
||||
HPEN prevHandle = dc->hPen;
|
||||
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
||||
|
||||
dc->hPen = hpen;
|
||||
physDev->pen.style = pen->logpen.lopnStyle & PS_STYLE_MASK;
|
||||
physDev->pen.type = pen->logpen.lopnStyle & PS_TYPE_MASK;
|
||||
physDev->pen.endcap = pen->logpen.lopnStyle & PS_ENDCAP_MASK;
|
||||
physDev->pen.linejoin = pen->logpen.lopnStyle & PS_JOIN_MASK;
|
||||
if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0;
|
||||
|
||||
physDev->pen.width = GDI_ROUND((FLOAT)pen->logpen.lopnWidth.x *
|
||||
dc->hPen = hpen;
|
||||
physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK;
|
||||
physDev->pen.type = logpen.lopnStyle & PS_TYPE_MASK;
|
||||
physDev->pen.endcap = logpen.lopnStyle & PS_ENDCAP_MASK;
|
||||
physDev->pen.linejoin = logpen.lopnStyle & PS_JOIN_MASK;
|
||||
|
||||
physDev->pen.width = GDI_ROUND((FLOAT)logpen.lopnWidth.x *
|
||||
dc->xformWorld2Vport.eM11 * 0.5);
|
||||
if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
|
||||
if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
|
||||
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( dc, pen->logpen.lopnColor );
|
||||
switch(pen->logpen.lopnStyle & PS_STYLE_MASK)
|
||||
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( dc, logpen.lopnColor );
|
||||
switch(logpen.lopnStyle & PS_STYLE_MASK)
|
||||
{
|
||||
case PS_DASH:
|
||||
physDev->pen.dashes = (char *)PEN_dash;
|
||||
|
@ -344,6 +344,16 @@ static Atom RAW_DESCENT;
|
||||
#define CI_GET_DEFAULT_INFO(fs,cs) \
|
||||
CI_GET_CHAR_INFO(fs, fs->default_char, NULL, cs)
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* is_stock_font
|
||||
*/
|
||||
inline static BOOL is_stock_font( HFONT font )
|
||||
{
|
||||
return (font >= FIRST_STOCK_FONT && font <= LAST_STOCK_FONT);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Checksums
|
||||
*/
|
||||
@ -3129,37 +3139,45 @@ LPIFONTINFO16 XFONT_GetFontInfo( X_PHYSFONT pFont )
|
||||
/***********************************************************************
|
||||
* X11DRV_FONT_SelectObject
|
||||
*/
|
||||
HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont, FONTOBJ* font )
|
||||
HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont )
|
||||
{
|
||||
HFONT hPrevFont = 0;
|
||||
LOGFONTW logfont;
|
||||
LOGFONT16 lf;
|
||||
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
|
||||
|
||||
if (!GetObjectW( hfont, sizeof(logfont), &logfont )) return 0;
|
||||
|
||||
EnterCriticalSection( &crtsc_fonts_X11 );
|
||||
|
||||
if( CHECK_PFONT(physDev->font) )
|
||||
XFONT_ReleaseCacheEntry( __PFONT(physDev->font) );
|
||||
|
||||
FONT_LogFontWTo16(&font->logfont, &lf);
|
||||
FONT_LogFontWTo16(&logfont, &lf);
|
||||
|
||||
/* Make sure we don't change the sign when converting to device coords */
|
||||
/* FIXME - check that the other drivers do this correctly */
|
||||
if (lf.lfWidth)
|
||||
/* stock fonts ignore the mapping mode */
|
||||
if (!is_stock_font( hfont ))
|
||||
{
|
||||
lf.lfWidth = GDI_ROUND((FLOAT)lf.lfWidth * fabs(dc->xformWorld2Vport.eM11));
|
||||
if (lf.lfWidth == 0)
|
||||
lf.lfWidth = 1; /* Minimum width */
|
||||
}
|
||||
if (lf.lfHeight)
|
||||
{
|
||||
lf.lfHeight = GDI_ROUND((FLOAT)lf.lfHeight * fabs(dc->xformWorld2Vport.eM22));
|
||||
/* Make sure we don't change the sign when converting to device coords */
|
||||
/* FIXME - check that the other drivers do this correctly */
|
||||
if (lf.lfWidth)
|
||||
{
|
||||
lf.lfWidth = GDI_ROUND((FLOAT)lf.lfWidth * fabs(dc->xformWorld2Vport.eM11));
|
||||
if (lf.lfWidth == 0)
|
||||
lf.lfWidth = 1; /* Minimum width */
|
||||
}
|
||||
if (lf.lfHeight)
|
||||
{
|
||||
lf.lfHeight = GDI_ROUND((FLOAT)lf.lfHeight * fabs(dc->xformWorld2Vport.eM22));
|
||||
|
||||
if (lf.lfHeight == 0)
|
||||
lf.lfHeight = MIN_FONT_SIZE;
|
||||
if (lf.lfHeight == 0)
|
||||
lf.lfHeight = MIN_FONT_SIZE;
|
||||
}
|
||||
}
|
||||
else
|
||||
lf.lfHeight = -(DEF_POINT_SIZE * GetDeviceCaps(dc->hSelf,LOGPIXELSY) + (72>>1)) / 72;
|
||||
|
||||
|
||||
if (!lf.lfHeight)
|
||||
lf.lfHeight = -(DEF_POINT_SIZE * GetDeviceCaps(dc->hSelf,LOGPIXELSY) + (72>>1)) / 72;
|
||||
|
||||
{
|
||||
/* Fixup aliases before passing to RealizeFont */
|
||||
/* alias = Windows name in the alias table */
|
||||
@ -3177,10 +3195,10 @@ HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont, FONTOBJ* font )
|
||||
*/
|
||||
if (alias && !strcmp(faceMatched, lf.lfFaceName))
|
||||
MultiByteToWideChar(CP_ACP, 0, alias, -1,
|
||||
font->logfont.lfFaceName, LF_FACESIZE);
|
||||
logfont.lfFaceName, LF_FACESIZE);
|
||||
else
|
||||
MultiByteToWideChar(CP_ACP, 0, faceMatched, -1,
|
||||
font->logfont.lfFaceName, LF_FACESIZE);
|
||||
logfont.lfFaceName, LF_FACESIZE);
|
||||
|
||||
/*
|
||||
* In X, some encodings may have the same lfFaceName.
|
||||
@ -3189,7 +3207,7 @@ HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont, FONTOBJ* font )
|
||||
* -misc-fixed-*-jisx0208.1990-0
|
||||
* so charset should be saved...
|
||||
*/
|
||||
font->logfont.lfCharSet = charsetMatched;
|
||||
logfont.lfCharSet = charsetMatched;
|
||||
}
|
||||
|
||||
hPrevFont = dc->hFont;
|
||||
|
@ -168,6 +168,11 @@ extern BOOL X11DRV_SwapBuffers(DC *dc) ;
|
||||
extern BOOL X11DRV_BITMAP_Init(void);
|
||||
extern int X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y );
|
||||
extern BOOL X11DRV_OBM_Init(void);
|
||||
extern HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush );
|
||||
extern HFONT X11DRV_FONT_SelectObject( DC * dc, HFONT hfont );
|
||||
extern HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen );
|
||||
extern HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap );
|
||||
extern BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap );
|
||||
|
||||
struct tagBITMAPOBJ;
|
||||
extern XImage *X11DRV_BITMAP_GetXImage( const struct tagBITMAPOBJ *bmp );
|
||||
|
117
objects/gdiobj.c
117
objects/gdiobj.c
@ -271,82 +271,6 @@ static void ReadFontInformation(
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
static int stock_font_height[STOCK_LAST+1];
|
||||
static int stock_font_width[STOCK_LAST+1];
|
||||
|
||||
/***********************************************************************
|
||||
* Because the stock fonts have their structure initialized with
|
||||
* a height of 0 to keep them independent of mapping mode, simply
|
||||
* returning the LOGFONT as is will not work correctly.
|
||||
* These "FixStockFontSizeXXX()" methods will get the correct
|
||||
* size for the fonts.
|
||||
*/
|
||||
static void init_stock_fonts_metrics(void)
|
||||
{
|
||||
int i;
|
||||
TEXTMETRICA tm;
|
||||
HDC hdc;
|
||||
static int done;
|
||||
|
||||
if (done) return;
|
||||
done = 1;
|
||||
hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
|
||||
|
||||
for (i = 0; i <= STOCK_LAST; i++)
|
||||
{
|
||||
if (GetObjectType( GetStockObject(i) ) != OBJ_FONT) continue;
|
||||
SelectObject( hdc, GetStockObject(i) );
|
||||
GetTextMetricsA( hdc, &tm );
|
||||
stock_font_height[i] = tm.tmHeight;
|
||||
stock_font_width[i] = tm.tmAveCharWidth;
|
||||
}
|
||||
DeleteDC(hdc);
|
||||
}
|
||||
|
||||
static inline void FixStockFontSize16(
|
||||
HFONT handle,
|
||||
INT16 count,
|
||||
LPVOID buffer)
|
||||
{
|
||||
LOGFONT16* pLogFont = (LOGFONT16*)buffer;
|
||||
|
||||
/*
|
||||
* Was the lfHeight field copied (it's the first field)?
|
||||
* If it was and it was null, replace the height.
|
||||
*/
|
||||
if ( (count >= 2*sizeof(INT16)) &&
|
||||
(pLogFont->lfHeight == 0) )
|
||||
{
|
||||
pLogFont->lfHeight = stock_font_height[handle-FIRST_STOCK_HANDLE];
|
||||
pLogFont->lfWidth = stock_font_width[handle-FIRST_STOCK_HANDLE];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void FixStockFontSizeA(
|
||||
HFONT handle,
|
||||
INT count,
|
||||
LPVOID buffer)
|
||||
{
|
||||
LOGFONTA* pLogFont = (LOGFONTA*)buffer;
|
||||
|
||||
/*
|
||||
* Was the lfHeight field copied (it's the first field)?
|
||||
* If it was and it was null, replace the height.
|
||||
*/
|
||||
if ( (count >= 2*sizeof(INT)) &&
|
||||
(pLogFont->lfHeight == 0) )
|
||||
{
|
||||
pLogFont->lfHeight = stock_font_height[handle-FIRST_STOCK_HANDLE];
|
||||
pLogFont->lfWidth = stock_font_width[handle-FIRST_STOCK_HANDLE];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Since the LOGFONTA and LOGFONTW structures are identical up to the
|
||||
* lfHeight member (the one of interest in this case) we simply define
|
||||
* the W version as the A version.
|
||||
*/
|
||||
#define FixStockFontSizeW FixStockFontSizeA
|
||||
|
||||
#define TRACE_SEC(handle,text) \
|
||||
TRACE("(%04x): " text " %ld\n", (handle), GDI_level.crst.RecursionCount)
|
||||
@ -366,13 +290,13 @@ BOOL GDI_Init(void)
|
||||
GDI_HeapSel = instance | 7;
|
||||
|
||||
/* TWEAK: Initialize font hints */
|
||||
ReadFontInformation("OEMFixed", &OEMFixedFont, 0, 0, 0, 0, 0);
|
||||
ReadFontInformation("AnsiFixed", &AnsiFixedFont, 0, 0, 0, 0, 0);
|
||||
ReadFontInformation("AnsiVar", &AnsiVarFont, 0, 0, 0, 0, 0);
|
||||
ReadFontInformation("System", &SystemFont, 0, 0, 0, 0, 0);
|
||||
ReadFontInformation("DeviceDefault", &DeviceDefaultFont, 0, 0, 0, 0, 0);
|
||||
ReadFontInformation("SystemFixed", &SystemFixedFont, 0, 0, 0, 0, 0);
|
||||
ReadFontInformation("DefaultGui", &DefaultGuiFont, 0, 0, 0, 0, 0);
|
||||
ReadFontInformation("OEMFixed", &OEMFixedFont, 12, 0, 0, 0, 0);
|
||||
ReadFontInformation("AnsiFixed", &AnsiFixedFont, 12, 0, 0, 0, 0);
|
||||
ReadFontInformation("AnsiVar", &AnsiVarFont, 12, 0, 0, 0, 0);
|
||||
ReadFontInformation("System", &SystemFont, 16, 0, 0, 0, 0);
|
||||
ReadFontInformation("DeviceDefault", &DeviceDefaultFont, 16, 0, 0, 0, 0);
|
||||
ReadFontInformation("SystemFixed", &SystemFixedFont, 16, 0, 0, 0, 0);
|
||||
ReadFontInformation("DefaultGui", &DefaultGuiFont, -11, 0, 0, 0, 0);
|
||||
|
||||
/* Create default palette */
|
||||
|
||||
@ -680,8 +604,6 @@ INT16 WINAPI GetObject16( HANDLE16 handle, INT16 count, LPVOID buffer )
|
||||
TRACE("%04x %d %p\n", handle, count, buffer );
|
||||
if (!count) return 0;
|
||||
|
||||
if (handle >= FIRST_STOCK_FONT && handle <= LAST_STOCK_FONT) init_stock_fonts_metrics();
|
||||
|
||||
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
|
||||
|
||||
switch(GDIMAGIC(ptr->wMagic))
|
||||
@ -697,13 +619,6 @@ INT16 WINAPI GetObject16( HANDLE16 handle, INT16 count, LPVOID buffer )
|
||||
break;
|
||||
case FONT_MAGIC:
|
||||
result = FONT_GetObject16( (FONTOBJ *)ptr, count, buffer );
|
||||
|
||||
/*
|
||||
* Fix the LOGFONT structure for the stock fonts
|
||||
*/
|
||||
if ( (handle >= FIRST_STOCK_HANDLE) &&
|
||||
(handle <= LAST_STOCK_HANDLE) )
|
||||
FixStockFontSize16(handle, count, buffer);
|
||||
break;
|
||||
case PALETTE_MAGIC:
|
||||
result = PALETTE_GetObject( (PALETTEOBJ *)ptr, count, buffer );
|
||||
@ -724,8 +639,6 @@ INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer )
|
||||
TRACE("%08x %d %p\n", handle, count, buffer );
|
||||
if (!count) return 0;
|
||||
|
||||
if (handle >= FIRST_STOCK_FONT && handle <= LAST_STOCK_FONT) init_stock_fonts_metrics();
|
||||
|
||||
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
|
||||
|
||||
switch(GDIMAGIC(ptr->wMagic))
|
||||
@ -741,13 +654,6 @@ INT WINAPI GetObjectA( HANDLE handle, INT count, LPVOID buffer )
|
||||
break;
|
||||
case FONT_MAGIC:
|
||||
result = FONT_GetObjectA( (FONTOBJ *)ptr, count, buffer );
|
||||
|
||||
/*
|
||||
* Fix the LOGFONT structure for the stock fonts
|
||||
*/
|
||||
if ( (handle >= FIRST_STOCK_HANDLE) &&
|
||||
(handle <= LAST_STOCK_HANDLE) )
|
||||
FixStockFontSizeA(handle, count, buffer);
|
||||
break;
|
||||
case PALETTE_MAGIC:
|
||||
result = PALETTE_GetObject( (PALETTEOBJ *)ptr, count, buffer );
|
||||
@ -782,8 +688,6 @@ INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer )
|
||||
TRACE("%08x %d %p\n", handle, count, buffer );
|
||||
if (!count) return 0;
|
||||
|
||||
if (handle >= FIRST_STOCK_FONT && handle <= LAST_STOCK_FONT) init_stock_fonts_metrics();
|
||||
|
||||
if (!(ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ))) return 0;
|
||||
|
||||
switch(GDIMAGIC(ptr->wMagic))
|
||||
@ -799,13 +703,6 @@ INT WINAPI GetObjectW( HANDLE handle, INT count, LPVOID buffer )
|
||||
break;
|
||||
case FONT_MAGIC:
|
||||
result = FONT_GetObjectW( (FONTOBJ *)ptr, count, buffer );
|
||||
|
||||
/*
|
||||
* Fix the LOGFONT structure for the stock fonts
|
||||
*/
|
||||
if ( (handle >= FIRST_STOCK_HANDLE) &&
|
||||
(handle <= LAST_STOCK_HANDLE) )
|
||||
FixStockFontSizeW(handle, count, buffer);
|
||||
break;
|
||||
case PALETTE_MAGIC:
|
||||
result = PALETTE_GetObject( (PALETTEOBJ *)ptr, count, buffer );
|
||||
|
Loading…
x
Reference in New Issue
Block a user