mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
- Sync comdlg32, crypt32, gdiplus, hhctrl.ocx to Wine-1.1.43.
svn path=/trunk/; revision=46955
This commit is contained in:
parent
85c5177ec9
commit
0cb69766f3
12 changed files with 926 additions and 376 deletions
|
@ -176,7 +176,7 @@ static SIZE MemDialogSize = { 0, 0}; /* keep size of the (resizable) dialog */
|
|||
/* Internal functions used by the dialog */
|
||||
static LRESULT FILEDLG95_ResizeControls(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT FILEDLG95_FillControls(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||
static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam);
|
||||
static LRESULT FILEDLG95_OnWMGetIShellBrowser(HWND hwnd);
|
||||
static BOOL FILEDLG95_OnOpen(HWND hwnd);
|
||||
static LRESULT FILEDLG95_InitControls(HWND hwnd);
|
||||
|
@ -240,7 +240,7 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
|
|||
{
|
||||
|
||||
LRESULT lRes;
|
||||
LPCVOID template;
|
||||
LPVOID template;
|
||||
HRSRC hRes;
|
||||
HANDLE hDlgTmpl = 0;
|
||||
HRESULT hr;
|
||||
|
@ -991,7 +991,7 @@ static LRESULT FILEDLG95_OnWMGetMMI( HWND hwnd, LPMINMAXINFO mmiptr)
|
|||
* vertically or horizontally to get out of the way. Only the "grip"
|
||||
* is moved in both directions to stay in the corner.
|
||||
*/
|
||||
static LRESULT FILEDLG95_OnWMSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT FILEDLG95_OnWMSize(HWND hwnd, WPARAM wParam)
|
||||
{
|
||||
RECT rc, rcview;
|
||||
int chgx, chgy;
|
||||
|
@ -1223,11 +1223,11 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
|
|||
return 0;
|
||||
}
|
||||
case WM_SIZE:
|
||||
return FILEDLG95_OnWMSize(hwnd, wParam, lParam);
|
||||
return FILEDLG95_OnWMSize(hwnd, wParam);
|
||||
case WM_GETMINMAXINFO:
|
||||
return FILEDLG95_OnWMGetMMI( hwnd, (LPMINMAXINFO)lParam);
|
||||
case WM_COMMAND:
|
||||
return FILEDLG95_OnWMCommand(hwnd, wParam, lParam);
|
||||
return FILEDLG95_OnWMCommand(hwnd, wParam);
|
||||
case WM_DRAWITEM:
|
||||
{
|
||||
switch(((LPDRAWITEMSTRUCT)lParam)->CtlID)
|
||||
|
@ -1733,7 +1733,7 @@ void FILEDLG95_Clean(HWND hwnd)
|
|||
*
|
||||
* WM_COMMAND message handler
|
||||
*/
|
||||
static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT FILEDLG95_OnWMCommand(HWND hwnd, WPARAM wParam)
|
||||
{
|
||||
WORD wNotifyCode = HIWORD(wParam); /* notification code */
|
||||
WORD wID = LOWORD(wParam); /* item, control, or accelerator identifier */
|
||||
|
@ -3799,7 +3799,7 @@ BOOL FD32_GetTemplate(PFD31_DATA lfs)
|
|||
/***********************************************************************
|
||||
* FD32_WMMeasureItem [internal]
|
||||
*/
|
||||
static LONG FD32_WMMeasureItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
static LONG FD32_WMMeasureItem(LPARAM lParam)
|
||||
{
|
||||
LPMEASUREITEMSTRUCT lpmeasure;
|
||||
|
||||
|
@ -3832,7 +3832,7 @@ static INT_PTR CALLBACK FD32_FileOpenDlgProc(HWND hWnd, UINT wMsg,
|
|||
return FD31_WMInitDialog(hWnd, wParam, lParam);
|
||||
|
||||
case WM_MEASUREITEM:
|
||||
return FD32_WMMeasureItem(hWnd, wParam, lParam);
|
||||
return FD32_WMMeasureItem(lParam);
|
||||
|
||||
case WM_DRAWITEM:
|
||||
return FD31_WMDrawItem(hWnd, wParam, lParam, !lfs->open, (DRAWITEMSTRUCT *)lParam);
|
||||
|
|
|
@ -766,7 +766,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
|
|||
/***********************************************************************
|
||||
* CFn_WMMeasureItem [internal]
|
||||
*/
|
||||
static LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT CFn_WMMeasureItem(HWND hDlg, LPARAM lParam)
|
||||
{
|
||||
HDC hdc;
|
||||
HFONT hfontprev;
|
||||
|
@ -794,7 +794,7 @@ static LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
|||
/***********************************************************************
|
||||
* CFn_WMDrawItem [internal]
|
||||
*/
|
||||
static LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
|
||||
static LRESULT CFn_WMDrawItem(LPARAM lParam)
|
||||
{
|
||||
HBRUSH hBrush;
|
||||
WCHAR buffer[40];
|
||||
|
@ -1190,9 +1190,9 @@ static INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|||
switch (uMsg)
|
||||
{
|
||||
case WM_MEASUREITEM:
|
||||
return CFn_WMMeasureItem(hDlg, wParam, lParam);
|
||||
return CFn_WMMeasureItem(hDlg,lParam);
|
||||
case WM_DRAWITEM:
|
||||
return CFn_WMDrawItem(hDlg, wParam, lParam);
|
||||
return CFn_WMDrawItem(lParam);
|
||||
case WM_COMMAND:
|
||||
return CFn_WMCommand(hDlg, wParam, lParam, lpcfw);
|
||||
case WM_DESTROY:
|
||||
|
@ -1239,9 +1239,9 @@ static INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|||
switch (uMsg)
|
||||
{
|
||||
case WM_MEASUREITEM:
|
||||
return CFn_WMMeasureItem(hDlg, wParam, lParam);
|
||||
return CFn_WMMeasureItem(hDlg, lParam);
|
||||
case WM_DRAWITEM:
|
||||
return CFn_WMDrawItem(hDlg, wParam, lParam);
|
||||
return CFn_WMDrawItem(lParam);
|
||||
case WM_COMMAND:
|
||||
return CFn_WMCommand(hDlg, wParam, lParam, lpcf);
|
||||
case WM_DESTROY:
|
||||
|
|
|
@ -1504,7 +1504,7 @@ static LRESULT PRINTDLG_WMInitDialogW(HWND hDlg,
|
|||
* PRINTDLG_WMCommand [internal]
|
||||
*/
|
||||
static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
|
||||
LPARAM lParam, PRINT_PTRA* PrintStructures)
|
||||
PRINT_PTRA* PrintStructures)
|
||||
{
|
||||
LPPRINTDLGA lppd = PrintStructures->lpPrintDlg;
|
||||
UINT PrinterComboID = (lppd->Flags & PD_PRINTSETUP) ? cmb1 : cmb4;
|
||||
|
@ -1658,7 +1658,7 @@ static LRESULT PRINTDLG_WMCommandA(HWND hDlg, WPARAM wParam,
|
|||
}
|
||||
|
||||
static LRESULT PRINTDLG_WMCommandW(HWND hDlg, WPARAM wParam,
|
||||
LPARAM lParam, PRINT_PTRW* PrintStructures)
|
||||
PRINT_PTRW* PrintStructures)
|
||||
{
|
||||
LPPRINTDLGW lppd = PrintStructures->lpPrintDlg;
|
||||
UINT PrinterComboID = (lppd->Flags & PD_PRINTSETUP) ? cmb1 : cmb4;
|
||||
|
@ -1846,7 +1846,7 @@ static INT_PTR CALLBACK PrintDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
switch (uMsg) {
|
||||
case WM_COMMAND:
|
||||
return PRINTDLG_WMCommandA(hDlg, wParam, lParam, PrintStructures);
|
||||
return PRINTDLG_WMCommandA(hDlg, wParam, PrintStructures);
|
||||
|
||||
case WM_DESTROY:
|
||||
DestroyIcon(PrintStructures->hCollateIcon);
|
||||
|
@ -1892,7 +1892,7 @@ static INT_PTR CALLBACK PrintDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|||
|
||||
switch (uMsg) {
|
||||
case WM_COMMAND:
|
||||
return PRINTDLG_WMCommandW(hDlg, wParam, lParam, PrintStructures);
|
||||
return PRINTDLG_WMCommandW(hDlg, wParam, PrintStructures);
|
||||
|
||||
case WM_DESTROY:
|
||||
DestroyIcon(PrintStructures->hCollateIcon);
|
||||
|
|
|
@ -523,9 +523,11 @@ static BOOL CRYPT_AsnDecodeSequence(struct AsnDecodeSequenceItem items[],
|
|||
|
||||
for (i = 0; i < cItem; i++)
|
||||
{
|
||||
bytesNeeded += items[i].size;
|
||||
if (items[i].size > items[i].minSize)
|
||||
bytesNeeded += items[i].size - items[i].minSize;
|
||||
structSize = max( structSize, items[i].offset + items[i].minSize );
|
||||
}
|
||||
bytesNeeded += structSize;
|
||||
if (pcbDecoded)
|
||||
*pcbDecoded = 1 + lenBytes + cbDecoded;
|
||||
if (!pvStructInfo)
|
||||
|
|
|
@ -1194,6 +1194,16 @@ GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
|
|||
return NotImplemented;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT *count)
|
||||
{
|
||||
TRACE("(%p, %p)\n", brush, count);
|
||||
|
||||
if (!brush || !count)
|
||||
return InvalidParameter;
|
||||
|
||||
return NotImplemented;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush,
|
||||
GpWrapMode *wrapmode)
|
||||
{
|
||||
|
@ -1559,7 +1569,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad,
|
|||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
|
||||
*grad, ARGB *argb, INT *count)
|
||||
*grad, GDIPCONST ARGB *argb, INT *count)
|
||||
{
|
||||
static int calls;
|
||||
|
||||
|
|
|
@ -489,6 +489,7 @@ GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi,
|
|||
switch (font->unit)
|
||||
{
|
||||
case UnitPixel:
|
||||
case UnitWorld:
|
||||
*height = font_height;
|
||||
break;
|
||||
case UnitPoint:
|
||||
|
@ -520,7 +521,7 @@ GpStatus WINGDIPAPI GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi,
|
|||
static INT CALLBACK is_font_installed_proc(const LOGFONTW *elf,
|
||||
const TEXTMETRICW *ntm, DWORD type, LPARAM lParam)
|
||||
{
|
||||
if (!ntm)
|
||||
if (!ntm || type == RASTER_FONTTYPE)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -642,12 +643,14 @@ GpStatus WINGDIPAPI GdipCloneFontFamily(GpFontFamily* FontFamily, GpFontFamily**
|
|||
GpStatus WINGDIPAPI GdipGetFamilyName (GDIPCONST GpFontFamily *family,
|
||||
WCHAR *name, LANGID language)
|
||||
{
|
||||
static int lang_fixme;
|
||||
|
||||
if (family == NULL)
|
||||
return InvalidParameter;
|
||||
|
||||
TRACE("%p, %p, %d\n", family, name, language);
|
||||
|
||||
if (language != LANG_NEUTRAL)
|
||||
if (language != LANG_NEUTRAL && !lang_fixme++)
|
||||
FIXME("No support for handling of multiple languages!\n");
|
||||
|
||||
lstrcpynW (name, family->FamilyName, LF_FACESIZE);
|
||||
|
@ -826,15 +829,21 @@ GpStatus WINGDIPAPI GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily)
|
|||
*/
|
||||
GpStatus WINGDIPAPI GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily)
|
||||
{
|
||||
/* FIXME: On Windows this is called Microsoft Sans Serif, this shouldn't
|
||||
* affect anything */
|
||||
static const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
|
||||
GpStatus stat;
|
||||
static const WCHAR MicrosoftSansSerif[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
|
||||
static const WCHAR Tahoma[] = {'T','a','h','o','m','a','\0'};
|
||||
|
||||
TRACE("(%p)\n", nativeFamily);
|
||||
|
||||
if (nativeFamily == NULL) return InvalidParameter;
|
||||
|
||||
return GdipCreateFontFamilyFromName(MSSansSerif, NULL, nativeFamily);
|
||||
stat = GdipCreateFontFamilyFromName(MicrosoftSansSerif, NULL, nativeFamily);
|
||||
|
||||
if (stat == FontFamilyNotFound)
|
||||
/* FIXME: Microsoft Sans Serif is not installed on Wine. */
|
||||
stat = GdipCreateFontFamilyFromName(Tahoma, NULL, nativeFamily);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -957,6 +966,9 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
|
|||
GpFontCollection* fonts = (GpFontCollection*)lParam;
|
||||
int i;
|
||||
|
||||
if (type == RASTER_FONTTYPE)
|
||||
return 1;
|
||||
|
||||
/* skip duplicates */
|
||||
for (i=0; i<fonts->count; i++)
|
||||
if (strcmpiW(lfw->lfFaceName, fonts->FontFamilies[i]->FamilyName) == 0)
|
||||
|
|
|
@ -338,7 +338,7 @@
|
|||
@ stub GdipGetPathGradientPresetBlendCount
|
||||
@ stdcall GdipGetPathGradientRect(ptr ptr)
|
||||
@ stdcall GdipGetPathGradientRectI(ptr ptr)
|
||||
@ stub GdipGetPathGradientSurroundColorCount
|
||||
@ stdcall GdipGetPathGradientSurroundColorCount(ptr ptr)
|
||||
@ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr)
|
||||
@ stub GdipGetPathGradientTransform
|
||||
@ stdcall GdipGetPathGradientWrapMode(ptr ptr)
|
||||
|
|
|
@ -78,6 +78,29 @@ static inline REAL deg2rad(REAL degrees)
|
|||
return M_PI * degrees / 180.0;
|
||||
}
|
||||
|
||||
static inline ARGB color_over(ARGB bg, ARGB fg)
|
||||
{
|
||||
BYTE b, g, r, a;
|
||||
BYTE bg_alpha, fg_alpha;
|
||||
|
||||
fg_alpha = (fg>>24)&0xff;
|
||||
|
||||
if (fg_alpha == 0xff) return fg;
|
||||
|
||||
if (fg_alpha == 0) return bg;
|
||||
|
||||
bg_alpha = (((bg>>24)&0xff) * (0xff-fg_alpha)) / 0xff;
|
||||
|
||||
if (bg_alpha == 0) return fg;
|
||||
|
||||
a = bg_alpha + fg_alpha;
|
||||
b = ((bg&0xff)*bg_alpha + (fg&0xff)*fg_alpha)*0xff/a;
|
||||
g = (((bg>>8)&0xff)*bg_alpha + ((fg>>8)&0xff)*fg_alpha)*0xff/a;
|
||||
r = (((bg>>16)&0xff)*bg_alpha + ((fg>>16)&0xff)*fg_alpha)*0xff/a;
|
||||
|
||||
return (a<<24)|(r<<16)|(g<<8)|b;
|
||||
}
|
||||
|
||||
extern const char *debugstr_rectf(CONST RectF* rc);
|
||||
|
||||
extern const char *debugstr_pointf(CONST PointF* pt);
|
||||
|
@ -112,6 +135,7 @@ struct GpGraphics{
|
|||
HDC hdc;
|
||||
HWND hwnd;
|
||||
BOOL owndc;
|
||||
GpImage *image;
|
||||
SmoothingMode smoothing;
|
||||
CompositingQuality compqual;
|
||||
InterpolationMode interpolation;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -122,7 +122,7 @@ static inline void getpixel_16bppGrayScale(BYTE *r, BYTE *g, BYTE *b, BYTE *a,
|
|||
static inline void getpixel_16bppRGB555(BYTE *r, BYTE *g, BYTE *b, BYTE *a,
|
||||
const BYTE *row, UINT x)
|
||||
{
|
||||
WORD pixel = *((WORD*)(row)+x);
|
||||
WORD pixel = *((const WORD*)(row)+x);
|
||||
*r = (pixel>>7&0xf8)|(pixel>>12&0x7);
|
||||
*g = (pixel>>2&0xf8)|(pixel>>6&0x7);
|
||||
*b = (pixel<<3&0xf8)|(pixel>>2&0x7);
|
||||
|
@ -132,7 +132,7 @@ static inline void getpixel_16bppRGB555(BYTE *r, BYTE *g, BYTE *b, BYTE *a,
|
|||
static inline void getpixel_16bppRGB565(BYTE *r, BYTE *g, BYTE *b, BYTE *a,
|
||||
const BYTE *row, UINT x)
|
||||
{
|
||||
WORD pixel = *((WORD*)(row)+x);
|
||||
WORD pixel = *((const WORD*)(row)+x);
|
||||
*r = (pixel>>8&0xf8)|(pixel>>13&0x7);
|
||||
*g = (pixel>>3&0xfc)|(pixel>>9&0x3);
|
||||
*b = (pixel<<3&0xf8)|(pixel>>2&0x7);
|
||||
|
@ -142,7 +142,7 @@ static inline void getpixel_16bppRGB565(BYTE *r, BYTE *g, BYTE *b, BYTE *a,
|
|||
static inline void getpixel_16bppARGB1555(BYTE *r, BYTE *g, BYTE *b, BYTE *a,
|
||||
const BYTE *row, UINT x)
|
||||
{
|
||||
WORD pixel = *((WORD*)(row)+x);
|
||||
WORD pixel = *((const WORD*)(row)+x);
|
||||
*r = (pixel>>7&0xf8)|(pixel>>12&0x7);
|
||||
*g = (pixel>>2&0xf8)|(pixel>>6&0x7);
|
||||
*b = (pixel<<3&0xf8)|(pixel>>2&0x7);
|
||||
|
@ -1831,6 +1831,37 @@ GpStatus WINGDIPAPI GdipEmfToWmfBits(HENHMETAFILE hemf, UINT cbData16,
|
|||
return NotImplemented;
|
||||
}
|
||||
|
||||
/* Internal utility function: Replace the image data of dst with that of src,
|
||||
* and free src. */
|
||||
static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
|
||||
{
|
||||
GdipFree(dst->bitmapbits);
|
||||
DeleteDC(dst->hdc);
|
||||
DeleteObject(dst->hbitmap);
|
||||
|
||||
if (clobber_palette)
|
||||
{
|
||||
GdipFree(dst->image.palette_entries);
|
||||
dst->image.palette_flags = src->image.palette_flags;
|
||||
dst->image.palette_count = src->image.palette_count;
|
||||
dst->image.palette_entries = src->image.palette_entries;
|
||||
}
|
||||
else
|
||||
GdipFree(src->image.palette_entries);
|
||||
|
||||
dst->image.xres = src->image.xres;
|
||||
dst->image.yres = src->image.yres;
|
||||
dst->width = src->width;
|
||||
dst->height = src->height;
|
||||
dst->format = src->format;
|
||||
dst->hbitmap = src->hbitmap;
|
||||
dst->hdc = src->hdc;
|
||||
dst->bits = src->bits;
|
||||
dst->stride = src->stride;
|
||||
|
||||
GdipFree(src);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
|
||||
{
|
||||
TRACE("%p\n", image);
|
||||
|
@ -1946,6 +1977,7 @@ GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image,
|
|||
GpGraphics **graphics)
|
||||
{
|
||||
HDC hdc;
|
||||
GpStatus stat;
|
||||
|
||||
TRACE("%p %p\n", image, graphics);
|
||||
|
||||
|
@ -1965,7 +1997,12 @@ GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image,
|
|||
((GpBitmap*)image)->hdc = hdc;
|
||||
}
|
||||
|
||||
return GdipCreateFromHDC(hdc, graphics);
|
||||
stat = GdipCreateFromHDC(hdc, graphics);
|
||||
|
||||
if (stat == Ok)
|
||||
(*graphics)->image = image;
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
|
||||
|
@ -2459,6 +2496,11 @@ static GpStatus decode_image_gif(IStream* stream, REFCLSID clsid, GpImage **imag
|
|||
return decode_image_wic(stream, &CLSID_WICGifDecoder, image);
|
||||
}
|
||||
|
||||
static GpStatus decode_image_tiff(IStream* stream, REFCLSID clsid, GpImage **image)
|
||||
{
|
||||
return decode_image_wic(stream, &CLSID_WICTiffDecoder, image);
|
||||
}
|
||||
|
||||
static GpStatus decode_image_olepicture_metafile(IStream* stream, REFCLSID clsid, GpImage **image)
|
||||
{
|
||||
IPicture *pic;
|
||||
|
@ -2505,6 +2547,7 @@ typedef enum {
|
|||
BMP,
|
||||
JPEG,
|
||||
GIF,
|
||||
TIFF,
|
||||
EMF,
|
||||
WMF,
|
||||
PNG,
|
||||
|
@ -2517,10 +2560,11 @@ static const struct image_codec codecs[NUM_CODECS];
|
|||
static GpStatus get_decoder_info(IStream* stream, const struct image_codec **result)
|
||||
{
|
||||
BYTE signature[8];
|
||||
const BYTE *pattern, *mask;
|
||||
LARGE_INTEGER seek;
|
||||
HRESULT hr;
|
||||
UINT bytesread;
|
||||
int i, j;
|
||||
int i, j, sig;
|
||||
|
||||
/* seek to the start of the stream */
|
||||
seek.QuadPart = 0;
|
||||
|
@ -2528,7 +2572,7 @@ static GpStatus get_decoder_info(IStream* stream, const struct image_codec **res
|
|||
if (FAILED(hr)) return hresult_to_status(hr);
|
||||
|
||||
/* read the first 8 bytes */
|
||||
/* FIXME: This assumes all codecs have one signature <= 8 bytes in length */
|
||||
/* FIXME: This assumes all codecs have signatures <= 8 bytes in length */
|
||||
hr = IStream_Read(stream, signature, 8, &bytesread);
|
||||
if (FAILED(hr)) return hresult_to_status(hr);
|
||||
if (hr == S_FALSE || bytesread == 0) return GenericError;
|
||||
|
@ -2537,13 +2581,18 @@ static GpStatus get_decoder_info(IStream* stream, const struct image_codec **res
|
|||
if ((codecs[i].info.Flags & ImageCodecFlagsDecoder) &&
|
||||
bytesread >= codecs[i].info.SigSize)
|
||||
{
|
||||
for (j=0; j<codecs[i].info.SigSize; j++)
|
||||
if ((signature[j] & codecs[i].info.SigMask[j]) != codecs[i].info.SigPattern[j])
|
||||
break;
|
||||
if (j == codecs[i].info.SigSize)
|
||||
for (sig=0; sig<codecs[i].info.SigCount; sig++)
|
||||
{
|
||||
*result = &codecs[i];
|
||||
return Ok;
|
||||
pattern = &codecs[i].info.SigPattern[codecs[i].info.SigSize*sig];
|
||||
mask = &codecs[i].info.SigMask[codecs[i].info.SigSize*sig];
|
||||
for (j=0; j<codecs[i].info.SigSize; j++)
|
||||
if ((signature[j] & mask[j]) != pattern[j])
|
||||
break;
|
||||
if (j == codecs[i].info.SigSize)
|
||||
{
|
||||
*result = &codecs[i];
|
||||
return Ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2900,6 +2949,13 @@ static const WCHAR gif_format[] = {'G','I','F',0};
|
|||
static const BYTE gif_sig_pattern[4] = "GIF8";
|
||||
static const BYTE gif_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
|
||||
static const WCHAR tiff_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'T','I','F','F', 0};
|
||||
static const WCHAR tiff_extension[] = {'*','.','T','I','F','F',';','*','.','T','I','F',0};
|
||||
static const WCHAR tiff_mimetype[] = {'i','m','a','g','e','/','t','i','f','f', 0};
|
||||
static const WCHAR tiff_format[] = {'T','I','F','F',0};
|
||||
static const BYTE tiff_sig_pattern[] = {0x49,0x49,42,0,0x4d,0x4d,0,42};
|
||||
static const BYTE tiff_sig_mask[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
|
||||
static const WCHAR emf_codecname[] = {'B', 'u', 'i','l', 't', '-','i', 'n', ' ', 'E','M','F', 0};
|
||||
static const WCHAR emf_extension[] = {'*','.','E','M','F',0};
|
||||
static const WCHAR emf_mimetype[] = {'i','m','a','g','e','/','x','-','e','m','f', 0};
|
||||
|
@ -2986,6 +3042,25 @@ static const struct image_codec codecs[NUM_CODECS] = {
|
|||
NULL,
|
||||
decode_image_gif
|
||||
},
|
||||
{
|
||||
{ /* TIFF */
|
||||
/* Clsid */ { 0x557cf405, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } },
|
||||
/* FormatID */ { 0xb96b3cb1U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0x00, 0x00, 0xf8, 0x1e, 0xf3, 0x2e} },
|
||||
/* CodecName */ tiff_codecname,
|
||||
/* DllName */ NULL,
|
||||
/* FormatDescription */ tiff_format,
|
||||
/* FilenameExtension */ tiff_extension,
|
||||
/* MimeType */ tiff_mimetype,
|
||||
/* Flags */ ImageCodecFlagsDecoder | ImageCodecFlagsSupportBitmap | ImageCodecFlagsBuiltin,
|
||||
/* Version */ 1,
|
||||
/* SigCount */ 2,
|
||||
/* SigSize */ 4,
|
||||
/* SigPattern */ tiff_sig_pattern,
|
||||
/* SigMask */ tiff_sig_mask,
|
||||
},
|
||||
NULL,
|
||||
decode_image_tiff
|
||||
},
|
||||
{
|
||||
{ /* EMF */
|
||||
/* Clsid */ { 0x557cf403, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } },
|
||||
|
@ -3394,6 +3469,112 @@ GpStatus WINGDIPAPI GdipGetImageThumbnail(GpImage *image, UINT width, UINT heigh
|
|||
*/
|
||||
GpStatus WINGDIPAPI GdipImageRotateFlip(GpImage *image, RotateFlipType type)
|
||||
{
|
||||
FIXME("(%p %u) stub\n", image, type);
|
||||
return NotImplemented;
|
||||
GpBitmap *new_bitmap;
|
||||
GpBitmap *bitmap;
|
||||
int bpp, bytesperpixel;
|
||||
int rotate_90, flip_x, flip_y;
|
||||
int src_x_offset, src_y_offset;
|
||||
LPBYTE src_origin;
|
||||
UINT x, y, width, height;
|
||||
BitmapData src_lock, dst_lock;
|
||||
GpStatus stat;
|
||||
|
||||
TRACE("(%p, %u)\n", image, type);
|
||||
|
||||
rotate_90 = type&1;
|
||||
flip_x = (type&6) == 2 || (type&6) == 4;
|
||||
flip_y = (type&3) == 1 || (type&3) == 2;
|
||||
|
||||
if (image->type != ImageTypeBitmap)
|
||||
{
|
||||
FIXME("Not implemented for type %i\n", image->type);
|
||||
return NotImplemented;
|
||||
}
|
||||
|
||||
bitmap = (GpBitmap*)image;
|
||||
bpp = PIXELFORMATBPP(bitmap->format);
|
||||
|
||||
if (bpp < 8)
|
||||
{
|
||||
FIXME("Not implemented for %i bit images\n", bpp);
|
||||
return NotImplemented;
|
||||
}
|
||||
|
||||
if (rotate_90)
|
||||
{
|
||||
width = bitmap->height;
|
||||
height = bitmap->width;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = bitmap->width;
|
||||
height = bitmap->height;
|
||||
}
|
||||
|
||||
bytesperpixel = bpp/8;
|
||||
|
||||
stat = GdipCreateBitmapFromScan0(width, height, 0, bitmap->format, NULL, &new_bitmap);
|
||||
|
||||
if (stat != Ok)
|
||||
return stat;
|
||||
|
||||
stat = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, bitmap->format, &src_lock);
|
||||
|
||||
if (stat == Ok)
|
||||
{
|
||||
stat = GdipBitmapLockBits(new_bitmap, NULL, ImageLockModeWrite, bitmap->format, &dst_lock);
|
||||
|
||||
if (stat == Ok)
|
||||
{
|
||||
LPBYTE src_row, src_pixel;
|
||||
LPBYTE dst_row, dst_pixel;
|
||||
|
||||
src_origin = src_lock.Scan0;
|
||||
if (flip_x) src_origin += bytesperpixel * (bitmap->width - 1);
|
||||
if (flip_y) src_origin += src_lock.Stride * (bitmap->height - 1);
|
||||
|
||||
if (rotate_90)
|
||||
{
|
||||
if (flip_y) src_x_offset = -src_lock.Stride;
|
||||
else src_x_offset = src_lock.Stride;
|
||||
if (flip_x) src_y_offset = -bytesperpixel;
|
||||
else src_y_offset = bytesperpixel;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flip_x) src_x_offset = -bytesperpixel;
|
||||
else src_x_offset = bytesperpixel;
|
||||
if (flip_y) src_y_offset = -src_lock.Stride;
|
||||
else src_y_offset = src_lock.Stride;
|
||||
}
|
||||
|
||||
src_row = src_origin;
|
||||
dst_row = dst_lock.Scan0;
|
||||
for (y=0; y<height; y++)
|
||||
{
|
||||
src_pixel = src_row;
|
||||
dst_pixel = dst_row;
|
||||
for (x=0; x<width; x++)
|
||||
{
|
||||
/* FIXME: This could probably be faster without memcpy. */
|
||||
memcpy(dst_pixel, src_pixel, bytesperpixel);
|
||||
dst_pixel += bytesperpixel;
|
||||
src_pixel += src_x_offset;
|
||||
}
|
||||
src_row += src_y_offset;
|
||||
dst_row += dst_lock.Stride;
|
||||
}
|
||||
|
||||
GdipBitmapUnlockBits(new_bitmap, &dst_lock);
|
||||
}
|
||||
|
||||
GdipBitmapUnlockBits(bitmap, &src_lock);
|
||||
}
|
||||
|
||||
if (stat == Ok)
|
||||
move_bitmap(bitmap, new_bitmap, FALSE);
|
||||
else
|
||||
GdipDisposeImage((GpImage*)new_bitmap);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
|
|||
}
|
||||
else
|
||||
{
|
||||
FIXME("Unhandled HTML Help command line parameter! (%.*s)\n", space-szCmdLine, szCmdLine);
|
||||
FIXME("Unhandled HTML Help command line parameter! (%.*s)\n", (int)(space-szCmdLine), szCmdLine);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,8 +561,9 @@ GpStatus WINGDIPAPI GdipSetPathGradientFocusScales(GpPathGradient*,REAL,REAL);
|
|||
GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection(GpPathGradient*,BOOL);
|
||||
GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient*,REAL,REAL);
|
||||
GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient*,
|
||||
ARGB*,INT*);
|
||||
GDIPCONST ARGB*,INT*);
|
||||
GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient*,GpWrapMode);
|
||||
GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient*,INT*);
|
||||
|
||||
/* PathIterator */
|
||||
GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator**,GpPath*);
|
||||
|
|
Loading…
Reference in a new issue