From ebc6a2d9b6a489df08ee4584c9f609440d66a81e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 21 Jul 2004 04:07:28 +0000 Subject: [PATCH] Moved all files from the objects/ directory to dlls/gdi. Merged text.c into font.c and dcvalues.c into dc.c. --- configure | 5 - configure.ac | 1 - dlls/gdi/Makefile.in | 29 +- {objects => dlls/gdi}/bitmap.c | 0 {objects => dlls/gdi}/brush.c | 0 {objects => dlls/gdi}/clipping.c | 0 {objects => dlls/gdi}/dc.c | 404 ++++++++++++++++++++++++++ {objects => dlls/gdi}/dib.c | 0 {objects => dlls/gdi}/enhmetafile.c | 0 {objects => dlls/gdi}/font.c | 195 +++++++++++++ dlls/gdi/gdi_private.h | 3 - {objects => dlls/gdi}/gdiobj.c | 0 {objects => dlls/gdi}/metafile.c | 0 {objects => dlls/gdi}/palette.c | 0 {objects => dlls/gdi}/pen.c | 0 {objects => dlls/gdi}/region.c | 0 objects/dcvalues.c | 434 ---------------------------- objects/text.c | 233 --------------- 18 files changed, 612 insertions(+), 692 deletions(-) rename {objects => dlls/gdi}/bitmap.c (100%) rename {objects => dlls/gdi}/brush.c (100%) rename {objects => dlls/gdi}/clipping.c (100%) rename {objects => dlls/gdi}/dc.c (84%) rename {objects => dlls/gdi}/dib.c (100%) rename {objects => dlls/gdi}/enhmetafile.c (100%) rename {objects => dlls/gdi}/font.c (91%) rename {objects => dlls/gdi}/gdiobj.c (100%) rename {objects => dlls/gdi}/metafile.c (100%) rename {objects => dlls/gdi}/palette.c (100%) rename {objects => dlls/gdi}/pen.c (100%) rename {objects => dlls/gdi}/region.c (100%) delete mode 100644 objects/dcvalues.c delete mode 100644 objects/text.c diff --git a/configure b/configure index 9e8591c2b2f..31d08984cf9 100755 --- a/configure +++ b/configure @@ -20173,8 +20173,6 @@ esac ac_config_commands="$ac_config_commands misc" - ac_config_commands="$ac_config_commands objects" - ac_config_commands="$ac_config_commands programs/regedit/tests" ac_config_commands="$ac_config_commands windows" @@ -20976,7 +20974,6 @@ do "dlls/wineps/data" ) CONFIG_COMMANDS="$CONFIG_COMMANDS dlls/wineps/data" ;; "include/wine" ) CONFIG_COMMANDS="$CONFIG_COMMANDS include/wine" ;; "misc" ) CONFIG_COMMANDS="$CONFIG_COMMANDS misc" ;; - "objects" ) CONFIG_COMMANDS="$CONFIG_COMMANDS objects" ;; "programs/regedit/tests" ) CONFIG_COMMANDS="$CONFIG_COMMANDS programs/regedit/tests" ;; "windows" ) CONFIG_COMMANDS="$CONFIG_COMMANDS windows" ;; "include/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; @@ -21789,8 +21786,6 @@ echo "$as_me: creating dlls/wineps/data" >&6;} && mkdir "dlls/wineps/data") ;; echo "$as_me: creating include/wine" >&6;} && mkdir "include/wine") ;; misc ) test -d "misc" || ({ echo "$as_me:$LINENO: creating misc" >&5 echo "$as_me: creating misc" >&6;} && mkdir "misc") ;; - objects ) test -d "objects" || ({ echo "$as_me:$LINENO: creating objects" >&5 -echo "$as_me: creating objects" >&6;} && mkdir "objects") ;; programs/regedit/tests ) test -d "programs/regedit/tests" || ({ echo "$as_me:$LINENO: creating programs/regedit/tests" >&5 echo "$as_me: creating programs/regedit/tests" >&6;} && mkdir "programs/regedit/tests") ;; windows ) test -d "windows" || ({ echo "$as_me:$LINENO: creating windows" >&5 diff --git a/configure.ac b/configure.ac index 2a2619e587a..0a004e1ba60 100644 --- a/configure.ac +++ b/configure.ac @@ -1486,7 +1486,6 @@ WINE_CONFIG_EXTRA_DIR(dlls/user/resources) WINE_CONFIG_EXTRA_DIR(dlls/wineps/data) WINE_CONFIG_EXTRA_DIR(include/wine) WINE_CONFIG_EXTRA_DIR(misc) -WINE_CONFIG_EXTRA_DIR(objects) WINE_CONFIG_EXTRA_DIR(programs/regedit/tests) WINE_CONFIG_EXTRA_DIR(windows) diff --git a/dlls/gdi/Makefile.in b/dlls/gdi/Makefile.in index 5e669f30f12..150fd9d5517 100644 --- a/dlls/gdi/Makefile.in +++ b/dlls/gdi/Makefile.in @@ -15,33 +15,28 @@ SPEC_SRCS16 = \ wing.spec C_SRCS = \ - $(TOPOBJDIR)/objects/bitmap.c \ - $(TOPOBJDIR)/objects/brush.c \ - $(TOPOBJDIR)/objects/clipping.c \ - $(TOPOBJDIR)/objects/dc.c \ - $(TOPOBJDIR)/objects/dcvalues.c \ - $(TOPOBJDIR)/objects/dib.c \ - $(TOPOBJDIR)/objects/enhmetafile.c \ - $(TOPOBJDIR)/objects/font.c \ - $(TOPOBJDIR)/objects/gdiobj.c \ - $(TOPOBJDIR)/objects/metafile.c \ - $(TOPOBJDIR)/objects/palette.c \ - $(TOPOBJDIR)/objects/pen.c \ - $(TOPOBJDIR)/objects/region.c \ - $(TOPOBJDIR)/objects/text.c \ bidi.c \ bitblt.c \ + bitmap.c \ + brush.c \ + clipping.c \ + dc.c \ + dib.c \ driver.c \ + enhmetafile.c \ enhmfdrv/bitblt.c \ enhmfdrv/dc.c \ enhmfdrv/graphics.c \ enhmfdrv/init.c \ enhmfdrv/mapping.c \ enhmfdrv/objects.c \ + font.c \ freetype.c \ gdi_main.c \ + gdiobj.c \ icm.c \ mapping.c \ + metafile.c \ mfdrv/bitblt.c \ mfdrv/dc.c \ mfdrv/graphics.c \ @@ -50,8 +45,11 @@ C_SRCS = \ mfdrv/objects.c \ mfdrv/text.c \ painting.c \ + palette.c \ path.c \ - printdrv.c + pen.c \ + printdrv.c \ + region.c C_SRCS16 = \ bidi16.c \ @@ -66,7 +64,6 @@ RC_SRCS16 = version16.rc SUBDIRS = tests EXTRASUBDIRS = \ - $(TOPOBJDIR)/objects \ enhmfdrv \ mfdrv diff --git a/objects/bitmap.c b/dlls/gdi/bitmap.c similarity index 100% rename from objects/bitmap.c rename to dlls/gdi/bitmap.c diff --git a/objects/brush.c b/dlls/gdi/brush.c similarity index 100% rename from objects/brush.c rename to dlls/gdi/brush.c diff --git a/objects/clipping.c b/dlls/gdi/clipping.c similarity index 100% rename from objects/clipping.c rename to dlls/gdi/clipping.c diff --git a/objects/dc.c b/dlls/gdi/dc.c similarity index 84% rename from objects/dc.c rename to dlls/gdi/dc.c index ef67b886114..43e58455dfd 100644 --- a/objects/dc.c +++ b/dlls/gdi/dc.c @@ -843,6 +843,22 @@ INT WINAPI GetDeviceCaps( HDC hdc, INT cap ) } +/*********************************************************************** + * GetBkColor (GDI32.@) + */ +COLORREF WINAPI GetBkColor( HDC hdc ) +{ + COLORREF ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->backgroundColor; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + /*********************************************************************** * SetBkColor (GDI32.@) */ @@ -870,6 +886,22 @@ COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color ) } +/*********************************************************************** + * GetTextColor (GDI32.@) + */ +COLORREF WINAPI GetTextColor( HDC hdc ) +{ + COLORREF ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->textColor; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + /*********************************************************************** * SetTextColor (GDI32.@) */ @@ -897,6 +929,22 @@ COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color ) } +/*********************************************************************** + * GetTextAlign (GDI32.@) + */ +UINT WINAPI GetTextAlign( HDC hdc ) +{ + UINT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->textAlign; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + /*********************************************************************** * SetTextAlign (GDI32.@) */ @@ -950,6 +998,22 @@ DWORD WINAPI SetDCOrg16( HDC16 hdc16, INT16 x, INT16 y ) } +/*********************************************************************** + * GetGraphicsMode (GDI32.@) + */ +INT WINAPI GetGraphicsMode( HDC hdc ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->GraphicsMode; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + /*********************************************************************** * SetGraphicsMode (GDI32.@) */ @@ -974,6 +1038,22 @@ INT WINAPI SetGraphicsMode( HDC hdc, INT mode ) } +/*********************************************************************** + * GetArcDirection (GDI32.@) + */ +INT WINAPI GetArcDirection( HDC hdc ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->ArcDirection; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + /*********************************************************************** * SetArcDirection (GDI32.@) */ @@ -1460,6 +1540,330 @@ INT WINAPI GetRelAbs( HDC hdc, DWORD dwIgnore ) return ret; } + + + +/*********************************************************************** + * GetBkMode (GDI32.@) + */ +INT WINAPI GetBkMode( HDC hdc ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->backgroundMode; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + +/*********************************************************************** + * SetBkMode (GDI32.@) + */ +INT WINAPI SetBkMode( HDC hdc, INT mode ) +{ + INT ret; + DC *dc; + if ((mode <= 0) || (mode > BKMODE_LAST)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (!(dc = DC_GetDCPtr( hdc ))) return 0; + if (dc->funcs->pSetBkMode) + ret = dc->funcs->pSetBkMode( dc->physDev, mode ); + else + { + ret = dc->backgroundMode; + dc->backgroundMode = mode; + } + GDI_ReleaseObj( hdc ); + return ret; +} + + +/*********************************************************************** + * GetROP2 (GDI32.@) + */ +INT WINAPI GetROP2( HDC hdc ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->ROPmode; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + +/*********************************************************************** + * SetROP2 (GDI32.@) + */ +INT WINAPI SetROP2( HDC hdc, INT mode ) +{ + INT ret; + DC *dc; + if ((mode < R2_BLACK) || (mode > R2_WHITE)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (!(dc = DC_GetDCPtr( hdc ))) return 0; + if (dc->funcs->pSetROP2) + ret = dc->funcs->pSetROP2( dc->physDev, mode ); + else + { + ret = dc->ROPmode; + dc->ROPmode = mode; + } + GDI_ReleaseObj( hdc ); + return ret; +} + + +/*********************************************************************** + * SetRelAbs (GDI32.@) + */ +INT WINAPI SetRelAbs( HDC hdc, INT mode ) +{ + INT ret; + DC *dc; + if ((mode != ABSOLUTE) && (mode != RELATIVE)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (!(dc = DC_GetDCPtr( hdc ))) return 0; + if (dc->funcs->pSetRelAbs) + ret = dc->funcs->pSetRelAbs( dc->physDev, mode ); + else + { + ret = dc->relAbsMode; + dc->relAbsMode = mode; + } + GDI_ReleaseObj( hdc ); + return ret; +} + + +/*********************************************************************** + * GetPolyFillMode (GDI32.@) + */ +INT WINAPI GetPolyFillMode( HDC hdc ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->polyFillMode; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + +/*********************************************************************** + * SetPolyFillMode (GDI32.@) + */ +INT WINAPI SetPolyFillMode( HDC hdc, INT mode ) +{ + INT ret; + DC *dc; + if ((mode <= 0) || (mode > POLYFILL_LAST)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (!(dc = DC_GetDCPtr( hdc ))) return 0; + if (dc->funcs->pSetPolyFillMode) + ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode ); + else + { + ret = dc->polyFillMode; + dc->polyFillMode = mode; + } + GDI_ReleaseObj( hdc ); + return ret; +} + + +/*********************************************************************** + * GetStretchBltMode (GDI32.@) + */ +INT WINAPI GetStretchBltMode( HDC hdc ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->stretchBltMode; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + +/*********************************************************************** + * SetStretchBltMode (GDI32.@) + */ +INT WINAPI SetStretchBltMode( HDC hdc, INT mode ) +{ + INT ret; + DC *dc; + if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (!(dc = DC_GetDCPtr( hdc ))) return 0; + if (dc->funcs->pSetStretchBltMode) + ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode ); + else + { + ret = dc->stretchBltMode; + dc->stretchBltMode = mode; + } + GDI_ReleaseObj( hdc ); + return ret; +} + + +/*********************************************************************** + * GetMapMode (GDI32.@) + */ +INT WINAPI GetMapMode( HDC hdc ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + ret = dc->MapMode; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + +/*********************************************************************** + * GetBrushOrgEx (GDI32.@) + */ +BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt ) +{ + DC * dc = DC_GetDCPtr( hdc ); + if (!dc) return FALSE; + pt->x = dc->brushOrgX; + pt->y = dc->brushOrgY; + GDI_ReleaseObj( hdc ); + return TRUE; +} + + +/*********************************************************************** + * GetCurrentPositionEx (GDI32.@) + */ +BOOL WINAPI GetCurrentPositionEx( HDC hdc, LPPOINT pt ) +{ + DC * dc = DC_GetDCPtr( hdc ); + if (!dc) return FALSE; + pt->x = dc->CursPosX; + pt->y = dc->CursPosY; + GDI_ReleaseObj( hdc ); + return TRUE; +} + + +/*********************************************************************** + * GetViewportExtEx (GDI32.@) + */ +BOOL WINAPI GetViewportExtEx( HDC hdc, LPSIZE size ) +{ + DC * dc = DC_GetDCPtr( hdc ); + if (!dc) return FALSE; + size->cx = dc->vportExtX; + size->cy = dc->vportExtY; + GDI_ReleaseObj( hdc ); + return TRUE; +} + + +/*********************************************************************** + * GetViewportOrgEx (GDI32.@) + */ +BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt ) +{ + DC * dc = DC_GetDCPtr( hdc ); + if (!dc) return FALSE; + pt->x = dc->vportOrgX; + pt->y = dc->vportOrgY; + GDI_ReleaseObj( hdc ); + return TRUE; +} + + +/*********************************************************************** + * GetWindowExtEx (GDI32.@) + */ +BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size ) +{ + DC * dc = DC_GetDCPtr( hdc ); + if (!dc) return FALSE; + size->cx = dc->wndExtX; + size->cy = dc->wndExtY; + GDI_ReleaseObj( hdc ); + return TRUE; +} + + +/*********************************************************************** + * GetWindowOrgEx (GDI32.@) + */ +BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt ) +{ + DC * dc = DC_GetDCPtr( hdc ); + if (!dc) return FALSE; + pt->x = dc->wndOrgX; + pt->y = dc->wndOrgY; + GDI_ReleaseObj( hdc ); + return TRUE; +} + + +/*********************************************************************** + * InquireVisRgn (GDI.131) + */ +HRGN16 WINAPI InquireVisRgn16( HDC16 hdc ) +{ + HRGN16 ret = 0; + DC * dc = DC_GetDCPtr( HDC_32(hdc) ); + if (dc) + { + ret = HRGN_16(dc->hVisRgn); + GDI_ReleaseObj( HDC_32(hdc) ); + } + return ret; +} + + +/*********************************************************************** + * GetClipRgn (GDI.173) + */ +HRGN16 WINAPI GetClipRgn16( HDC16 hdc ) +{ + HRGN16 ret = 0; + DC * dc = DC_GetDCPtr( HDC_32(hdc) ); + if (dc) + { + ret = HRGN_16(dc->hClipRgn); + GDI_ReleaseObj( HDC_32(hdc) ); + } + return ret; +} + + /*********************************************************************** * GetLayout (GDI32.@) * diff --git a/objects/dib.c b/dlls/gdi/dib.c similarity index 100% rename from objects/dib.c rename to dlls/gdi/dib.c diff --git a/objects/enhmetafile.c b/dlls/gdi/enhmetafile.c similarity index 100% rename from objects/enhmetafile.c rename to dlls/gdi/enhmetafile.c diff --git a/objects/font.c b/dlls/gdi/font.c similarity index 91% rename from objects/font.c rename to dlls/gdi/font.c index d52fe95ac47..4743f9d52bd 100644 --- a/objects/font.c +++ b/dlls/gdi/font.c @@ -319,6 +319,77 @@ static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, NEWTEXTMETRIC memcpy(&ptmA->ntmFontSig, &ptmW->ntmFontSig, sizeof(FONTSIGNATURE)); } + +/*********************************************************************** + * FONT_mbtowc + * + * Returns a '\0' terminated Unicode translation of str using the + * charset of the currently selected font in hdc. If count is -1 then + * str is assumed to be '\0' terminated, otherwise it contains the + * number of bytes to convert. If plenW is non-NULL, on return it + * will point to the number of WCHARs (excluding the '\0') that have + * been written. If pCP is non-NULL, on return it will point to the + * codepage used in the conversion. + * The caller should free the returned LPWSTR from the process + * heap itself. + */ +static LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP) +{ + UINT cp = CP_ACP; + INT lenW; + LPWSTR strW; + CHARSETINFO csi; + int charset = GetTextCharset(hdc); + + /* Hmm, nicely designed api this one! */ + if(TranslateCharsetInfo((DWORD*)charset, &csi, TCI_SRCCHARSET)) + cp = csi.ciACP; + else { + switch(charset) { + case OEM_CHARSET: + cp = GetOEMCP(); + break; + case DEFAULT_CHARSET: + cp = GetACP(); + break; + + case VISCII_CHARSET: + case TCVN_CHARSET: + case KOI8_CHARSET: + case ISO3_CHARSET: + case ISO4_CHARSET: + case ISO10_CHARSET: + case CELTIC_CHARSET: + /* FIXME: These have no place here, but because x11drv + enumerates fonts with these (made up) charsets some apps + might use them and then the FIXME below would become + annoying. Now we could pick the intended codepage for + each of these, but since it's broken anyway we'll just + use CP_ACP and hope it'll go away... + */ + cp = CP_ACP; + break; + + default: + FIXME("Can't find codepage for charset %d\n", charset); + break; + } + } + + TRACE("charset %d => cp %d\n", charset, cp); + + if(count == -1) count = strlen(str); + lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0); + strW = HeapAlloc(GetProcessHeap(), 0, (lenW + 1) * sizeof(WCHAR)); + MultiByteToWideChar(cp, 0, str, count, strW, lenW); + strW[lenW] = '\0'; + TRACE("mapped %s -> %s\n", debugstr_an(str, count), debugstr_wn(strW, lenW)); + if(plenW) *plenW = lenW; + if(pCP) *pCP = cp; + return strW; +} + + /*********************************************************************** * CreateFontIndirectA (GDI32.@) */ @@ -1574,6 +1645,130 @@ BOOL WINAPI GetCharWidth32A( HDC hdc, UINT firstChar, UINT lastChar, } +/*********************************************************************** + * ExtTextOutA (GDI32.@) + */ +BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags, + const RECT *lprect, LPCSTR str, UINT count, const INT *lpDx ) +{ + INT wlen; + UINT codepage; + LPWSTR p = FONT_mbtowc(hdc, str, count, &wlen, &codepage); + BOOL ret; + LPINT lpDxW = NULL; + + if (lpDx) { + unsigned int i = 0, j = 0; + + lpDxW = (LPINT)HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(INT)); + while(i < count) { + if(IsDBCSLeadByteEx(codepage, str[i])) { + lpDxW[j++] = lpDx[i] + lpDx[i+1]; + i = i + 2; + } else { + lpDxW[j++] = lpDx[i]; + i = i + 1; + } + } + } + + ret = ExtTextOutW( hdc, x, y, flags, lprect, p, wlen, lpDxW ); + + HeapFree( GetProcessHeap(), 0, p ); + if (lpDxW) HeapFree( GetProcessHeap(), 0, lpDxW ); + return ret; +} + + +/*********************************************************************** + * ExtTextOutW (GDI32.@) + */ +BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, + const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) +{ + BOOL ret = FALSE; + DC * dc = DC_GetDCUpdate( hdc ); + if (dc) + { + if(PATH_IsPathOpen(dc->path)) + FIXME("called on an open path\n"); + else if(dc->funcs->pExtTextOut) + { + if( !(flags&(ETO_GLYPH_INDEX|ETO_IGNORELANGUAGE)) && BidiAvail && count>0 ) + { + /* The caller did not specify that language processing was already done. + */ + LPWSTR lpReorderedString=HeapAlloc(GetProcessHeap(), 0, count*sizeof(WCHAR)); + + BIDI_Reorder( str, count, GCP_REORDER, + ((flags&ETO_RTLREADING)!=0 || (GetTextAlign(hdc)&TA_RTLREADING)!=0)? + WINE_GCPW_FORCE_RTL:WINE_GCPW_FORCE_LTR, + lpReorderedString, count, NULL ); + + ret = dc->funcs->pExtTextOut(dc->physDev,x,y,flags|ETO_IGNORELANGUAGE, + lprect,lpReorderedString,count,lpDx,dc->breakExtra); + HeapFree(GetProcessHeap(), 0, lpReorderedString); + } else + ret = dc->funcs->pExtTextOut(dc->physDev,x,y,flags,lprect,str,count, + lpDx,dc->breakExtra); + } + GDI_ReleaseObj( hdc ); + } + return ret; +} + + +/*********************************************************************** + * TextOutA (GDI32.@) + */ +BOOL WINAPI TextOutA( HDC hdc, INT x, INT y, LPCSTR str, INT count ) +{ + return ExtTextOutA( hdc, x, y, 0, NULL, str, count, NULL ); +} + + +/*********************************************************************** + * TextOutW (GDI32.@) + */ +BOOL WINAPI TextOutW(HDC hdc, INT x, INT y, LPCWSTR str, INT count) +{ + return ExtTextOutW( hdc, x, y, 0, NULL, str, count, NULL ); +} + + +/*********************************************************************** + * PolyTextOutA (GDI32.@) + * + * Draw several Strings + */ +BOOL WINAPI PolyTextOutA ( HDC hdc, /* [in] Handle to device context */ + PPOLYTEXTA pptxt, /* [in] Array of strings */ + INT cStrings ) /* [in] Number of strings in array */ +{ + for (; cStrings>0; cStrings--, pptxt++) + if (!ExtTextOutA( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx )) + return FALSE; + return TRUE; +} + + + +/*********************************************************************** + * PolyTextOutW (GDI32.@) + * + * Draw several Strings + */ +BOOL WINAPI PolyTextOutW ( HDC hdc, /* [in] Handle to device context */ + PPOLYTEXTW pptxt, /* [in] Array of strings */ + INT cStrings ) /* [in] Number of strings in array */ +{ + for (; cStrings>0; cStrings--, pptxt++) + if (!ExtTextOutW( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx )) + return FALSE; + return TRUE; +} + + /* FIXME: all following APIs ******************************************/ diff --git a/dlls/gdi/gdi_private.h b/dlls/gdi/gdi_private.h index fed7aaeeea1..4bae5eda184 100644 --- a/dlls/gdi/gdi_private.h +++ b/dlls/gdi/gdi_private.h @@ -397,7 +397,4 @@ extern HPALETTE PALETTE_Init(void); /* region.c */ extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ); -/* text.c */ -extern LPWSTR FONT_mbtowc(HDC, LPCSTR, INT, INT*, UINT*); - #endif /* __WINE_GDI_PRIVATE_H */ diff --git a/objects/gdiobj.c b/dlls/gdi/gdiobj.c similarity index 100% rename from objects/gdiobj.c rename to dlls/gdi/gdiobj.c diff --git a/objects/metafile.c b/dlls/gdi/metafile.c similarity index 100% rename from objects/metafile.c rename to dlls/gdi/metafile.c diff --git a/objects/palette.c b/dlls/gdi/palette.c similarity index 100% rename from objects/palette.c rename to dlls/gdi/palette.c diff --git a/objects/pen.c b/dlls/gdi/pen.c similarity index 100% rename from objects/pen.c rename to dlls/gdi/pen.c diff --git a/objects/region.c b/dlls/gdi/region.c similarity index 100% rename from objects/region.c rename to dlls/gdi/region.c diff --git a/objects/dcvalues.c b/objects/dcvalues.c deleted file mode 100644 index 09bbdadbb44..00000000000 --- a/objects/dcvalues.c +++ /dev/null @@ -1,434 +0,0 @@ -/* - * DC device-independent Get/SetXXX functions - * - * Copyright 1993 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include - -#include "windef.h" -#include "winbase.h" -#include "winerror.h" -#include "wownt32.h" - -#include "gdi.h" -#include "gdi_private.h" - - -/*********************************************************************** - * SetBkMode (GDI32.@) - */ -INT WINAPI SetBkMode( HDC hdc, INT mode ) -{ - INT ret; - DC *dc; - if ((mode <= 0) || (mode > BKMODE_LAST)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - if (!(dc = DC_GetDCPtr( hdc ))) return 0; - if (dc->funcs->pSetBkMode) - ret = dc->funcs->pSetBkMode( dc->physDev, mode ); - else - { - ret = dc->backgroundMode; - dc->backgroundMode = mode; - } - GDI_ReleaseObj( hdc ); - return ret; -} - - -/*********************************************************************** - * SetROP2 (GDI32.@) - */ -INT WINAPI SetROP2( HDC hdc, INT mode ) -{ - INT ret; - DC *dc; - if ((mode < R2_BLACK) || (mode > R2_WHITE)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - if (!(dc = DC_GetDCPtr( hdc ))) return 0; - if (dc->funcs->pSetROP2) - ret = dc->funcs->pSetROP2( dc->physDev, mode ); - else - { - ret = dc->ROPmode; - dc->ROPmode = mode; - } - GDI_ReleaseObj( hdc ); - return ret; -} - - -/*********************************************************************** - * SetRelAbs (GDI32.@) - */ -INT WINAPI SetRelAbs( HDC hdc, INT mode ) -{ - INT ret; - DC *dc; - if ((mode != ABSOLUTE) && (mode != RELATIVE)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - if (!(dc = DC_GetDCPtr( hdc ))) return 0; - if (dc->funcs->pSetRelAbs) - ret = dc->funcs->pSetRelAbs( dc->physDev, mode ); - else - { - ret = dc->relAbsMode; - dc->relAbsMode = mode; - } - GDI_ReleaseObj( hdc ); - return ret; -} - - -/*********************************************************************** - * SetPolyFillMode (GDI32.@) - */ -INT WINAPI SetPolyFillMode( HDC hdc, INT mode ) -{ - INT ret; - DC *dc; - if ((mode <= 0) || (mode > POLYFILL_LAST)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - if (!(dc = DC_GetDCPtr( hdc ))) return 0; - if (dc->funcs->pSetPolyFillMode) - ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode ); - else - { - ret = dc->polyFillMode; - dc->polyFillMode = mode; - } - GDI_ReleaseObj( hdc ); - return ret; -} - - -/*********************************************************************** - * SetStretchBltMode (GDI32.@) - */ -INT WINAPI SetStretchBltMode( HDC hdc, INT mode ) -{ - INT ret; - DC *dc; - if ((mode <= 0) || (mode > MAXSTRETCHBLTMODE)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - if (!(dc = DC_GetDCPtr( hdc ))) return 0; - if (dc->funcs->pSetStretchBltMode) - ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode ); - else - { - ret = dc->stretchBltMode; - dc->stretchBltMode = mode; - } - GDI_ReleaseObj( hdc ); - return ret; -} - - -/*********************************************************************** - * GetBkColor (GDI32.@) - */ -COLORREF WINAPI GetBkColor( HDC hdc ) -{ - COLORREF ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->backgroundColor; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetBkMode (GDI32.@) - */ -INT WINAPI GetBkMode( HDC hdc ) -{ - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->backgroundMode; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetMapMode (GDI32.@) - */ -INT WINAPI GetMapMode( HDC hdc ) -{ - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->MapMode; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetPolyFillMode (GDI32.@) - */ -INT WINAPI GetPolyFillMode( HDC hdc ) -{ - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->polyFillMode; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetROP2 (GDI32.@) - */ -INT WINAPI GetROP2( HDC hdc ) -{ - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->ROPmode; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetStretchBltMode (GDI32.@) - */ -INT WINAPI GetStretchBltMode( HDC hdc ) -{ - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->stretchBltMode; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetTextColor (GDI32.@) - */ -COLORREF WINAPI GetTextColor( HDC hdc ) -{ - COLORREF ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->textColor; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetTextAlign (GDI32.@) - */ -UINT WINAPI GetTextAlign( HDC hdc ) -{ - UINT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->textAlign; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetArcDirection (GDI32.@) - */ -INT WINAPI GetArcDirection( HDC hdc ) -{ - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->ArcDirection; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetGraphicsMode (GDI32.@) - */ -INT WINAPI GetGraphicsMode( HDC hdc ) -{ - INT ret = 0; - DC * dc = DC_GetDCPtr( hdc ); - if (dc) - { - ret = dc->GraphicsMode; - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * GetBrushOrgEx (GDI32.@) - */ -BOOL WINAPI GetBrushOrgEx( HDC hdc, LPPOINT pt ) -{ - DC * dc = DC_GetDCPtr( hdc ); - if (!dc) return FALSE; - pt->x = dc->brushOrgX; - pt->y = dc->brushOrgY; - GDI_ReleaseObj( hdc ); - return TRUE; -} - - -/*********************************************************************** - * GetCurrentPositionEx (GDI32.@) - */ -BOOL WINAPI GetCurrentPositionEx( HDC hdc, LPPOINT pt ) -{ - DC * dc = DC_GetDCPtr( hdc ); - if (!dc) return FALSE; - pt->x = dc->CursPosX; - pt->y = dc->CursPosY; - GDI_ReleaseObj( hdc ); - return TRUE; -} - - -/*********************************************************************** - * GetViewportExtEx (GDI32.@) - */ -BOOL WINAPI GetViewportExtEx( HDC hdc, LPSIZE size ) -{ - DC * dc = DC_GetDCPtr( hdc ); - if (!dc) return FALSE; - size->cx = dc->vportExtX; - size->cy = dc->vportExtY; - GDI_ReleaseObj( hdc ); - return TRUE; -} - - -/*********************************************************************** - * GetViewportOrgEx (GDI32.@) - */ -BOOL WINAPI GetViewportOrgEx( HDC hdc, LPPOINT pt ) -{ - DC * dc = DC_GetDCPtr( hdc ); - if (!dc) return FALSE; - pt->x = dc->vportOrgX; - pt->y = dc->vportOrgY; - GDI_ReleaseObj( hdc ); - return TRUE; -} - - -/*********************************************************************** - * GetWindowExtEx (GDI32.@) - */ -BOOL WINAPI GetWindowExtEx( HDC hdc, LPSIZE size ) -{ - DC * dc = DC_GetDCPtr( hdc ); - if (!dc) return FALSE; - size->cx = dc->wndExtX; - size->cy = dc->wndExtY; - GDI_ReleaseObj( hdc ); - return TRUE; -} - - -/*********************************************************************** - * GetWindowOrgEx (GDI32.@) - */ -BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt ) -{ - DC * dc = DC_GetDCPtr( hdc ); - if (!dc) return FALSE; - pt->x = dc->wndOrgX; - pt->y = dc->wndOrgY; - GDI_ReleaseObj( hdc ); - return TRUE; -} - - -/**** 16-bit functions ***/ - -/*********************************************************************** - * InquireVisRgn (GDI.131) - */ -HRGN16 WINAPI InquireVisRgn16( HDC16 hdc ) -{ - HRGN16 ret = 0; - DC * dc = DC_GetDCPtr( HDC_32(hdc) ); - if (dc) - { - ret = HRGN_16(dc->hVisRgn); - GDI_ReleaseObj( HDC_32(hdc) ); - } - return ret; -} - - -/*********************************************************************** - * GetClipRgn (GDI.173) - */ -HRGN16 WINAPI GetClipRgn16( HDC16 hdc ) -{ - HRGN16 ret = 0; - DC * dc = DC_GetDCPtr( HDC_32(hdc) ); - if (dc) - { - ret = HRGN_16(dc->hClipRgn); - GDI_ReleaseObj( HDC_32(hdc) ); - } - return ret; -} diff --git a/objects/text.c b/objects/text.c deleted file mode 100644 index a5950d6da86..00000000000 --- a/objects/text.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * text functions - * - * Copyright 1993, 1994 Alexandre Julliard - * Copyright 2003 Shachar Shemesh - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "wine/winuser16.h" -#include "winerror.h" -#include "winnls.h" -#include "gdi.h" -#include "gdi_private.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(text); - -/*********************************************************************** - * FONT_mbtowc - * - * Returns a '\0' terminated Unicode translation of str using the - * charset of the currently selected font in hdc. If count is -1 then - * str is assumed to be '\0' terminated, otherwise it contains the - * number of bytes to convert. If plenW is non-NULL, on return it - * will point to the number of WCHARs (excluding the '\0') that have - * been written. If pCP is non-NULL, on return it will point to the - * codepage used in the conversion. - * The caller should free the returned LPWSTR from the process - * heap itself. - */ -LPWSTR FONT_mbtowc(HDC hdc, LPCSTR str, INT count, INT *plenW, UINT *pCP) -{ - UINT cp = CP_ACP; - INT lenW; - LPWSTR strW; - CHARSETINFO csi; - int charset = GetTextCharset(hdc); - - /* Hmm, nicely designed api this one! */ - if(TranslateCharsetInfo((DWORD*)charset, &csi, TCI_SRCCHARSET)) - cp = csi.ciACP; - else { - switch(charset) { - case OEM_CHARSET: - cp = GetOEMCP(); - break; - case DEFAULT_CHARSET: - cp = GetACP(); - break; - - case VISCII_CHARSET: - case TCVN_CHARSET: - case KOI8_CHARSET: - case ISO3_CHARSET: - case ISO4_CHARSET: - case ISO10_CHARSET: - case CELTIC_CHARSET: - /* FIXME: These have no place here, but because x11drv - enumerates fonts with these (made up) charsets some apps - might use them and then the FIXME below would become - annoying. Now we could pick the intended codepage for - each of these, but since it's broken anyway we'll just - use CP_ACP and hope it'll go away... - */ - cp = CP_ACP; - break; - - - default: - FIXME("Can't find codepage for charset %d\n", charset); - break; - } - } - - TRACE("charset %d => cp %d\n", charset, cp); - - if(count == -1) count = strlen(str); - lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0); - strW = HeapAlloc(GetProcessHeap(), 0, (lenW + 1) * sizeof(WCHAR)); - MultiByteToWideChar(cp, 0, str, count, strW, lenW); - strW[lenW] = '\0'; - TRACE("mapped %s -> %s\n", debugstr_an(str, count), debugstr_wn(strW, lenW)); - if(plenW) *plenW = lenW; - if(pCP) *pCP = cp; - return strW; -} - - -/*********************************************************************** - * ExtTextOutA (GDI32.@) - */ -BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags, - const RECT *lprect, LPCSTR str, UINT count, const INT *lpDx ) -{ - INT wlen; - UINT codepage; - LPWSTR p = FONT_mbtowc(hdc, str, count, &wlen, &codepage); - BOOL ret; - LPINT lpDxW = NULL; - - if (lpDx) { - unsigned int i = 0, j = 0; - - lpDxW = (LPINT)HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(INT)); - while(i < count) { - if(IsDBCSLeadByteEx(codepage, str[i])) { - lpDxW[j++] = lpDx[i] + lpDx[i+1]; - i = i + 2; - } else { - lpDxW[j++] = lpDx[i]; - i = i + 1; - } - } - } - - ret = ExtTextOutW( hdc, x, y, flags, lprect, p, wlen, lpDxW ); - - HeapFree( GetProcessHeap(), 0, p ); - if (lpDxW) HeapFree( GetProcessHeap(), 0, lpDxW ); - return ret; -} - - -/*********************************************************************** - * ExtTextOutW (GDI32.@) - */ -BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, - const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) -{ - BOOL ret = FALSE; - DC * dc = DC_GetDCUpdate( hdc ); - if (dc) - { - if(PATH_IsPathOpen(dc->path)) - FIXME("called on an open path\n"); - else if(dc->funcs->pExtTextOut) - { - if( !(flags&(ETO_GLYPH_INDEX|ETO_IGNORELANGUAGE)) && BidiAvail && count>0 ) - { - /* The caller did not specify that language processing was already done. - */ - LPWSTR lpReorderedString=HeapAlloc(GetProcessHeap(), 0, count*sizeof(WCHAR)); - - BIDI_Reorder( str, count, GCP_REORDER, - ((flags&ETO_RTLREADING)!=0 || (GetTextAlign(hdc)&TA_RTLREADING)!=0)? - WINE_GCPW_FORCE_RTL:WINE_GCPW_FORCE_LTR, - lpReorderedString, count, NULL ); - - ret = dc->funcs->pExtTextOut(dc->physDev,x,y,flags|ETO_IGNORELANGUAGE, - lprect,lpReorderedString,count,lpDx,dc->breakExtra); - HeapFree(GetProcessHeap(), 0, lpReorderedString); - } else - ret = dc->funcs->pExtTextOut(dc->physDev,x,y,flags,lprect,str,count, - lpDx,dc->breakExtra); - } - GDI_ReleaseObj( hdc ); - } - return ret; -} - - -/*********************************************************************** - * TextOutA (GDI32.@) - */ -BOOL WINAPI TextOutA( HDC hdc, INT x, INT y, LPCSTR str, INT count ) -{ - return ExtTextOutA( hdc, x, y, 0, NULL, str, count, NULL ); -} - - -/*********************************************************************** - * TextOutW (GDI32.@) - */ -BOOL WINAPI TextOutW(HDC hdc, INT x, INT y, LPCWSTR str, INT count) -{ - return ExtTextOutW( hdc, x, y, 0, NULL, str, count, NULL ); -} - - -/*********************************************************************** - * PolyTextOutA (GDI32.@) - * - * Draw several Strings - */ -BOOL WINAPI PolyTextOutA ( - HDC hdc, /* [in] Handle to device context */ - PPOLYTEXTA pptxt, /* [in] Array of strings */ - INT cStrings /* [in] Number of strings in array */ - ) -{ - for (; cStrings>0; cStrings--, pptxt++) - if (!ExtTextOutA( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx )) - return FALSE; - return TRUE; -} - - - -/*********************************************************************** - * PolyTextOutW (GDI32.@) - * - * Draw several Strings - */ -BOOL WINAPI PolyTextOutW ( - HDC hdc, /* [in] Handle to device context */ - PPOLYTEXTW pptxt, /* [in] Array of strings */ - INT cStrings /* [in] Number of strings in array */ - ) -{ - for (; cStrings>0; cStrings--, pptxt++) - if (!ExtTextOutW( hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx )) - return FALSE; - return TRUE; -}