Author: fireball Date: Sun Jul 19 14:13:47 2009 New Revision: 42081
URL: http://svn.reactos.org/svn/reactos?rev=42081&view=rev Log: - Import a native GDI driver implementation. It uses custom win32k syscalls (RosGdi* and RosUser*) to achieve fast graphics output. Work in progress! Fully developed by me with some small code pieces taken from winex11.drv.
Added: branches/arwinss/reactos/dll/win32/winent.drv/ (with props) branches/arwinss/reactos/dll/win32/winent.drv/font.c (with props) branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c (with props) branches/arwinss/reactos/dll/win32/winent.drv/main.c (with props) branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c (with props) branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec (with props) branches/arwinss/reactos/dll/win32/winent.drv/winent.h (with props) branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild (with props) branches/arwinss/reactos/dll/win32/winent.drv/winent.rc (with props) Modified: branches/arwinss/reactos/dll/win32/win32.rbuild
Modified: branches/arwinss/reactos/dll/win32/win32.rbuild URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/win32.... ============================================================================== --- branches/arwinss/reactos/dll/win32/win32.rbuild [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/win32.rbuild [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -574,6 +574,9 @@ <directory name="winemp3.acm"> <xi:include href="winemp3.acm/winemp3.acm.rbuild" /> </directory> +<directory name="winent.drv"> + <xi:include href="winent.drv/winent.rbuild" /> +</directory> <directory name="winex11.drv"> <xi:include href="winex11.drv/winex11.rbuild" /> </directory>
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Sun Jul 19 14:13:47 2009 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: branches/arwinss/reactos/dll/win32/winent.drv/font.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/font.c (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/font.c [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,857 @@ +/* + * PROJECT: ReactOS + * LICENSE: LGPL + * FILE: dll/win32/winent.drv/font.c + * PURPOSE: Font Engine support functions + * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org) + */ + +/* INCLUDES ***************************************************************/ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "ntrosgdi.h" +#include "winent.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(rosgdidrv); + +static gsCacheEntry *glyphsetCache = NULL; +static DWORD glyphsetCacheSize = 0; +static INT lastfree = -1; +static INT mru = -1; + +#define INIT_CACHE_SIZE 10 + +static int antialias = 1; + +#define MS_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ + ( ( (ULONG)_x4 << 24 ) | \ + ( (ULONG)_x3 << 16 ) | \ + ( (ULONG)_x2 << 8 ) | \ + (ULONG)_x1 ) + +#define MS_GASP_TAG MS_MAKE_TAG('g', 'a', 's', 'p') + +#define GASP_GRIDFIT 0x01 +#define GASP_DOGRAY 0x02 + +#ifdef WORDS_BIGENDIAN +#define get_be_word(x) (x) +#define NATIVE_BYTE_ORDER MSBFirst +#else +//#define get_be_word(x) RtlUshortByteSwap(x) +static __inline USHORT get_be_word(USHORT s) +{ + return (s >> 8) | (s << 8); +} +#define NATIVE_BYTE_ORDER LSBFirst +#endif + +/* FUNCTIONS **************************************************************/ + +/*********************************************************************** + * RosDrv_XWStoDS + * + * Performs a world-to-viewport transformation on the specified width. + * Copyright 1993,1994 Alexandre Julliard + * Copyright 1998 Huw Davies + */ +INT RosDrv_XWStoDS( NTDRV_PDEVICE *physDev, INT width ) +{ + POINT pt[2]; + + pt[0].x = 0; + pt[0].y = 0; + pt[1].x = width; + pt[1].y = 0; + LPtoDP( physDev->hUserDC, pt, 2 ); + return pt[1].x - pt[0].x; +} + +/*********************************************************************** + * RosDrv_YWStoDS + * + * Performs a world-to-viewport transformation on the specified height. + * Copyright 1993,1994 Alexandre Julliard + * Copyright 1998 Huw Davies + */ +INT RosDrv_YWStoDS( NTDRV_PDEVICE *physDev, INT height ) +{ + POINT pt[2]; + + pt[0].x = 0; + pt[0].y = 0; + pt[1].x = 0; + pt[1].y = height; + LPtoDP( physDev->hUserDC, pt, 2 ); + return pt[1].y - pt[0].y; +} + +/* from winex11/xrender.c + * Copyright 2001, 2002 Huw D M Davies for CodeWeavers + */ + +static BOOL fontcmp(LFANDSIZE *p1, LFANDSIZE *p2) +{ + if(p1->hash != p2->hash) return TRUE; + if(memcmp(&p1->devsize, &p2->devsize, sizeof(p1->devsize))) return TRUE; + if(memcmp(&p1->xform, &p2->xform, sizeof(p1->xform))) return TRUE; + if(memcmp(&p1->lf, &p2->lf, offsetof(LOGFONTW, lfFaceName))) return TRUE; + return strcmpiW(p1->lf.lfFaceName, p2->lf.lfFaceName); +} + +static int LookupEntry(LFANDSIZE *plfsz) +{ + int i, prev_i = -1; + + for(i = mru; i >= 0; i = glyphsetCache[i].next) { + TRACE("%d\n", i); + if(glyphsetCache[i].count == -1) { /* reached free list so stop */ + i = -1; + break; + } + + if(!fontcmp(&glyphsetCache[i].lfsz, plfsz)) { + glyphsetCache[i].count++; + if(prev_i >= 0) { + glyphsetCache[prev_i].next = glyphsetCache[i].next; + glyphsetCache[i].next = mru; + mru = i; + } + TRACE("found font in cache %d\n", i); + return i; + } + prev_i = i; + } + TRACE("font not in cache\n"); + return -1; +} + +static void FreeEntry(int entry) +{ + int i, format; + + for(format = 0; format < AA_MAXVALUE; format++) { + gsCacheEntryFormat * formatEntry; + + if( !glyphsetCache[entry].format[format] ) + continue; + + formatEntry = glyphsetCache[entry].format[format]; + + //if(formatEntry->glyphset) { + //wine_tsx11_lock(); + //pXRenderFreeGlyphSet(gdi_display, formatEntry->glyphset); + //wine_tsx11_unlock(); + //formatEntry->glyphset = 0; + //} + if(formatEntry->nrealized) { + HeapFree(GetProcessHeap(), 0, formatEntry->realized); + formatEntry->realized = NULL; + if(formatEntry->bitmaps) { + for(i = 0; i < formatEntry->nrealized; i++) + HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps[i]); + HeapFree(GetProcessHeap(), 0, formatEntry->bitmaps); + formatEntry->bitmaps = NULL; + } + HeapFree(GetProcessHeap(), 0, formatEntry->gis); + formatEntry->gis = NULL; + formatEntry->nrealized = 0; + } + + HeapFree(GetProcessHeap(), 0, formatEntry); + glyphsetCache[entry].format[format] = NULL; + } +} + +static int AllocEntry(void) +{ + int best = -1, prev_best = -1, i, prev_i = -1; + + if(lastfree >= 0) { + //assert(glyphsetCache[lastfree].count == -1); + glyphsetCache[lastfree].count = 1; + best = lastfree; + lastfree = glyphsetCache[lastfree].next; + //assert(best != mru); + glyphsetCache[best].next = mru; + mru = best; + + TRACE("empty space at %d, next lastfree = %d\n", mru, lastfree); + return mru; + } + + for(i = mru; i >= 0; i = glyphsetCache[i].next) { + if(glyphsetCache[i].count == 0) { + best = i; + prev_best = prev_i; + } + prev_i = i; + } + + if(best >= 0) { + TRACE("freeing unused glyphset at cache %d\n", best); + FreeEntry(best); + glyphsetCache[best].count = 1; + if(prev_best >= 0) { + glyphsetCache[prev_best].next = glyphsetCache[best].next; + glyphsetCache[best].next = mru; + mru = best; + } else { + //assert(mru == best); + } + return mru; + } + + TRACE("Growing cache\n"); + + if (glyphsetCache) + glyphsetCache = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + glyphsetCache, + (glyphsetCacheSize + INIT_CACHE_SIZE) + * sizeof(*glyphsetCache)); + else + glyphsetCache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + (glyphsetCacheSize + INIT_CACHE_SIZE) + * sizeof(*glyphsetCache)); + + for(best = i = glyphsetCacheSize; i < glyphsetCacheSize + INIT_CACHE_SIZE; + i++) { + glyphsetCache[i].next = i + 1; + glyphsetCache[i].count = -1; + } + glyphsetCache[i-1].next = -1; + glyphsetCacheSize += INIT_CACHE_SIZE; + + lastfree = glyphsetCache[best].next; + glyphsetCache[best].count = 1; + glyphsetCache[best].next = mru; + mru = best; + TRACE("new free cache slot at %d\n", mru); + return mru; +} + +static BOOL get_gasp_flags(NTDRV_PDEVICE *physDev, WORD *flags) +{ + DWORD size; + WORD *gasp, *buffer; + WORD num_recs; + DWORD ppem; + TEXTMETRICW tm; + + *flags = 0; + + size = GetFontData(physDev->hUserDC, MS_GASP_TAG, 0, NULL, 0); + if(size == GDI_ERROR) + return FALSE; + + gasp = buffer = HeapAlloc(GetProcessHeap(), 0, size); + GetFontData(physDev->hUserDC, MS_GASP_TAG, 0, gasp, size); + + GetTextMetricsW(physDev->hUserDC, &tm); + ppem = abs(RosDrv_YWStoDS(physDev, tm.tmAscent + tm.tmDescent - tm.tmInternalLeading)); + + gasp++; + num_recs = get_be_word(*gasp); + gasp++; + while(num_recs--) + { + *flags = get_be_word(*(gasp + 1)); + if(ppem <= get_be_word(*gasp)) + break; + gasp += 2; + } + TRACE("got flags %04x for ppem %d\n", *flags, ppem); + + HeapFree(GetProcessHeap(), 0, buffer); + return TRUE; +} + +static AA_Type get_antialias_type( NTDRV_PDEVICE *physDev, BOOL subpixel, BOOL hinter) +{ + AA_Type ret; + WORD flags; + UINT font_smoothing_type, font_smoothing_orientation; + + if (SystemParametersInfoW( SPI_GETFONTSMOOTHINGTYPE, 0, &font_smoothing_type, 0) && + font_smoothing_type == FE_FONTSMOOTHINGCLEARTYPE) + { + if ( SystemParametersInfoW( SPI_GETFONTSMOOTHINGORIENTATION, 0, + &font_smoothing_orientation, 0) && + font_smoothing_orientation == FE_FONTSMOOTHINGORIENTATIONBGR) + { + ret = AA_BGR; + } + else + ret = AA_RGB; + /*FIXME + If the monitor is in portrait mode, ClearType is disabled in the MS Windows (MSDN). + But, Wine's subpixel rendering can support the portrait mode. + */ + } + else if (!hinter || !get_gasp_flags(physDev, &flags) || flags & GASP_DOGRAY) + ret = AA_Grey; + else + ret = AA_None; + + return ret; +} + +static int GetCacheEntry(NTDRV_PDEVICE *physDev, LFANDSIZE *plfsz) +{ + int ret; + int format; + gsCacheEntry *entry; + static int hinter = -1; + static int subpixel = -1; + BOOL font_smoothing; + + if((ret = LookupEntry(plfsz)) != -1) return ret; + + ret = AllocEntry(); + entry = glyphsetCache + ret; + entry->lfsz = *plfsz; + for( format = 0; format < AA_MAXVALUE; format++ ) { + //assert( !entry->format[format] ); + } + + if(antialias && plfsz->lf.lfQuality != NONANTIALIASED_QUALITY) + { + if(hinter == -1 || subpixel == -1) + { + RASTERIZER_STATUS status; + GetRasterizerCaps(&status, sizeof(status)); + hinter = status.wFlags & WINE_TT_HINTER_ENABLED; + subpixel = status.wFlags & WINE_TT_SUBPIXEL_RENDERING_ENABLED; + } + + switch (plfsz->lf.lfQuality) + { + case ANTIALIASED_QUALITY: + entry->aa_default = get_antialias_type( physDev, FALSE, hinter ); + break; + case CLEARTYPE_QUALITY: + case CLEARTYPE_NATURAL_QUALITY: + entry->aa_default = get_antialias_type( physDev, subpixel, hinter ); + break; + case DEFAULT_QUALITY: + case DRAFT_QUALITY: + case PROOF_QUALITY: + default: + if ( SystemParametersInfoW( SPI_GETFONTSMOOTHING, 0, &font_smoothing, 0) && + font_smoothing) + { + entry->aa_default = get_antialias_type( physDev, subpixel, hinter ); + } + else + entry->aa_default = AA_None; + break; + } + } + else + entry->aa_default = AA_None; + + return ret; +} + +static void dec_ref_cache(int index) +{ + //assert(index >= 0); + TRACE("dec'ing entry %d to %d\n", index, glyphsetCache[index].count - 1); + //assert(glyphsetCache[index].count > 0); + glyphsetCache[index].count--; +} + +static void lfsz_calc_hash(LFANDSIZE *plfsz) +{ + DWORD hash = 0, *ptr, two_chars; + WORD *pwc; + int i; + + hash ^= plfsz->devsize.cx; + hash ^= plfsz->devsize.cy; + for(i = 0, ptr = (DWORD*)&plfsz->xform; i < sizeof(XFORM)/sizeof(DWORD); i++, ptr++) + hash ^= *ptr; + for(i = 0, ptr = (DWORD*)&plfsz->lf; i < 7; i++, ptr++) + hash ^= *ptr; + for(i = 0, ptr = (DWORD*)plfsz->lf.lfFaceName; i < LF_FACESIZE/2; i++, ptr++) { + two_chars = *ptr; + pwc = (WCHAR *)&two_chars; + if(!*pwc) break; + *pwc = toupperW(*pwc); + pwc++; + *pwc = toupperW(*pwc); + hash ^= two_chars; + if(!*pwc) break; + } + plfsz->hash = hash; + return; +} + +/************************************************************************ + * UploadGlyph + * + * Helper to ExtTextOut. Must be called inside xrender_cs + */ +static BOOL UploadGlyph(NTDRV_PDEVICE *physDev, int glyph, AA_Type format) +{ + unsigned int buflen; + char *buf; + //Glyph gid; + GLYPHMETRICS gm; + GlyphInfo gi; + gsCacheEntry *entry = glyphsetCache + physDev->cache_index; + gsCacheEntryFormat *formatEntry; + UINT ggo_format = GGO_GLYPH_INDEX; + static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} }; + + switch(format) { + case AA_Grey: + ggo_format |= WINE_GGO_GRAY16_BITMAP; + break; + case AA_RGB: + ggo_format |= WINE_GGO_HRGB_BITMAP; + break; + case AA_BGR: + ggo_format |= WINE_GGO_HBGR_BITMAP; + break; + case AA_VRGB: + ggo_format |= WINE_GGO_VRGB_BITMAP; + break; + case AA_VBGR: + ggo_format |= WINE_GGO_VBGR_BITMAP; + break; + + default: + ERR("aa = %d - not implemented\n", format); + case AA_None: + ggo_format |= GGO_BITMAP; + break; + } + + buflen = GetGlyphOutlineW(physDev->hUserDC, glyph, ggo_format, &gm, 0, NULL, &identity); + if(buflen == GDI_ERROR) { + if(format != AA_None) { + format = AA_None; + entry->aa_default = AA_None; + ggo_format = GGO_GLYPH_INDEX | GGO_BITMAP; + buflen = GetGlyphOutlineW(physDev->hUserDC, glyph, ggo_format, &gm, 0, NULL, &identity); + } + if(buflen == GDI_ERROR) { + WARN("GetGlyphOutlineW failed\n"); + return FALSE; + } + TRACE("Turning off antialiasing for this monochrome font\n"); + } + + /* If there is nothing for the current type, we create the entry. */ + if( !entry->format[format] ) { + entry->format[format] = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(gsCacheEntryFormat)); + } + formatEntry = entry->format[format]; + + if(formatEntry->nrealized <= glyph) { + formatEntry->nrealized = (glyph / 128 + 1) * 128; + + if (formatEntry->realized) + formatEntry->realized = HeapReAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + formatEntry->realized, + formatEntry->nrealized * sizeof(BOOL)); + else + formatEntry->realized = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + formatEntry->nrealized * sizeof(BOOL)); + + if (formatEntry->bitmaps) + formatEntry->bitmaps = HeapReAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + formatEntry->bitmaps, + formatEntry->nrealized * sizeof(formatEntry->bitmaps[0])); + else + formatEntry->bitmaps = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + formatEntry->nrealized * sizeof(formatEntry->bitmaps[0])); + if (formatEntry->gis) + formatEntry->gis = HeapReAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + formatEntry->gis, + formatEntry->nrealized * sizeof(formatEntry->gis[0])); + else + formatEntry->gis = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + formatEntry->nrealized * sizeof(formatEntry->gis[0])); + } + + buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen); + GetGlyphOutlineW(physDev->hUserDC, glyph, ggo_format, &gm, buflen, buf, &identity); + formatEntry->realized[glyph] = TRUE; + + TRACE("buflen = %d. Got metrics: %dx%d adv=%d,%d origin=%d,%d\n", + buflen, + gm.gmBlackBoxX, gm.gmBlackBoxY, gm.gmCellIncX, gm.gmCellIncY, + gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y); + + gi.width = gm.gmBlackBoxX; + gi.height = gm.gmBlackBoxY; + gi.x = -gm.gmptGlyphOrigin.x; + gi.y = gm.gmptGlyphOrigin.y; + gi.xOff = gm.gmCellIncX; + gi.yOff = gm.gmCellIncY; + +#if 0 + if(TRACE_ON(xrender)) { + int pitch, i, j; + char output[300]; + unsigned char *line; + + if(format == AA_None) { + pitch = ((gi.width + 31) / 32) * 4; + for(i = 0; i < gi.height; i++) { + line = (unsigned char*) buf + i * pitch; + output[0] = '\0'; + for(j = 0; j < pitch * 8; j++) { + strcat(output, (line[j / 8] & (1 << (7 - (j % 8)))) ? "#" : " "); + } + TRACE("%s\n", output); + } + } else { + static const char blks[] = " .:;!o*#"; + char str[2]; + + str[1] = '\0'; + pitch = ((gi.width + 3) / 4) * 4; + for(i = 0; i < gi.height; i++) { + line = (unsigned char*) buf + i * pitch; + output[0] = '\0'; + for(j = 0; j < pitch; j++) { + str[0] = blks[line[j] >> 5]; + strcat(output, str); + } + TRACE("%s\n", output); + } + } + } +#endif + + formatEntry->bitmaps[glyph] = buf; + formatEntry->gis[glyph] = gi; + + return TRUE; +} + + +VOID +FeSelectFont(NTDRV_PDEVICE *physDev, HFONT hfont) +{ + LFANDSIZE lfsz; + + GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf); + TRACE("h=%d w=%d weight=%d it=%d charset=%d name=%s\n", + lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight, + lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName)); + lfsz.lf.lfWidth = abs( lfsz.lf.lfWidth ); + lfsz.devsize.cx = RosDrv_XWStoDS( physDev, lfsz.lf.lfWidth ); + lfsz.devsize.cy = RosDrv_YWStoDS( physDev, lfsz.lf.lfHeight ); + GetWorldTransform( physDev->hUserDC, &lfsz.xform ); + lfsz_calc_hash(&lfsz); + + /*EnterCriticalSection(&xrender_cs);*/ + if (physDev->cache_index != -1) + dec_ref_cache(physDev->cache_index); + physDev->cache_index = GetCacheEntry(physDev, &lfsz); + /*LeaveCriticalSection(&xrender_cs);*/ +} + +BOOL FeTextOut( NTDRV_PDEVICE *physDev, INT x, INT y, UINT flags, + const RECT *lprect, LPCWSTR wstr, UINT count, + const INT *lpDx ) +{ + //RGNDATA *data; + //XGCValues xgcval; + gsCacheEntry *entry; + gsCacheEntryFormat *formatEntry; + BOOL retv = FALSE; + //HDC hdc = physDev->hUserDC; + //int textPixel, backgroundPixel; + //HRGN saved_region = 0; + BOOL disable_antialias = FALSE; + AA_Type aa_type = AA_None; + //DIBSECTION bmp; + unsigned int idx; + double cosEsc, sinEsc; + LOGFONTW lf; + //enum drawable_depth_type depth_type = (physDev->depth == 1) ? mono_drawable : color_drawable; + //Picture tile_pict = 0; + + /* Do we need to disable antialiasing because of palette mode? */ +#if 0 + if( !physDev->bitmap || GetObjectW( physDev->bitmap->hbitmap, sizeof(bmp), &bmp ) != sizeof(bmp) ) { + TRACE("bitmap is not a DIB\n"); + } + else if (bmp.dsBmih.biBitCount <= 8) { + TRACE("Disabling antialiasing\n"); + disable_antialias = TRUE; + } +#endif + + //RosDrv_LockDIBSection( physDev, DIB_Status_GdiMod ); + +#if 0 + if(physDev->depth == 1) { + if((physDev->textPixel & 0xffffff) == 0) { + textPixel = 0; + backgroundPixel = 1; + } else { + textPixel = 1; + backgroundPixel = 0; + } + } else { + textPixel = physDev->textPixel; + backgroundPixel = physDev->backgroundPixel; + } +#endif + + if(flags & ETO_OPAQUE) + { +#if 0 + wine_tsx11_lock(); + XSetForeground( gdi_display, physDev->gc, backgroundPixel ); + XFillRectangle( gdi_display, physDev->drawable, physDev->gc, + physDev->dc_rect.left + lprect->left, physDev->dc_rect.top + lprect->top, + lprect->right - lprect->left, lprect->bottom - lprect->top ); + wine_tsx11_unlock(); +#endif + } + + if(count == 0) + { + retv = TRUE; + goto done_unlock; + } + + + GetObjectW(GetCurrentObject(physDev->hUserDC, OBJ_FONT), sizeof(lf), &lf); + if(lf.lfEscapement != 0) { + cosEsc = cos(lf.lfEscapement * M_PI / 1800); + sinEsc = sin(lf.lfEscapement * M_PI / 1800); + } else { + cosEsc = 1; + sinEsc = 0; + } + + if (flags & ETO_CLIPPED) + { + HRGN clip_region; + + clip_region = CreateRectRgnIndirect( lprect ); +#if 0 + /* make a copy of the current device region */ + saved_region = CreateRectRgn( 0, 0, 0, 0 ); + CombineRgn( saved_region, physDev->region, 0, RGN_COPY ); + RosDrv_SetDeviceClipping( physDev, saved_region, clip_region ); +#endif + DeleteObject( clip_region ); + } + + //EnterCriticalSection(&xrender_cs); + + entry = glyphsetCache + physDev->cache_index; + if( disable_antialias == FALSE ) + aa_type = entry->aa_default; + formatEntry = entry->format[aa_type]; + + for(idx = 0; idx < count; idx++) { + if( !formatEntry ) { + UploadGlyph(physDev, wstr[idx], aa_type); + /* re-evaluate antialias since aa_default may have changed */ + if( disable_antialias == FALSE ) + aa_type = entry->aa_default; + formatEntry = entry->format[aa_type]; + } else if( wstr[idx] >= formatEntry->nrealized || formatEntry->realized[wstr[idx]] == FALSE) { + UploadGlyph(physDev, wstr[idx], aa_type); + } + } + if (!formatEntry) + { + WARN("could not upload requested glyphs\n"); + //LeaveCriticalSection(&xrender_cs); + goto done_unlock; + } + + TRACE("Writing %s at %d,%d\n", debugstr_wn(wstr,count), + /*physDev->dc_rect.left +*/ x, /*physDev->dc_rect.top +*/ y); + + RosGdiExtTextOut(physDev->hKernelDC, x, y, flags, lprect, wstr, count, lpDx, formatEntry); + +#if 0 + { + INT offset = 0, xoff = 0, yoff = 0; + wine_tsx11_lock(); + XSetForeground( gdi_display, physDev->gc, textPixel ); + + if(aa_type == AA_None || physDev->depth == 1) + { + void (* sharp_glyph_fn)(X11DRV_PDEVICE *, INT, INT, void *, XGlyphInfo *); + + if(aa_type == AA_None) + sharp_glyph_fn = SharpGlyphMono; + else + sharp_glyph_fn = SharpGlyphGray; + + for(idx = 0; idx < count; idx++) { + sharp_glyph_fn(physDev, physDev->dc_rect.left + x + xoff, + physDev->dc_rect.top + y + yoff, + formatEntry->bitmaps[wstr[idx]], + &formatEntry->gis[wstr[idx]]); + if(lpDx) { + offset += lpDx[idx]; + xoff = offset * cosEsc; + yoff = offset * -sinEsc; + } else { + xoff += formatEntry->gis[wstr[idx]].xOff; + yoff += formatEntry->gis[wstr[idx]].yOff; + } + } + } else { + XImage *image; + int image_x, image_y, image_off_x, image_off_y, image_w, image_h; + RECT extents = {0, 0, 0, 0}; + POINT cur = {0, 0}; + int w = physDev->drawable_rect.right - physDev->drawable_rect.left; + int h = physDev->drawable_rect.bottom - physDev->drawable_rect.top; + + TRACE("drawable %dx%d\n", w, h); + + for(idx = 0; idx < count; idx++) { + if(extents.left > cur.x - formatEntry->gis[wstr[idx]].x) + extents.left = cur.x - formatEntry->gis[wstr[idx]].x; + if(extents.top > cur.y - formatEntry->gis[wstr[idx]].y) + extents.top = cur.y - formatEntry->gis[wstr[idx]].y; + if(extents.right < cur.x - formatEntry->gis[wstr[idx]].x + formatEntry->gis[wstr[idx]].width) + extents.right = cur.x - formatEntry->gis[wstr[idx]].x + formatEntry->gis[wstr[idx]].width; + if(extents.bottom < cur.y - formatEntry->gis[wstr[idx]].y + formatEntry->gis[wstr[idx]].height) + extents.bottom = cur.y - formatEntry->gis[wstr[idx]].y + formatEntry->gis[wstr[idx]].height; + if(lpDx) { + offset += lpDx[idx]; + cur.x = offset * cosEsc; + cur.y = offset * -sinEsc; + } else { + cur.x += formatEntry->gis[wstr[idx]].xOff; + cur.y += formatEntry->gis[wstr[idx]].yOff; + } + } + TRACE("glyph extents %d,%d - %d,%d drawable x,y %d,%d\n", extents.left, extents.top, + extents.right, extents.bottom, physDev->dc_rect.left + x, physDev->dc_rect.top + y); + + if(physDev->dc_rect.left + x + extents.left >= 0) { + image_x = physDev->dc_rect.left + x + extents.left; + image_off_x = 0; + } else { + image_x = 0; + image_off_x = physDev->dc_rect.left + x + extents.left; + } + if(physDev->dc_rect.top + y + extents.top >= 0) { + image_y = physDev->dc_rect.top + y + extents.top; + image_off_y = 0; + } else { + image_y = 0; + image_off_y = physDev->dc_rect.top + y + extents.top; + } + if(physDev->dc_rect.left + x + extents.right < w) + image_w = physDev->dc_rect.left + x + extents.right - image_x; + else + image_w = w - image_x; + if(physDev->dc_rect.top + y + extents.bottom < h) + image_h = physDev->dc_rect.top + y + extents.bottom - image_y; + else + image_h = h - image_y; + + if(image_w <= 0 || image_h <= 0) goto no_image; + + X11DRV_expect_error(gdi_display, XRenderErrorHandler, NULL); + image = XGetImage(gdi_display, physDev->drawable, + image_x, image_y, image_w, image_h, + AllPlanes, ZPixmap); + X11DRV_check_error(); + + TRACE("XGetImage(%p, %x, %d, %d, %d, %d, %lx, %x) depth = %d rets %p\n", + gdi_display, (int)physDev->drawable, image_x, image_y, + image_w, image_h, AllPlanes, ZPixmap, + physDev->depth, image); + if(!image) { + Pixmap xpm = XCreatePixmap(gdi_display, root_window, image_w, image_h, + physDev->depth); + GC gc; + XGCValues gcv; + + gcv.graphics_exposures = False; + gc = XCreateGC(gdi_display, xpm, GCGraphicsExposures, &gcv); + XCopyArea(gdi_display, physDev->drawable, xpm, gc, image_x, image_y, + image_w, image_h, 0, 0); + XFreeGC(gdi_display, gc); + X11DRV_expect_error(gdi_display, XRenderErrorHandler, NULL); + image = XGetImage(gdi_display, xpm, 0, 0, image_w, image_h, AllPlanes, + ZPixmap); + X11DRV_check_error(); + XFreePixmap(gdi_display, xpm); + } + if(!image) goto no_image; + + image->red_mask = visual->red_mask; + image->green_mask = visual->green_mask; + image->blue_mask = visual->blue_mask; + + offset = xoff = yoff = 0; + for(idx = 0; idx < count; idx++) { + SmoothGlyphGray(image, xoff + image_off_x - extents.left, + yoff + image_off_y - extents.top, + formatEntry->bitmaps[wstr[idx]], + &formatEntry->gis[wstr[idx]], + physDev->textPixel); + if(lpDx) { + offset += lpDx[idx]; + xoff = offset * cosEsc; + yoff = offset * -sinEsc; + } else { + xoff += formatEntry->gis[wstr[idx]].xOff; + yoff += formatEntry->gis[wstr[idx]].yOff; + } + } + XPutImage(gdi_display, physDev->drawable, physDev->gc, image, 0, 0, + image_x, image_y, image_w, image_h); + XDestroyImage(image); + } +no_image: + wine_tsx11_unlock(); + } +#endif + //LeaveCriticalSection(&xrender_cs); + + if (flags & ETO_CLIPPED) + { + /* restore the device region */ +#if 0 + RosDrv_SetDeviceClipping( physDev, saved_region, 0 ); + DeleteObject( saved_region ); +#endif + } + + retv = TRUE; + +done_unlock: + //RosDrv_UnlockDIBSection( physDev, TRUE ); + return retv; +} + +/* EOF */
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/font.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,679 @@ +/* + * PROJECT: ReactOS + * LICENSE: LGPL + * FILE: dll/win32/winent.drv/gdidrv.c + * PURPOSE: GDI driver stub for ReactOS/Windows + * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org) + */ + +/* INCLUDES ***************************************************************/ + +#include <stdarg.h> +#include <stdio.h> +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "ntrosgdi.h" +#include "winent.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(rosgdidrv); + +/* FUNCTIONS **************************************************************/ + +BOOL CDECL RosDrv_AlphaBlend(NTDRV_PDEVICE *devDst, INT xDst, INT yDst, INT widthDst, INT heightDst, + NTDRV_PDEVICE *devSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, + BLENDFUNCTION blendfn) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_Arc( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, + INT xstart, INT ystart, INT xend, INT yend ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_BitBlt( NTDRV_PDEVICE *physDevDst, INT xDst, INT yDst, + INT width, INT height, NTDRV_PDEVICE *physDevSrc, + INT xSrc, INT ySrc, DWORD rop ) +{ + return RosGdiBitBlt(physDevDst->hKernelDC, xDst, yDst, width, height, + physDevSrc->hKernelDC, xSrc, ySrc, rop); +} + +int CDECL RosDrv_ChoosePixelFormat(NTDRV_PDEVICE *physDev, + const PIXELFORMATDESCRIPTOR *ppfd) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_Chord( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, + INT xstart, INT ystart, INT xend, INT yend ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_CreateBitmap( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID bmBits ) +{ + BITMAP bitmap; + + /* Get the usermode object */ + if (!GetObjectW(hbitmap, sizeof(bitmap), &bitmap)) return FALSE; + + /* Check parameters */ + if (bitmap.bmPlanes != 1) return FALSE; + + /* Create the kernelmode bitmap object */ + return RosGdiCreateBitmap(physDev->hKernelDC, hbitmap, &bitmap, bmBits); +} + +BOOL CDECL RosDrv_CreateDC( HDC hdc, NTDRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device, + LPCWSTR output, const DEVMODEW* initData ) +{ + BOOL bRet; + double scaleX, scaleY; + ROS_DCINFO dcInfo = {0}; + NTDRV_PDEVICE *physDev; + HDC hKernelDC; + + /* Allocate memory for two handles */ + physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ); + if (!physDev) return FALSE; + + /* Fill in internal DCINFO structure */ + dcInfo.dwType = GetObjectType(hdc); + GetWorldTransform(hdc, &dcInfo.xfWorld2Wnd); + GetViewportExtEx(hdc, &dcInfo.szVportExt); + GetViewportOrgEx(hdc, &dcInfo.ptVportOrg); + GetWindowExtEx(hdc, &dcInfo.szWndExt); + GetWindowOrgEx(hdc, &dcInfo.ptWndOrg); + + /* Calculate xfWnd2Vport */ + scaleX = (double)dcInfo.szVportExt.cx / (double)dcInfo.szWndExt.cx; + scaleY = (double)dcInfo.szVportExt.cy / (double)dcInfo.szWndExt.cy; + dcInfo.xfWnd2Vport.eM11 = scaleX; + dcInfo.xfWnd2Vport.eM12 = 0.0; + dcInfo.xfWnd2Vport.eM21 = 0.0; + dcInfo.xfWnd2Vport.eM22 = scaleY; + dcInfo.xfWnd2Vport.eDx = (double)dcInfo.ptVportOrg.x - + scaleX * (double)dcInfo.ptWndOrg.x; + dcInfo.xfWnd2Vport.eDy = (double)dcInfo.ptVportOrg.y - + scaleY * (double)dcInfo.ptWndOrg.y; + + /* The following part is done in kernel mode */ +#if 0 + /* Combine with the world transformation */ + CombineTransform( &dc->xformWorld2Vport, &dc->xformWorld2Wnd, + &xformWnd2Vport ); + + /* Create inverse of world-to-viewport transformation */ + dc->vport2WorldValid = DC_InvertXform( &dc->xformWorld2Vport, + &dc->xformVport2World ); +#endif + + /* Save DC handle if it's a compatible one or set it to NULL for + a display DC */ + if (*pdev) + hKernelDC = (*pdev)->hKernelDC; + else + hKernelDC = 0; + + /* Call the win32 kernel */ + bRet = RosGdiCreateDC(&dcInfo, &hKernelDC, driver, device, output, initData); + + /* Save newly created DC */ + physDev->hKernelDC = hKernelDC; + physDev->hUserDC = hdc; + + /* No font is selected */ + physDev->cache_index = -1; + + /* Return allocated physical DC to the caller */ + *pdev = physDev; + + return bRet; +} + +HBITMAP CDECL RosDrv_CreateDIBSection( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, + const BITMAPINFO *bmi, UINT usage ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_DeleteBitmap( HBITMAP hbitmap ) +{ + return RosGdiDeleteBitmap(hbitmap); +} + +BOOL CDECL RosDrv_DeleteDC( NTDRV_PDEVICE *physDev ) +{ + BOOL res; + + /* Delete kernel DC */ + res = RosGdiDeleteDC(physDev->hKernelDC); + + /* Free the um/km handle pair memory */ + HeapFree( GetProcessHeap(), 0, physDev ); + + /* Return result */ + return res; +} + +int CDECL RosDrv_DescribePixelFormat(NTDRV_PDEVICE *physDev, + int iPixelFormat, + UINT nBytes, + PIXELFORMATDESCRIPTOR *ppfd) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_Ellipse( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_EnumDeviceFonts( NTDRV_PDEVICE *physDev, LPLOGFONTW plf, + FONTENUMPROCW proc, LPARAM lp ) +{ + UNIMPLEMENTED; + return FALSE; +} + +INT CDECL RosDrv_ExtEscape( NTDRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID in_data, + INT out_count, LPVOID out_data ) +{ + RECT dc_rect; + switch(escape) + { + case NTDRV_ESCAPE: + if (in_data && in_count >= sizeof(enum ntdrv_escape_codes)) + { + switch(*(const enum ntdrv_escape_codes *)in_data) + { + case NTDRV_SET_DRAWABLE: + if (in_count >= sizeof(struct ntdrv_escape_set_drawable)) + { + const struct ntdrv_escape_set_drawable *data = in_data; + dc_rect = data->dc_rect; + RosGdiSetDcRect(physDev->hKernelDC, &dc_rect); + //physDev->dc_rect = data->dc_rect; + //physDev->drawable = data->drawable; + //physDev->drawable_rect = data->drawable_rect; + //TRACE( "SET_DRAWABLE hdc %p drawable %lx gl_drawable %lx pf %u dc_rect %s drawable_rect %s\n", + // physDev->hdc, physDev->drawable, physDev->gl_drawable, physDev->current_pf, + // wine_dbgstr_rect(&physDev->dc_rect), wine_dbgstr_rect(&physDev->drawable_rect) ); + return TRUE; + } + break; + default: + ERR("ExtEscape NTDRV_ESCAPE case %d is unimplemented!\n", *((DWORD *)in_data)); + } + } + default: + ERR("ExtEscape for escape %d is unimplemented!\n", escape); + } + + return 0; +} + +BOOL CDECL RosDrv_ExtFloodFill( NTDRV_PDEVICE *physDev, INT x, INT y, COLORREF color, + UINT fillType ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_ExtTextOut( NTDRV_PDEVICE *physDev, INT x, INT y, UINT flags, + const RECT *lprect, LPCWSTR wstr, UINT count, + const INT *lpDx ) +{ + //if (physDev->has_gdi_font) + return FeTextOut(physDev, x, y, flags, lprect, wstr, count, lpDx); + + //UNIMPLEMENTED; + //return FALSE; +} + +LONG CDECL RosDrv_GetBitmapBits( HBITMAP hbitmap, void *buffer, LONG count ) +{ + return RosGdiGetBitmapBits(hbitmap, buffer, count); +} + +BOOL CDECL RosDrv_GetCharWidth( NTDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar, + LPINT buffer ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_GetDCOrgEx( NTDRV_PDEVICE *physDev, LPPOINT lpp ) +{ + UNIMPLEMENTED; + return FALSE; +} + +INT CDECL RosDrv_GetDIBits( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan, UINT lines, + LPVOID bits, BITMAPINFO *info, UINT coloruse ) +{ + UNIMPLEMENTED; + return 0; +} + +INT CDECL RosDrv_GetDeviceCaps( NTDRV_PDEVICE *physDev, INT cap ) +{ + return RosGdiGetDeviceCaps(physDev->hKernelDC, cap); +} + +BOOL CDECL RosDrv_GetDeviceGammaRamp(NTDRV_PDEVICE *physDev, LPVOID ramp) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_GetICMProfile( NTDRV_PDEVICE *physDev, LPDWORD size, LPWSTR filename ) +{ + UNIMPLEMENTED; + return FALSE; +} + +COLORREF CDECL RosDrv_GetNearestColor( NTDRV_PDEVICE *physDev, COLORREF color ) +{ + UNIMPLEMENTED; + return 0; +} + +COLORREF CDECL RosDrv_GetPixel( NTDRV_PDEVICE *physDev, INT x, INT y ) +{ + UNIMPLEMENTED; + return 0; +} + +int CDECL RosDrv_GetPixelFormat(NTDRV_PDEVICE *physDev) +{ + UNIMPLEMENTED; + return 0; +} + +UINT CDECL RosDrv_GetSystemPaletteEntries( NTDRV_PDEVICE *physDev, UINT start, UINT count, + LPPALETTEENTRY entries ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_GetTextExtentExPoint( NTDRV_PDEVICE *physDev, LPCWSTR str, INT count, + INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_GetTextMetrics(NTDRV_PDEVICE *physDev, TEXTMETRICW *metrics) +{ + UNIMPLEMENTED; + + // HACK + metrics->tmMaxCharWidth = 9; + metrics->tmHeight = 18; + metrics->tmExternalLeading = 0; + + + return TRUE; + //return FALSE; +} + +BOOL CDECL RosDrv_LineTo( NTDRV_PDEVICE *physDev, INT x, INT y ) +{ + POINT pt[2]; + + /* Get current cursor position */ + GetCurrentPositionEx( physDev->hUserDC, &pt[0] ); + + /* Convert both points coordinates to device */ + pt[1].x = x; + pt[1].y = y; + LPtoDP( physDev->hUserDC, pt, 2 ); + + /* Draw the line */ + return RosGdiLineTo(physDev->hKernelDC, pt[0].x, pt[0].y, pt[1].x, pt[1].y); +} + +BOOL CDECL RosDrv_PaintRgn( NTDRV_PDEVICE *physDev, HRGN hrgn ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_PatBlt( NTDRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop ) +{ + return RosGdiPatBlt(physDev->hKernelDC, left, top, width, height, rop); +} + +BOOL CDECL RosDrv_Pie( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, + INT xstart, INT ystart, INT xend, INT yend ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_PolyPolygon( NTDRV_PDEVICE *physDev, const POINT* pt, const INT* counts, UINT polygons) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_PolyPolyline( NTDRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_Polygon( NTDRV_PDEVICE *physDev, const POINT* pt, INT count ) +{ + register int i; + POINT *points; + + if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (count+1) ))) + { + WARN("No memory to convert POINTs!\n"); + return FALSE; + } + for (i = 0; i < count; i++) + { + POINT tmp = pt[i]; + LPtoDP(physDev->hUserDC, &tmp, 1); + points[i].x = tmp.x; + points[i].y = tmp.y; + } + points[count] = points[0]; + + /* Call kernel mode */ + RosGdiPolygon(physDev->hKernelDC, points, count+1); + + HeapFree( GetProcessHeap(), 0, points ); + return TRUE; +} + +BOOL CDECL RosDrv_Polyline( NTDRV_PDEVICE *physDev, const POINT* pt, INT count ) +{ + register int i; + POINT *points; + + if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * count ))) + { + WARN("No memory to convert POINTs!\n"); + return FALSE; + } + for (i = 0; i < count; i++) + { + POINT tmp = pt[i]; + LPtoDP(physDev->hUserDC, &tmp, 1); + points[i].x = tmp.x; + points[i].y = tmp.y; + } + + /* Call kernel mode */ + RosGdiPolyline(physDev->hKernelDC, points, count); + + HeapFree( GetProcessHeap(), 0, points ); + return TRUE; +} + +UINT CDECL RosDrv_RealizeDefaultPalette( NTDRV_PDEVICE *physDev ) +{ + UNIMPLEMENTED; + return FALSE; +} + +UINT CDECL RosDrv_RealizePalette( NTDRV_PDEVICE *physDev, HPALETTE hpal, BOOL primary ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_Rectangle(NTDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom) +{ + RECT rc; + + /* Convert coordinates */ + SetRect(&rc, left, top, right, bottom); + LPtoDP(physDev->hUserDC, (POINT*)&rc, 2); + + if ((rc.left == rc.right) || (rc.top == rc.bottom)) return TRUE; + + if (rc.right < rc.left) { INT tmp = rc.right; rc.right = rc.left; rc.left = tmp; } + if (rc.bottom < rc.top) { INT tmp = rc.bottom; rc.bottom = rc.top; rc.top = tmp; } + + RosGdiRectangle(physDev->hKernelDC, &rc); + + return TRUE; +} + +BOOL CDECL RosDrv_RoundRect( NTDRV_PDEVICE *physDev, INT left, INT top, INT right, + INT bottom, INT ell_width, INT ell_height ) +{ + UNIMPLEMENTED; + return FALSE; +} + +HBITMAP CDECL RosDrv_SelectBitmap( NTDRV_PDEVICE *physDev, HBITMAP hbitmap ) +{ + RosGdiSelectBitmap(physDev->hKernelDC, hbitmap); + + return hbitmap; +} + +HBRUSH CDECL RosDrv_SelectBrush( NTDRV_PDEVICE *physDev, HBRUSH hbrush ) +{ + LOGBRUSH logbrush; + + if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0; + + RosGdiSelectBrush(physDev->hKernelDC, &logbrush); + + return hbrush; +} + +HFONT CDECL RosDrv_SelectFont( NTDRV_PDEVICE *physDev, HFONT hfont, HANDLE gdiFont ) +{ + /* We don't have a kernelmode font engine */ + if (gdiFont == 0) + { + UNIMPLEMENTED; + //RosGdiSelectFont(physDev->hKernelDC, hfont, gdiFont); + } + else + { + /* Save information about the selected font */ + FeSelectFont(physDev, hfont); + } + + /* Indicate that gdiFont is good to use */ + return 0; +} + +HPEN CDECL RosDrv_SelectPen( NTDRV_PDEVICE *physDev, HPEN hpen ) +{ + LOGPEN logpen; + EXTLOGPEN *elogpen = NULL; + INT size; + + /* Try to get LOGPEN */ + if (!GetObjectW( hpen, sizeof(logpen), &logpen )) + { + /* It may be an ext pen, get its size */ + size = GetObjectW( hpen, 0, NULL ); + if (!size) return 0; + + elogpen = HeapAlloc( GetProcessHeap(), 0, size ); + + GetObjectW( hpen, size, elogpen ); + } + + /* If it's a stock object, then use DC's color */ + if (hpen == GetStockObject( DC_PEN )) + logpen.lopnColor = GetDCPenColor(physDev->hUserDC); + + /* Call kernelmode */ + RosGdiSelectPen(physDev->hKernelDC, &logpen, elogpen); + + /* Free ext logpen memory if it was allocated */ + if (elogpen) HeapFree( GetProcessHeap(), 0, elogpen ); + + /* Return success */ + return hpen; +} + +LONG CDECL RosDrv_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count ) +{ + UNIMPLEMENTED; + return 0; +} + +COLORREF CDECL RosDrv_SetBkColor( NTDRV_PDEVICE *physDev, COLORREF color ) +{ + return RosGdiSetBkColor(physDev->hKernelDC, color); +} + +COLORREF CDECL RosDrv_SetDCBrushColor( NTDRV_PDEVICE *physDev, COLORREF crColor ) +{ + UNIMPLEMENTED; + return 0; +} + +DWORD CDECL RosDrv_SetDCOrg( NTDRV_PDEVICE *physDev, INT x, INT y ) +{ + UNIMPLEMENTED; + return 0; +} + +COLORREF CDECL RosDrv_SetDCPenColor( NTDRV_PDEVICE *physDev, COLORREF crColor ) +{ + UNIMPLEMENTED; + return 0; +} + +UINT CDECL RosDrv_SetDIBColorTable( NTDRV_PDEVICE *physDev, UINT start, UINT count, const RGBQUAD *colors ) +{ + UNIMPLEMENTED; + return 0; +} + +INT CDECL RosDrv_SetDIBits( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan, + UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse ) +{ + return RosGdiSetDIBits(physDev->hKernelDC, hbitmap, startscan, lines, bits, info, coloruse); +} + +INT CDECL RosDrv_SetDIBitsToDevice( NTDRV_PDEVICE *physDev, INT xDest, INT yDest, DWORD cx, + DWORD cy, INT xSrc, INT ySrc, + UINT startscan, UINT lines, LPCVOID bits, + const BITMAPINFO *info, UINT coloruse ) +{ + UNIMPLEMENTED; + return 0; +} + +void CDECL RosDrv_SetDeviceClipping( NTDRV_PDEVICE *physDev, HRGN vis_rgn, HRGN clip_rgn ) +{ + RGNDATA *data; + HRGN dc_rgn; + DWORD size; + + /* Create a dummy region (FIXME: create it once!) */ + dc_rgn = CreateRectRgn(0,0,0,0); + if (!dc_rgn) return; + + /* Update dcRegion to become a combined region */ + CombineRgn( dc_rgn, vis_rgn, clip_rgn, clip_rgn ? RGN_AND : RGN_COPY ); + + /* Get region data size */ + if (!(size = GetRegionData( dc_rgn, 0, NULL ))) + { + DeleteObject(dc_rgn); + return; + } + + /* Allocate memory for it */ + if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) + { + DeleteObject(dc_rgn); + return; + } + + /* Get region data */ + if (!GetRegionData( dc_rgn, size, data )) + { + HeapFree( GetProcessHeap(), 0, data ); + DeleteObject(dc_rgn); + return; + } + + // FIXME: What to do with origin? + //XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top, + // (XRectangle *)data->Buffer, data->rdh.nCount, YXBanded ); + + /* Set clipping */ + RosGdiSetDeviceClipping(physDev->hKernelDC, data->rdh.nCount, (RECTL *)data->Buffer, (RECTL *)&data->rdh.rcBound); + + /* Free memory and delete clipping region */ + HeapFree( GetProcessHeap(), 0, data ); + DeleteObject(dc_rgn); +} + +BOOL CDECL RosDrv_SetDeviceGammaRamp(NTDRV_PDEVICE *physDev, LPVOID ramp) +{ + UNIMPLEMENTED; + return FALSE; +} + +COLORREF CDECL RosDrv_SetPixel( NTDRV_PDEVICE *physDev, INT x, INT y, COLORREF color ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_SetPixelFormat(NTDRV_PDEVICE *physDev, + int iPixelFormat, + const PIXELFORMATDESCRIPTOR *ppfd) +{ + UNIMPLEMENTED; + return FALSE; +} + +COLORREF CDECL RosDrv_SetTextColor( NTDRV_PDEVICE *physDev, COLORREF color ) +{ + return RosGdiSetTextColor(physDev->hKernelDC, color); +} + +BOOL CDECL RosDrv_StretchBlt( NTDRV_PDEVICE *physDevDst, INT xDst, INT yDst, + INT widthDst, INT heightDst, + NTDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, + INT widthSrc, INT heightSrc, DWORD rop ) +{ + return RosGdiStretchBlt(physDevDst->hKernelDC, xDst, yDst, widthDst, heightDst, + physDevSrc->hKernelDC, xSrc, ySrc, widthSrc, heightSrc, rop); +} + +BOOL CDECL RosDrv_SwapBuffers(NTDRV_PDEVICE *physDev) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_UnrealizePalette( HPALETTE hpal ) +{ + UNIMPLEMENTED; + return FALSE; +} + +/* EOF */
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/arwinss/reactos/dll/win32/winent.drv/main.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/main.c (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/main.c [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,88 @@ +/* + * PROJECT: ReactOS + * LICENSE: LGPL + * FILE: dll/win32/winent.drv/userdrv.c + * PURPOSE: User driver stub for ReactOS/Windows + * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org) + */ + +/* INCLUDES ***************************************************************/ + +#include <stdarg.h> +#include <stdio.h> +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "shellapi.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(rosuserdrv); + +static CRITICAL_SECTION NTDRV_CritSection; + + +/* FUNCTIONS **************************************************************/ + + +/*********************************************************************** + * wine_tsx11_lock (X11DRV.@) + */ +void CDECL wine_tsx11_lock(void) +{ + EnterCriticalSection( &NTDRV_CritSection ); +} + +/*********************************************************************** + * wine_tsx11_unlock (X11DRV.@) + */ +void CDECL wine_tsx11_unlock(void) +{ + LeaveCriticalSection( &NTDRV_CritSection ); +} + +/*********************************************************************** + * X11DRV_create_desktop + * + * Create the X11 desktop window for the desktop mode. + */ +UINT CDECL RosDrv_create_desktop( UINT width, UINT height ) +{ + UNIMPLEMENTED; + return 0; +} + +/*********************************************************************** + * wine_notify_icon (NTDRV.@) + * + * Driver-side implementation of Shell_NotifyIcon. + */ +int CDECL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data ) +{ + UNIMPLEMENTED; + return FALSE; +} + +/*********************************************************************** + * NTDRV initialisation routine + */ +BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) +{ + BOOL ret = TRUE; + + switch(reason) + { + case DLL_PROCESS_ATTACH: + InitializeCriticalSection(&NTDRV_CritSection); + //ret = process_attach(); + break; + case DLL_THREAD_DETACH: + //thread_detach(); + break; + case DLL_PROCESS_DETACH: + //process_detach(); + break; + } + return ret; +} + +/* EOF */
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/main.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,545 @@ +/* + * PROJECT: ReactOS + * LICENSE: LGPL + * FILE: dll/win32/winent.drv/userdrv.c + * PURPOSE: User driver stub for ReactOS/Windows + * PROGRAMMERS: Aleksey Bragin (aleksey@reactos.org) + */ + +/* INCLUDES ***************************************************************/ + +#include <stdarg.h> +#include <stdio.h> +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winuser16.h" +#include "wingdi.h" +#include "ntrosgdi.h" +#include "winent.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(rosuserdrv); + +/* FUNCTIONS **************************************************************/ + +/*********************************************************************** + * move_window_bits + * + * Move the window bits when a window is moved. + */ +static void move_window_bits( HWND hwnd, const RECT *old_rect, const RECT *new_rect, + const RECT *old_client_rect ) +{ + RECT src_rect = *old_rect; + RECT dst_rect = *new_rect; + HDC hdc_src, hdc_dst; + HRGN rgn = 0; + HWND parent = 0; + + if (FALSE) + { + //OffsetRect( &dst_rect, -data->window_rect.left, -data->window_rect.top ); + parent = GetAncestor( hwnd, GA_PARENT ); + hdc_src = GetDCEx( parent, 0, DCX_CACHE ); + hdc_dst = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW ); + } + else + { + //OffsetRect( &dst_rect, -data->client_rect.left, -data->client_rect.top ); + /* make src rect relative to the old position of the window */ + OffsetRect( &src_rect, -old_client_rect->left, -old_client_rect->top ); + //if (dst_rect.left == src_rect.left && dst_rect.top == src_rect.top) return; + hdc_src = hdc_dst = GetDCEx( hwnd, 0, DCX_CACHE ); + } + + //code = X11DRV_START_EXPOSURES; + //ExtEscape( hdc_dst, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL ); + + ERR( "copying bits for win %p (parent %p)/ %s -> %s\n", + hwnd, parent, + wine_dbgstr_rect(&src_rect), wine_dbgstr_rect(&dst_rect) ); + BitBlt( hdc_dst, dst_rect.left, dst_rect.top, + dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top, + hdc_src, src_rect.left, src_rect.top, SRCCOPY ); + + //code = X11DRV_END_EXPOSURES; + //ExtEscape( hdc_dst, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, sizeof(rgn), (LPSTR)&rgn ); + + ReleaseDC( hwnd, hdc_dst ); + if (hdc_src != hdc_dst) ReleaseDC( parent, hdc_src ); + + if (rgn) + { + RedrawWindow( hwnd, NULL, rgn, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN ); + DeleteObject( rgn ); + } +} + +HKL CDECL RosDrv_ActivateKeyboardLayout( HKL layout, UINT flags ) +{ + UNIMPLEMENTED; + return 0; +} + +void CDECL RosDrv_Beep(void) +{ + UNIMPLEMENTED; +} + +SHORT CDECL RosDrv_GetAsyncKeyState( INT key ) +{ + UNIMPLEMENTED; + return 0; +} + +INT CDECL RosDrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size ) +{ + UNIMPLEMENTED; + return 0; +} + +HKL CDECL RosDrv_GetKeyboardLayout( DWORD layout ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_GetKeyboardLayoutName( LPWSTR name ) +{ + UNIMPLEMENTED; + return FALSE; +} + +HKL CDECL RosDrv_LoadKeyboardLayout( LPCWSTR name, UINT flags ) +{ + UNIMPLEMENTED; + return 0; +} + +UINT CDECL RosDrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout ) +{ + UNIMPLEMENTED; + return 0; +} + +UINT CDECL RosDrv_SendInput( UINT count, LPINPUT inputs, int size ) +{ + UNIMPLEMENTED; + return 0; +} + +INT CDECL RosDrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str, + int size, UINT flags, HKL layout ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_UnloadKeyboardLayout( HKL layout ) +{ + UNIMPLEMENTED; + return 0; +} + +SHORT CDECL RosDrv_VkKeyScanEx( WCHAR ch, HKL layout ) +{ + UNIMPLEMENTED; + return -1; +} + +void CDECL RosDrv_SetCursor( CURSORICONINFO *info ) +{ + UNIMPLEMENTED; +} + +BOOL CDECL RosDrv_GetCursorPos( LPPOINT pt ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_SetCursorPos( INT x, INT y ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_ClipCursor( LPCRECT clip ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_GetScreenSaveActive(void) +{ + UNIMPLEMENTED; + return FALSE; +} + +void CDECL RosDrv_SetScreenSaveActive( BOOL on ) +{ + UNIMPLEMENTED; +} + +INT CDECL RosDrv_AcquireClipboard( HWND hwnd ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_CountClipboardFormats(void) +{ + UNIMPLEMENTED; + return 0; +} + +void CDECL RosDrv_EmptyClipboard( BOOL keepunowned ) +{ + UNIMPLEMENTED; +} + +void CDECL RosDrv_EndClipboardUpdate(void) +{ + UNIMPLEMENTED; +} + +UINT CDECL RosDrv_EnumClipboardFormats( UINT format ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_GetClipboardData( UINT format, HANDLE16 *h16, HANDLE *h32 ) +{ + UNIMPLEMENTED; + return FALSE; +} + +INT CDECL RosDrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_IsClipboardFormatAvailable( UINT format ) +{ + UNIMPLEMENTED; + return FALSE; +} + +UINT CDECL RosDrv_RegisterClipboardFormat( LPCWSTR name ) +{ + UNIMPLEMENTED; + return 0; +} + +BOOL CDECL RosDrv_SetClipboardData( UINT format, HANDLE16 h16, HANDLE h32, BOOL owner ) +{ + UNIMPLEMENTED; + return FALSE; +} + +LONG CDECL RosDrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd, + DWORD flags, LPVOID lparam ) +{ + UNIMPLEMENTED; + return DISP_CHANGE_FAILED; +} + +BOOL CDECL RosDrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITORENUMPROC proc, LPARAM lp ) +{ + RECT monrect = {0, 0, 640, 480}; + + FIXME("RosDrv_EnumDisplayMonitors is a hack\n"); + + proc((HMONITOR)1, hdc, &monrect, lp); + + return TRUE; +} + +BOOL CDECL RosDrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags ) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL CDECL RosDrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info ) +{ + RECT monrect = {0, 0, 640, 480}; + + FIXME("RosDrv_GetMonitorInfo(%x %p) is a hack\n", handle, info); + + info->rcMonitor = monrect; + info->rcWork = monrect; + + return TRUE; +} + +BOOL CDECL RosDrv_CreateDesktopWindow( HWND hwnd ) +{ + WARN("RosDrv_CreateDesktopWindow(%x)\n", hwnd); + return TRUE; +} + +BOOL CDECL RosDrv_CreateWindow( HWND hwnd ) +{ + WARN("RosDrv_CreateWindow(%x)\n", hwnd); + return TRUE; +} + +void CDECL RosDrv_DestroyWindow( HWND hwnd ) +{ + UNIMPLEMENTED; +} + +void CDECL RosDrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect, + const RECT *top_rect, DWORD flags ) +{ + struct ntdrv_escape_set_drawable escape; + //struct ntdrv_win_data *data = X11DRV_get_win_data( hwnd ); + + escape.code = NTDRV_SET_DRAWABLE; + //escape.mode = IncludeInferiors; + //escape.fbconfig_id = 0; + //escape.gl_drawable = 0; + //escape.pixmap = 0; + escape.gl_copy = FALSE; + +#if 0 + if (top == hwnd && data && IsIconic( hwnd ) && data->icon_window) + { + //escape.drawable = data->icon_window; + } + else if (top == hwnd) + { + escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop ); + /* GL draws to the client area even for window DCs */ + /*escape.gl_drawable = data ? data->client_window : X11DRV_get_client_window( hwnd ); + if (flags & DCX_WINDOW) + escape.drawable = data ? data->whole_window : X11DRV_get_whole_window( hwnd ); + else + escape.drawable = escape.gl_drawable;*/ + } + else + { + //escape.drawable = X11DRV_get_client_window( top ); + //escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop ); + //escape.gl_drawable = data ? data->gl_drawable : (Drawable)GetPropA( hwnd, gl_drawable_prop ); + //escape.pixmap = data ? data->pixmap : (Pixmap)GetPropA( hwnd, pixmap_prop ); + //escape.gl_copy = (escape.gl_drawable != 0); + if (flags & DCX_CLIPCHILDREN) escape.mode = ClipByChildren; + } +#endif + + escape.dc_rect.left = win_rect->left - top_rect->left; + escape.dc_rect.top = win_rect->top - top_rect->top; + escape.dc_rect.right = win_rect->right - top_rect->left; + escape.dc_rect.bottom = win_rect->bottom - top_rect->top; + escape.drawable_rect.left = top_rect->left; + escape.drawable_rect.top = top_rect->top; + escape.drawable_rect.right = top_rect->right; + escape.drawable_rect.bottom = top_rect->bottom; + + ExtEscape( hdc, NTDRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); +} + +DWORD CDECL RosDrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout, + DWORD mask, DWORD flags ) +{ + return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL, + timeout, flags & MWMO_ALERTABLE ); +} + +void CDECL RosDrv_ReleaseDC( HWND hwnd, HDC hdc ) +{ + struct ntdrv_escape_set_drawable escape; + + escape.code = NTDRV_SET_DRAWABLE; + escape.gl_copy = FALSE; + + escape.dc_rect.left = 0; + escape.dc_rect.top = 0; + escape.dc_rect.right = 0; + escape.dc_rect.bottom = 0; + escape.drawable_rect.left = 0; + escape.drawable_rect.top = 0; + escape.drawable_rect.right = 0; + escape.drawable_rect.bottom = 0; + + ExtEscape( hdc, NTDRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); +} + +BOOL CDECL RosDrv_ScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip, + HRGN hrgn, LPRECT update ) +{ + UNIMPLEMENTED; + return FALSE; +} + +void CDECL RosDrv_SetCapture( HWND hwnd, UINT flags ) +{ + UNIMPLEMENTED; +} + +void CDECL RosDrv_SetFocus( HWND hwnd ) +{ + UNIMPLEMENTED; +} + +void CDECL RosDrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags ) +{ + UNIMPLEMENTED; +} + +void CDECL RosDrv_SetParent( HWND hwnd, HWND parent, HWND old_parent ) +{ + UNIMPLEMENTED; +} + +int CDECL RosDrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw ) +{ + UNIMPLEMENTED; + return 1; +} + +void CDECL RosDrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon ) +{ + UNIMPLEMENTED; +} + +void CDECL RosDrv_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style ) +{ + DWORD changed; + RECT rcWnd, rcClient; + INT x,y,cx,cy; + + if (hwnd == GetDesktopWindow()) return; + changed = style->styleNew ^ style->styleOld; + + if (offset == GWL_STYLE && (changed & WS_VISIBLE) && (style->styleNew & WS_VISIBLE)) + { + /* Do some magic... */ + ERR("Window %x is being made visible\n", hwnd); + GetWindowRect(hwnd, &rcWnd); + GetClientRect(hwnd, &rcClient); + //x=rcWnd.left;y=rcWnd.top;cx=rcWnd.right-rcWnd.left;cy=rcWnd.bottom-rcWnd.top; + x=0;y=0;cx=300;cy=300; + //ERR("x %d, y %d, cx %d, cy %d\n", x, y, cx, cy); + //SetWindowPos( hwnd, 0, x+1, y+1, cx, cy, SWP_NOACTIVATE | SWP_NOZORDER ); + } + + if (offset == GWL_STYLE && (changed & WS_DISABLED)) + { + UNIMPLEMENTED; + } + + if (offset == GWL_EXSTYLE && (changed & WS_EX_LAYERED)) + { + /* changing WS_EX_LAYERED resets attributes */ + UNIMPLEMENTED; + } +} + +void CDECL RosDrv_SetWindowText( HWND hwnd, LPCWSTR text ) +{ + //UNIMPLEMENTED; +} + +UINT CDECL RosDrv_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) +{ + /*int x, y; + unsigned int width, height;*/ + DWORD style = GetWindowLongW( hwnd, GWL_STYLE ); + + if (style & WS_MINIMIZE) return swp; + if (IsRectEmpty( rect )) return swp; + + /* only fetch the new rectangle if the ShowWindow was a result of a window manager event */ + + TRACE( "win %p cmd %d at %s flags %08x\n", + hwnd, cmd, wine_dbgstr_rect(rect), swp ); + +#if 0 + /* HACK */ + x = 1; + y = 1; + width = 50; + height = 50; + + rect->left = x; + rect->top = y; + rect->right = x + width; + rect->bottom = y + height; + //OffsetRect( rect, virtual_screen_rect.left, virtual_screen_rect.top ); + //X11DRV_X_to_window_rect( data, rect ); +#endif + return swp & ~(SWP_NOMOVE | SWP_NOCLIENTMOVE | SWP_NOSIZE | SWP_NOCLIENTSIZE); +} + +LRESULT CDECL RosDrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) +{ + UNIMPLEMENTED; + return -1; +} + +LRESULT CDECL RosDrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) +{ + UNIMPLEMENTED; + return 0; +} + +void CDECL RosDrv_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags, + const RECT *window_rect, const RECT *client_rect, + RECT *visible_rect ) +{ + //UNIMPLEMENTED; + *visible_rect = *window_rect; +} + +void CDECL RosDrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags, + const RECT *window_rect, const RECT *rectClient, + const RECT *visible_rect, const RECT *valid_rects ) +{ + void WINAPI DbgBreakPoint(void); + + RECT old_whole_rect, old_client_rect; + RECT whole_rect = *visible_rect; + RECT client_rect = *rectClient; + + old_whole_rect = whole_rect; + old_client_rect = client_rect; + + ERR("called\n"); + if (valid_rects) + { + ERR("valid_rects[0] (%d, %d)-(%d,%d)\n", + valid_rects[0].top, valid_rects[0].left, valid_rects[0].bottom, valid_rects[0].right); + //DbgBreakPoint(); + } + + if (!IsRectEmpty( &valid_rects[0] )) + { + int x_offset = old_whole_rect.left - whole_rect.left; + int y_offset = old_whole_rect.top - whole_rect.top; + + /* if all that happened is that the whole window moved, copy everything */ + if (!(swp_flags & SWP_FRAMECHANGED) && + old_whole_rect.right - whole_rect.right == x_offset && + old_whole_rect.bottom - whole_rect.bottom == y_offset && + old_client_rect.left - client_rect.left == x_offset && + old_client_rect.right - client_rect.right == x_offset && + old_client_rect.top - client_rect.top == y_offset && + old_client_rect.bottom - client_rect.bottom == y_offset && + !memcmp( &valid_rects[0], &client_rect, sizeof(RECT) )) + { + /* if we have an X window the bits will be moved by the X server */ + //if (!data->whole_window) + move_window_bits( hwnd, &old_whole_rect, &whole_rect, &old_client_rect ); + } + else + move_window_bits( hwnd, &valid_rects[1], &valid_rects[0], &old_client_rect ); + } +} + +/* EOF */
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/userdrv.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,165 @@ +# GDI driver + +@ cdecl AlphaBlend(ptr long long long long ptr long long long long long) RosDrv_AlphaBlend +@ cdecl Arc(ptr long long long long long long long long) RosDrv_Arc +@ cdecl BitBlt(ptr long long long long ptr long long long) RosDrv_BitBlt +@ cdecl ChoosePixelFormat(ptr ptr) RosDrv_ChoosePixelFormat +@ cdecl Chord(ptr long long long long long long long long) RosDrv_Chord +@ cdecl CreateBitmap(ptr long ptr) RosDrv_CreateBitmap +@ cdecl CreateDC(long ptr wstr wstr wstr ptr) RosDrv_CreateDC +@ cdecl CreateDIBSection(ptr long ptr long) RosDrv_CreateDIBSection +@ cdecl DeleteBitmap(long) RosDrv_DeleteBitmap +@ cdecl DeleteDC(ptr) RosDrv_DeleteDC +@ cdecl DescribePixelFormat(ptr long long ptr) RosDrv_DescribePixelFormat +@ cdecl Ellipse(ptr long long long long) RosDrv_Ellipse +@ cdecl EnumDeviceFonts(ptr ptr ptr long) RosDrv_EnumDeviceFonts +@ cdecl ExtEscape(ptr long long ptr long ptr) RosDrv_ExtEscape +@ cdecl ExtFloodFill(ptr long long long long) RosDrv_ExtFloodFill +@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) RosDrv_ExtTextOut +@ cdecl GetBitmapBits(long ptr long) RosDrv_GetBitmapBits +@ cdecl GetCharWidth(ptr long long ptr) RosDrv_GetCharWidth +@ cdecl GetDCOrgEx(ptr ptr) RosDrv_GetDCOrgEx +@ cdecl GetDIBits(ptr long long long ptr ptr long) RosDrv_GetDIBits +@ cdecl GetDeviceCaps(ptr long) RosDrv_GetDeviceCaps +@ cdecl GetDeviceGammaRamp(ptr ptr) RosDrv_GetDeviceGammaRamp +@ cdecl GetICMProfile(ptr ptr ptr) RosDrv_GetICMProfile +@ cdecl GetNearestColor(ptr long) RosDrv_GetNearestColor +@ cdecl GetPixel(ptr long long) RosDrv_GetPixel +@ cdecl GetPixelFormat(ptr) RosDrv_GetPixelFormat +@ cdecl GetSystemPaletteEntries(ptr long long ptr) RosDrv_GetSystemPaletteEntries +@ cdecl GetTextExtentExPoint(ptr ptr long long ptr ptr ptr) RosDrv_GetTextExtentExPoint +@ cdecl GetTextMetrics(ptr ptr) RosDrv_GetTextMetrics +@ cdecl LineTo(ptr long long) RosDrv_LineTo +@ cdecl PaintRgn(ptr long) RosDrv_PaintRgn +@ cdecl PatBlt(ptr long long long long long) RosDrv_PatBlt +@ cdecl Pie(ptr long long long long long long long long) RosDrv_Pie +@ cdecl PolyPolygon(ptr ptr ptr long) RosDrv_PolyPolygon +@ cdecl PolyPolyline(ptr ptr ptr long) RosDrv_PolyPolyline +@ cdecl Polygon(ptr ptr long) RosDrv_Polygon +@ cdecl Polyline(ptr ptr long) RosDrv_Polyline +@ cdecl RealizeDefaultPalette(ptr) RosDrv_RealizeDefaultPalette +@ cdecl RealizePalette(ptr long long) RosDrv_RealizePalette +@ cdecl Rectangle(ptr long long long long) RosDrv_Rectangle +@ cdecl RoundRect(ptr long long long long long long) RosDrv_RoundRect +@ cdecl SelectBitmap(ptr long) RosDrv_SelectBitmap +@ cdecl SelectBrush(ptr long) RosDrv_SelectBrush +@ cdecl SelectFont(ptr long long) RosDrv_SelectFont +@ cdecl SelectPen(ptr long) RosDrv_SelectPen +@ cdecl SetBitmapBits(long ptr long) RosDrv_SetBitmapBits +@ cdecl SetBkColor(ptr long) RosDrv_SetBkColor +@ cdecl SetDCBrushColor(ptr long) RosDrv_SetDCBrushColor +@ cdecl SetDCOrg(ptr long long) RosDrv_SetDCOrg +@ cdecl SetDCPenColor(ptr long) RosDrv_SetDCPenColor +@ cdecl SetDIBColorTable(ptr long long ptr) RosDrv_SetDIBColorTable +@ cdecl SetDIBits(ptr long long long ptr ptr long) RosDrv_SetDIBits +@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) RosDrv_SetDIBitsToDevice +@ cdecl SetDeviceClipping(ptr long long) RosDrv_SetDeviceClipping +@ cdecl SetDeviceGammaRamp(ptr ptr) RosDrv_SetDeviceGammaRamp +@ cdecl SetPixel(ptr long long long) RosDrv_SetPixel +@ cdecl SetPixelFormat(ptr long ptr) RosDrv_SetPixelFormat +@ cdecl SetTextColor(ptr long) RosDrv_SetTextColor +@ cdecl StretchBlt(ptr long long long long ptr long long long long long) RosDrv_StretchBlt +@ cdecl SwapBuffers(ptr) RosDrv_SwapBuffers +@ cdecl UnrealizePalette(long) RosDrv_UnrealizePalette + +# USER driver + +@ cdecl ActivateKeyboardLayout(long long) RosDrv_ActivateKeyboardLayout +@ cdecl Beep() RosDrv_Beep +@ cdecl GetAsyncKeyState(long) RosDrv_GetAsyncKeyState +@ cdecl GetKeyNameText(long ptr long) RosDrv_GetKeyNameText +@ cdecl GetKeyboardLayout(long) RosDrv_GetKeyboardLayout +@ cdecl GetKeyboardLayoutName(ptr) RosDrv_GetKeyboardLayoutName +@ cdecl LoadKeyboardLayout(wstr long) RosDrv_LoadKeyboardLayout +@ cdecl MapVirtualKeyEx(long long long) RosDrv_MapVirtualKeyEx +@ cdecl SendInput(long ptr long) RosDrv_SendInput +@ cdecl ToUnicodeEx(long long ptr ptr long long long) RosDrv_ToUnicodeEx +@ cdecl UnloadKeyboardLayout(long) RosDrv_UnloadKeyboardLayout +@ cdecl VkKeyScanEx(long long) RosDrv_VkKeyScanEx +@ cdecl SetCursor(ptr) RosDrv_SetCursor +@ cdecl GetCursorPos(ptr) RosDrv_GetCursorPos +@ cdecl SetCursorPos(long long) RosDrv_SetCursorPos +@ cdecl ClipCursor(ptr) RosDrv_ClipCursor +@ cdecl GetScreenSaveActive() RosDrv_GetScreenSaveActive +@ cdecl SetScreenSaveActive(long) RosDrv_SetScreenSaveActive +@ cdecl ChangeDisplaySettingsEx(ptr ptr long long long) RosDrv_ChangeDisplaySettingsEx +@ cdecl EnumDisplayMonitors(long ptr ptr long) RosDrv_EnumDisplayMonitors +@ cdecl EnumDisplaySettingsEx(ptr long ptr long) RosDrv_EnumDisplaySettingsEx +@ cdecl GetMonitorInfo(long ptr) RosDrv_GetMonitorInfo +@ cdecl AcquireClipboard(long) RosDrv_AcquireClipboard +@ cdecl CountClipboardFormats() RosDrv_CountClipboardFormats +@ cdecl CreateDesktopWindow(long) RosDrv_CreateDesktopWindow +@ cdecl CreateWindow(long) RosDrv_CreateWindow +@ cdecl DestroyWindow(long) RosDrv_DestroyWindow +@ cdecl EmptyClipboard(long) RosDrv_EmptyClipboard +@ cdecl EndClipboardUpdate() RosDrv_EndClipboardUpdate +@ cdecl EnumClipboardFormats(long) RosDrv_EnumClipboardFormats +@ cdecl GetClipboardData(long ptr ptr) RosDrv_GetClipboardData +@ cdecl GetClipboardFormatName(long ptr long) RosDrv_GetClipboardFormatName +@ cdecl GetDC(long long long ptr ptr long) RosDrv_GetDC +@ cdecl IsClipboardFormatAvailable(long) RosDrv_IsClipboardFormatAvailable +@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) RosDrv_MsgWaitForMultipleObjectsEx +@ cdecl RegisterClipboardFormat(wstr) RosDrv_RegisterClipboardFormat +@ cdecl ReleaseDC(long long) RosDrv_ReleaseDC +@ cdecl ScrollDC(long long long ptr ptr long ptr) RosDrv_ScrollDC +@ cdecl SetClipboardData(long long long long) RosDrv_SetClipboardData +@ cdecl SetCapture(long long) RosDrv_SetCapture +@ cdecl SetFocus(long) RosDrv_SetFocus +@ cdecl SetLayeredWindowAttributes(long long long long) RosDrv_SetLayeredWindowAttributes +@ cdecl SetParent(long long long) RosDrv_SetParent +@ cdecl SetWindowIcon(long long long) RosDrv_SetWindowIcon +@ cdecl SetWindowRgn(long long long) RosDrv_SetWindowRgn +@ cdecl SetWindowStyle(ptr long ptr) RosDrv_SetWindowStyle +@ cdecl SetWindowText(long wstr) RosDrv_SetWindowText +@ cdecl ShowWindow(long long ptr long) RosDrv_ShowWindow +@ cdecl SysCommand(long long long) RosDrv_SysCommand +@ cdecl WindowMessage(long long long long) RosDrv_WindowMessage +@ cdecl WindowPosChanging(long long long ptr ptr ptr) RosDrv_WindowPosChanging +@ cdecl WindowPosChanged(long long long ptr ptr ptr ptr) RosDrv_WindowPosChanged + +# WinTab32 +#@ cdecl AttachEventQueueToTablet(long) RosDrv_AttachEventQueueToTablet +#@ cdecl GetCurrentPacket(ptr) RosDrv_GetCurrentPacket +#@ cdecl LoadTabletInfo(long) RosDrv_LoadTabletInfo +#@ cdecl WTInfoW(long long ptr) RosDrv_WTInfoW + +# X11 locks +@ cdecl -norelay wine_tsx11_lock() +@ cdecl -norelay wine_tsx11_unlock() + +# Desktop +@ cdecl wine_create_desktop(long long) RosDrv_create_desktop + +# System tray +@ cdecl wine_notify_icon(long ptr) + +# OpenGL +#@ cdecl wglCopyContext(long long long) RosDrv_wglCopyContext +#@ cdecl wglCreateContext(ptr) RosDrv_wglCreateContext +#@ cdecl wglDeleteContext(long) RosDrv_wglDeleteContext +#@ cdecl wglGetProcAddress(str) RosDrv_wglGetProcAddress +#@ cdecl wglGetPbufferDCARB(ptr ptr) RosDrv_wglGetPbufferDCARB +#@ cdecl wglMakeContextCurrentARB(ptr ptr long) RosDrv_wglMakeContextCurrentARB +#@ cdecl wglMakeCurrent(ptr long) RosDrv_wglMakeCurrent +#@ cdecl wglSetPixelFormatWINE(ptr long ptr) RosDrv_wglSetPixelFormatWINE +#@ cdecl wglShareLists(long long) RosDrv_wglShareLists +#@ cdecl wglUseFontBitmapsA(ptr long long long) RosDrv_wglUseFontBitmapsA +#@ cdecl wglUseFontBitmapsW(ptr long long long) RosDrv_wglUseFontBitmapsW + +#IME Interface +#@ stdcall ImeInquire(ptr wstr wstr) +#@ stdcall ImeConfigure(long long long ptr) +#@ stdcall ImeDestroy(long) +#@ stdcall ImeEscape(long long ptr) +#@ stdcall ImeSelect(long long) +#@ stdcall ImeSetActiveContext(long long) +#@ stdcall ImeToAsciiEx(long long ptr ptr long long) +#@ stdcall NotifyIME(long long long long) +#@ stdcall ImeRegisterWord(wstr long wstr) +#@ stdcall ImeUnregisterWord(wstr long wstr) +#@ stdcall ImeEnumRegisterWord(ptr wstr long wstr ptr) +#@ stdcall ImeSetCompositionString(long long ptr long ptr long) +#@ stdcall ImeConversionList(long wstr ptr long long) +#@ stdcall ImeProcessKey(long long long ptr) +#@ stdcall ImeGetRegisterWordStyle(long ptr) +#@ stdcall ImeGetImeMenuItems(long long long ptr ptr long)
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/arwinss/reactos/dll/win32/winent.drv/winent.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.h (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.h [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,40 @@ +/* GDI escapes */ + +#define NTDRV_ESCAPE 6789 +enum ntdrv_escape_codes +{ + NTDRV_GET_DISPLAY, /* get X11 display for a DC */ + NTDRV_GET_DRAWABLE, /* get current drawable for a DC */ + NTDRV_GET_FONT, /* get current X font for a DC */ + NTDRV_SET_DRAWABLE, /* set current drawable for a DC */ + NTDRV_START_EXPOSURES, /* start graphics exposures */ + NTDRV_END_EXPOSURES, /* end graphics exposures */ + NTDRV_GET_DCE, /* no longer used */ + NTDRV_SET_DCE, /* no longer used */ + NTDRV_GET_GLX_DRAWABLE, /* get current glx drawable for a DC */ + NTDRV_SYNC_PIXMAP, /* sync the dibsection to its pixmap */ + NTDRV_FLUSH_GL_DRAWABLE /* flush changes made to the gl drawable */ +}; + +struct ntdrv_escape_set_drawable +{ + enum ntdrv_escape_codes code; /* escape code (X11DRV_SET_DRAWABLE) */ + //Drawable drawable; /* X drawable */ + int mode; /* ClipByChildren or IncludeInferiors */ + RECT dc_rect; /* DC rectangle relative to drawable */ + RECT drawable_rect;/* Drawable rectangle relative to screen */ + //XID fbconfig_id; /* fbconfig id used by the GL drawable */ + //Drawable gl_drawable; /* GL drawable */ + //Pixmap pixmap; /* Pixmap for a GLXPixmap gl_drawable */ + int gl_copy; /* whether the GL contents need explicit copying */ +}; + +/* font.c */ +VOID +FeSelectFont(NTDRV_PDEVICE *physDev, HFONT hFont); + +BOOL +FeTextOut( NTDRV_PDEVICE *physDev, INT x, INT y, UINT flags, + const RECT *lprect, LPCWSTR wstr, UINT count, + const INT *lpDx ); +
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/winent.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,22 @@ +<module name="winent" type="win32dll" baseaddress="${BASEADDRESS_WINENT}" installbase="system32" installname="winent.drv" allowwarnings="true"> + <importlibrary definition="winent.drv.spec" /> + <include base="winent">.</include> + <include base="ReactOS">include/reactos/wine</include> + <define name="WINVER">0x0600</define> + <define name="_WIN32_WINNT">0x0501</define> + <define name="__WINESRC__" /> + <file>font.c</file> + <file>gdidrv.c</file> + <file>main.c</file> + <file>userdrv.c</file> + + <file>winent.rc</file> + + <library>wine</library> + <library>imm32</library> + <library>gdi32</library> + <library>user32</library> + <library>kernel32</library> + <library>ntdll</library> + <library>win32ksys</library> +</module>
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/winent.rbuild ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/arwinss/reactos/dll/win32/winent.drv/winent.rc URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/winent.rc (added) +++ branches/arwinss/reactos/dll/win32/winent.drv/winent.rc [iso-8859-1] Sun Jul 19 14:13:47 2009 @@ -1,0 +1,4 @@ +#define REACTOS_STR_FILE_DESCRIPTION "GDI native driver\0" +#define REACTOS_STR_INTERNAL_NAME "winent.drv\0" +#define REACTOS_STR_ORIGINAL_FILENAME "winent.drv\0" +#include <reactos/version.rc>
Propchange: branches/arwinss/reactos/dll/win32/winent.drv/winent.rc ------------------------------------------------------------------------------ svn:eol-style = native