[GDIPLUS]

* Sync with Wine 1.5.26.

svn path=/trunk/; revision=59073
This commit is contained in:
Amine Khaldi 2013-05-23 17:23:00 +00:00
parent 5d69f70bd6
commit f1d5f64d5f
11 changed files with 263 additions and 684 deletions

View file

@ -973,7 +973,7 @@ GpStatus WINGDIPAPI GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapm
{
TRACE("(%p, %p)\n", brush, wrapmode);
if(!brush || !wrapmode)
if(!brush || !wrapmode || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
*wrapmode = brush->wrap;
@ -986,7 +986,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientBlend(GpPathGradient *brush, REAL *blend,
{
TRACE("(%p, %p, %p, %d)\n", brush, blend, positions, count);
if(!brush || !blend || !positions || count <= 0)
if(!brush || !blend || !positions || count <= 0 || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
if(count < brush->blendcount)
@ -1004,7 +1004,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientBlendCount(GpPathGradient *brush, INT *co
{
TRACE("(%p, %p)\n", brush, count);
if(!brush || !count)
if(!brush || !count || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*count = brush->blendcount;
@ -1017,7 +1017,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientCenterPoint(GpPathGradient *grad,
{
TRACE("(%p, %p)\n", grad, point);
if(!grad || !point)
if(!grad || !point || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
point->X = grad->center.X;
@ -1052,7 +1052,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientCenterColor(GpPathGradient *grad,
{
TRACE("(%p,%p)\n", grad, colors);
if (!grad || !colors)
if (!grad || !colors || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*colors = grad->centercolor;
@ -1065,7 +1065,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientFocusScales(GpPathGradient *grad,
{
TRACE("(%p, %p, %p)\n", grad, x, y);
if(!grad || !x || !y)
if(!grad || !x || !y || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*x = grad->focus.X;
@ -1079,7 +1079,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientGammaCorrection(GpPathGradient *grad,
{
TRACE("(%p, %p)\n", grad, gamma);
if(!grad || !gamma)
if(!grad || !gamma || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*gamma = grad->gamma;
@ -1104,7 +1104,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientPointCount(GpPathGradient *grad,
{
TRACE("(%p, %p)\n", grad, count);
if(!grad || !count)
if(!grad || !count || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*count = grad->path->pathdata.Count;
@ -1118,7 +1118,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect
TRACE("(%p, %p)\n", brush, rect);
if(!brush || !rect)
if(!brush || !rect || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
stat = GdipGetPathWorldBounds(brush->path, rect, NULL, NULL);
@ -1154,7 +1154,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorsWithCount(GpPathGradient
TRACE("(%p,%p,%p)\n", grad, argb, count);
if(!grad || !argb || !count || (*count < grad->path->pathdata.Count))
if(!grad || !argb || !count || (*count < grad->path->pathdata.Count) || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
for (i=0; i<grad->path->pathdata.Count; i++)
@ -1174,7 +1174,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientSurroundColorCount(GpPathGradient *brush,
{
TRACE("(%p, %p)\n", brush, count);
if (!brush || !count)
if (!brush || !count || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
/* Yes, this actually returns the number of points in the path (which is the
@ -1191,7 +1191,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientWrapMode(GpPathGradient *brush,
{
TRACE("(%p, %p)\n", brush, wrapmode);
if(!brush || !wrapmode)
if(!brush || !wrapmode || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*wrapmode = brush->wrap;
@ -1302,7 +1302,7 @@ GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
if(!brush || !factors || !positions || count <= 0 ||
if(!brush || !factors || !positions || count <= 0 || brush->brush.bt != BrushTypeLinearGradient ||
(count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
return InvalidParameter;
@ -1334,7 +1334,7 @@ GpStatus WINGDIPAPI GdipGetLineBlend(GpLineGradient *brush, REAL *factors,
{
TRACE("(%p, %p, %p, %i)\n", brush, factors, positions, count);
if (!brush || !factors || !positions || count <= 0)
if (!brush || !factors || !positions || count <= 0 || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
if (count < brush->blendcount)
@ -1350,7 +1350,7 @@ GpStatus WINGDIPAPI GdipGetLineBlendCount(GpLineGradient *brush, INT *count)
{
TRACE("(%p, %p)\n", brush, count);
if (!brush || !count)
if (!brush || !count || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
*count = brush->blendcount;
@ -1363,7 +1363,7 @@ GpStatus WINGDIPAPI GdipSetLineGammaCorrection(GpLineGradient *line,
{
TRACE("(%p, %d)\n", line, usegamma);
if(!line)
if(!line || line->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
line->gamma = usegamma;
@ -1385,7 +1385,7 @@ GpStatus WINGDIPAPI GdipSetLineSigmaBlend(GpLineGradient *line, REAL focus,
TRACE("(%p, %0.2f, %0.2f)\n", line, focus, scale);
if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
if(!line || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0 || line->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
/* we want 2 standard deviations */
@ -1432,7 +1432,7 @@ GpStatus WINGDIPAPI GdipSetLineWrapMode(GpLineGradient *line,
{
TRACE("(%p, %d)\n", line, wrap);
if(!line || wrap == WrapModeClamp)
if(!line || wrap == WrapModeClamp || line->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
line->wrap = wrap;
@ -1447,7 +1447,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST RE
TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
if(!brush || !blend || !pos || count <= 0 ||
if(!brush || !blend || !pos || count <= 0 || brush->brush.bt != BrushTypePathGradient ||
(count >= 2 && (pos[0] != 0.0f || pos[count-1] != 1.0f)))
return InvalidParameter;
@ -1483,7 +1483,8 @@ GpStatus WINGDIPAPI GdipSetPathGradientLinearBlend(GpPathGradient *brush,
TRACE("(%p,%0.2f,%0.2f)\n", brush, focus, scale);
if (!brush) return InvalidParameter;
if (!brush || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
if (focus != 0.0)
{
@ -1513,7 +1514,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
REAL *new_pos;
TRACE("(%p,%p,%p,%i)\n", brush, blend, pos, count);
if (!brush || !blend || !pos || count < 2 ||
if (!brush || !blend || !pos || count < 2 || brush->brush.bt != BrushTypePathGradient ||
pos[0] != 0.0f || pos[count-1] != 1.0f)
{
return InvalidParameter;
@ -1549,7 +1550,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientPresetBlend(GpPathGradient *brush,
if (count < 0)
return OutOfMemory;
if (!brush || !blend || !pos || count < 2)
if (!brush || !blend || !pos || count < 2 || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
if (brush->pblendcount == 0)
@ -1573,7 +1574,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientPresetBlendCount(GpPathGradient *brush,
{
TRACE("(%p,%p)\n", brush, count);
if (!brush || !count)
if (!brush || !count || brush->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*count = brush->pblendcount;
@ -1586,7 +1587,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientCenterColor(GpPathGradient *grad,
{
TRACE("(%p, %x)\n", grad, argb);
if(!grad)
if(!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
grad->centercolor = argb;
@ -1598,7 +1599,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientCenterPoint(GpPathGradient *grad,
{
TRACE("(%p, %s)\n", grad, debugstr_pointf(point));
if(!grad || !point)
if(!grad || !point || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
grad->center.X = point->X;
@ -1628,7 +1629,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientFocusScales(GpPathGradient *grad,
{
TRACE("(%p, %.2f, %.2f)\n", grad, x, y);
if(!grad)
if(!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
grad->focus.X = x;
@ -1642,7 +1643,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientGammaCorrection(GpPathGradient *grad,
{
TRACE("(%p, %d)\n", grad, gamma);
if(!grad)
if(!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
grad->gamma = gamma;
@ -1664,7 +1665,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientSigmaBlend(GpPathGradient *grad,
TRACE("(%p,%0.2f,%0.2f)\n", grad, focus, scale);
if(!grad || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0)
if(!grad || focus < 0.0 || focus > 1.0 || scale < 0.0 || scale > 1.0 || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
/* we want 2 standard deviations */
@ -1714,7 +1715,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
TRACE("(%p,%p,%p)\n", grad, argb, count);
if(!grad || !argb || !count || (*count <= 0) ||
if(!grad || !argb || !count || (*count <= 0) || grad->brush.bt != BrushTypePathGradient ||
(*count > grad->path->pathdata.Count))
return InvalidParameter;
@ -1750,7 +1751,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientWrapMode(GpPathGradient *grad,
{
TRACE("(%p, %d)\n", grad, wrap);
if(!grad)
if(!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
grad->wrap = wrap;
@ -1763,7 +1764,7 @@ GpStatus WINGDIPAPI GdipSetPathGradientTransform(GpPathGradient *grad,
{
TRACE("(%p,%p)\n", grad, matrix);
if (!grad || !matrix)
if (!grad || !matrix || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
grad->transform = *matrix;
@ -1776,7 +1777,7 @@ GpStatus WINGDIPAPI GdipGetPathGradientTransform(GpPathGradient *grad,
{
TRACE("(%p,%p)\n", grad, matrix);
if (!grad || !matrix)
if (!grad || !matrix || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
*matrix = grad->transform;
@ -1789,7 +1790,7 @@ GpStatus WINGDIPAPI GdipMultiplyPathGradientTransform(GpPathGradient *grad,
{
TRACE("(%p,%p,%i)\n", grad, matrix, order);
if (!grad)
if (!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
return GdipMultiplyMatrix(&grad->transform, matrix, order);
@ -1799,7 +1800,7 @@ GpStatus WINGDIPAPI GdipResetPathGradientTransform(GpPathGradient *grad)
{
TRACE("(%p)\n", grad);
if (!grad)
if (!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
return GdipSetMatrixElements(&grad->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
@ -1810,7 +1811,7 @@ GpStatus WINGDIPAPI GdipRotatePathGradientTransform(GpPathGradient *grad,
{
TRACE("(%p,%0.2f,%i)\n", grad, angle, order);
if (!grad)
if (!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
return GdipRotateMatrix(&grad->transform, angle, order);
@ -1821,7 +1822,7 @@ GpStatus WINGDIPAPI GdipScalePathGradientTransform(GpPathGradient *grad,
{
TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, sx, sy, order);
if (!grad)
if (!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
return GdipScaleMatrix(&grad->transform, sx, sy, order);
@ -1832,7 +1833,7 @@ GpStatus WINGDIPAPI GdipTranslatePathGradientTransform(GpPathGradient *grad,
{
TRACE("(%p,%0.2f,%0.2f,%i)\n", grad, dx, dy, order);
if (!grad)
if (!grad || grad->brush.bt != BrushTypePathGradient)
return InvalidParameter;
return GdipTranslateMatrix(&grad->transform, dx, dy, order);
@ -1887,7 +1888,7 @@ GpStatus WINGDIPAPI GdipSetLineColors(GpLineGradient *brush, ARGB color1,
{
TRACE("(%p, %x, %x)\n", brush, color1, color2);
if(!brush)
if(!brush || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
brush->startcolor = color1;
@ -1900,7 +1901,7 @@ GpStatus WINGDIPAPI GdipGetLineColors(GpLineGradient *brush, ARGB *colors)
{
TRACE("(%p, %p)\n", brush, colors);
if(!brush || !colors)
if(!brush || !colors || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
colors[0] = brush->startcolor;
@ -1962,7 +1963,7 @@ GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
REAL *new_pos;
TRACE("(%p,%p,%p,%i)\n", brush, blend, positions, count);
if (!brush || !blend || !positions || count < 2 ||
if (!brush || !blend || !positions || count < 2 || brush->brush.bt != BrushTypeLinearGradient ||
positions[0] != 0.0f || positions[count-1] != 1.0f)
{
return InvalidParameter;
@ -1993,7 +1994,7 @@ GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush,
ARGB *blend, REAL* positions, INT count)
{
if (!brush || !blend || !positions || count < 2)
if (!brush || !blend || !positions || count < 2 || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
if (brush->pblendcount == 0)
@ -2011,7 +2012,7 @@ GpStatus WINGDIPAPI GdipGetLinePresetBlend(GpLineGradient *brush,
GpStatus WINGDIPAPI GdipGetLinePresetBlendCount(GpLineGradient *brush,
INT *count)
{
if (!brush || !count)
if (!brush || !count || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
*count = brush->pblendcount;
@ -2113,7 +2114,7 @@ GpStatus WINGDIPAPI GdipGetLineRect(GpLineGradient *brush, GpRectF *rect)
{
TRACE("(%p, %p)\n", brush, rect);
if(!brush || !rect)
if(!brush || !rect || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
*rect = brush->rect;
@ -2150,7 +2151,7 @@ GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush,
TRACE("(%p,%0.2f,%u)\n", brush, angle, order);
if(!brush)
if(!brush || brush->brush.bt != BrushTypeLinearGradient)
return InvalidParameter;
if(!(calls++))

View file

@ -979,12 +979,12 @@ GpStatus WINGDIPAPI GdipIsStyleAvailable(GDIPCONST GpFontFamily* family,
*IsStyleAvailable = FALSE;
hdc = GetDC(0);
hdc = CreateCompatibleDC(0);
if(!EnumFontFamiliesW(hdc, family->FamilyName, font_has_style_proc, (LPARAM)style))
*IsStyleAvailable = TRUE;
ReleaseDC(0, hdc);
DeleteDC(hdc);
return Ok;
}
@ -1276,7 +1276,7 @@ GpStatus WINGDIPAPI GdipPrivateAddMemoryFont(GpFontCollection* fontCollection,
HDC hdc;
LOGFONTW lfw;
hdc = GetDC(0);
hdc = CreateCompatibleDC(0);
lfw.lfCharSet = DEFAULT_CHARSET;
lstrcpyW(lfw.lfFaceName, name);
@ -1288,7 +1288,7 @@ GpStatus WINGDIPAPI GdipPrivateAddMemoryFont(GpFontCollection* fontCollection,
return OutOfMemory;
}
ReleaseDC(0, hdc);
DeleteDC(hdc);
}
return Ok;
}
@ -1403,7 +1403,7 @@ GpStatus WINGDIPAPI GdipNewInstalledFontCollection(
HDC hdc;
LOGFONTW lfw;
hdc = GetDC(0);
hdc = CreateCompatibleDC(0);
lfw.lfCharSet = DEFAULT_CHARSET;
lfw.lfFaceName[0] = 0;
@ -1416,7 +1416,7 @@ GpStatus WINGDIPAPI GdipNewInstalledFontCollection(
return OutOfMemory;
}
ReleaseDC(0, hdc);
DeleteDC(hdc);
}
*fontCollection = &installedFontCollection;

View file

@ -442,9 +442,9 @@ void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
for (x=0; x<width; x++)
{
BYTE alpha=src[3];
*dst++ = *src++ * alpha / 255;
*dst++ = *src++ * alpha / 255;
*dst++ = *src++ * alpha / 255;
*dst++ = (*src++ * alpha + 127) / 255;
*dst++ = (*src++ * alpha + 127) / 255;
*dst++ = (*src++ * alpha + 127) / 255;
*dst++ = *src++;
}
}

View file

@ -187,7 +187,7 @@
187 stdcall GdipDrawRectangleI(ptr ptr long long long long)
188 stdcall GdipDrawRectangles(ptr ptr ptr long)
189 stdcall GdipDrawRectanglesI(ptr ptr ptr long)
190 stdcall GdipDrawString(ptr ptr long ptr ptr ptr ptr)
190 stdcall GdipDrawString(ptr wstr long ptr ptr ptr ptr)
191 stdcall GdipEmfToWmfBits(ptr long ptr long long)
192 stdcall GdipEndContainer(ptr ptr)
193 stub GdipEnumerateMetafileDestPoint

View file

@ -158,6 +158,7 @@ struct GpGraphics{
BOOL owndc;
BOOL alpha_hdc;
GpImage *image;
ImageType image_type;
SmoothingMode smoothing;
CompositingQuality compqual;
InterpolationMode interpolation;
@ -445,7 +446,7 @@ typedef GpStatus (*gdip_format_string_callback)(HDC hdc,
GpStatus gdip_format_string(HDC hdc,
GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font,
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format,
GDIPCONST RectF *rect, GDIPCONST GpStringFormat *format, int ignore_empty_clip,
gdip_format_string_callback callback, void *user_data) DECLSPEC_HIDDEN;
void get_log_fontW(const GpFont *, GpGraphics *, LOGFONTW *) DECLSPEC_HIDDEN;

File diff suppressed because it is too large Load diff

View file

@ -1009,7 +1009,8 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
args.maxY = 0;
args.scale = emSize / native_height;
args.ascent = textmetric.tmAscent * args.scale;
status = gdip_format_string(dc, string, length, NULL, &scaled_layout_rect, format, format_string_callback, &args);
status = gdip_format_string(dc, string, length, NULL, &scaled_layout_rect,
format, TRUE, format_string_callback, &args);
DeleteDC(dc);
DeleteObject(hfont);
@ -1702,6 +1703,13 @@ static void add_bevel_point(const GpPointF *endpoint, const GpPointF *nextpoint,
REAL distance = pen->width/2.0;
REAL bevel_dx, bevel_dy;
if (segment_length == 0.0)
{
*last_point = add_path_list_node(*last_point, endpoint->X,
endpoint->Y, PathPointTypeLine);
return;
}
if (right_side)
{
bevel_dx = -distance * segment_dy / segment_length;

View file

@ -17,20 +17,24 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
//#include <stdarg.h>
#include <stdarg.h>
#include <assert.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define NONAMELESSUNION
//#include "windef.h"
//#include "winbase.h"
#include <windef.h>
#include <winbase.h>
//#include "winuser.h"
//#include "wingdi.h"
#define COBJMACROS
//#include "objbase.h"
#include <ole2.h>
#include <olectl.h>
//#include "ole2.h"
#include <initguid.h>
//#include "wincodec.h"
@ -116,10 +120,9 @@ static INT ipicture_pixel_height(IPicture *pic)
IPicture_get_Height(pic, &y);
hdcref = GetDC(0);
hdcref = CreateCompatibleDC(0);
y = MulDiv(y, GetDeviceCaps(hdcref, LOGPIXELSY), INCH_HIMETRIC);
ReleaseDC(0, hdcref);
DeleteDC(hdcref);
return y;
}
@ -131,11 +134,9 @@ static INT ipicture_pixel_width(IPicture *pic)
IPicture_get_Width(pic, &x);
hdcref = GetDC(0);
hdcref = CreateCompatibleDC(0);
x = MulDiv(x, GetDeviceCaps(hdcref, LOGPIXELSX), INCH_HIMETRIC);
ReleaseDC(0, hdcref);
DeleteDC(hdcref);
return x;
}
@ -300,7 +301,6 @@ GpStatus WINGDIPAPI GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y,
BYTE r, g, b, a;
BYTE index;
BYTE *row;
TRACE("%p %d %d %p\n", bitmap, x, y, color);
if(!bitmap || !color ||
x < 0 || y < 0 || x >= bitmap->width || y >= bitmap->height)
@ -370,7 +370,7 @@ static inline UINT get_palette_index(BYTE r, BYTE g, BYTE b, BYTE a, ColorPalett
BYTE index = 0;
int best_distance = 0x7fff;
int distance;
int i;
UINT i;
if (!palette) return 0;
/* This algorithm scans entire palette,
@ -506,7 +506,6 @@ GpStatus WINGDIPAPI GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y,
{
BYTE a, r, g, b;
BYTE *row;
TRACE("bitmap:%p, x:%d, y:%d, color:%08x\n", bitmap, x, y, color);
if(!bitmap || x < 0 || y < 0 || x >= bitmap->width || y >= bitmap->height)
return InvalidParameter;
@ -1600,12 +1599,9 @@ GpStatus WINGDIPAPI GdipConvertToEmfPlus(const GpGraphics* ref,
return NotImplemented;
}
/* FIXME: this should create a bitmap in the given size with the attributes
* (resolution etc.) of the graphics object */
GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics(INT width, INT height,
GpGraphics* target, GpBitmap** bitmap)
{
static int calls;
GpStatus ret;
TRACE("(%d, %d, %p, %p)\n", width, height, target, bitmap);
@ -1613,12 +1609,15 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromGraphics(INT width, INT height,
if(!target || !bitmap)
return InvalidParameter;
if(!(calls++))
FIXME("hacked stub\n");
ret = GdipCreateBitmapFromScan0(width, height, 0, PixelFormat24bppRGB,
ret = GdipCreateBitmapFromScan0(width, height, 0, PixelFormat32bppPARGB,
NULL, bitmap);
if (ret == Ok)
{
GdipGetDpiX(target, &(*bitmap)->image.xres);
GdipGetDpiY(target, &(*bitmap)->image.yres);
}
return ret;
}
@ -1628,13 +1627,12 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
ICONINFO iinfo;
BITMAP bm;
int ret;
UINT width, height;
UINT width, height, stride;
GpRect rect;
BitmapData lockeddata;
HDC screendc;
BOOL has_alpha;
int x, y;
BYTE *bits;
BITMAPINFOHEADER bih;
DWORD *src;
BYTE *dst_row;
@ -1654,24 +1652,13 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
}
width = bm.bmWidth;
height = iinfo.hbmColor ? abs(bm.bmHeight) : abs(bm.bmHeight) / 2;
stride = width * 4;
if (iinfo.hbmColor)
height = abs(bm.bmHeight);
else /* combined bitmap + mask */
height = abs(bm.bmHeight) / 2;
bits = HeapAlloc(GetProcessHeap(), 0, 4*width*height);
if (!bits) {
DeleteObject(iinfo.hbmColor);
DeleteObject(iinfo.hbmMask);
return OutOfMemory;
}
stat = GdipCreateBitmapFromScan0(width, height, 0, PixelFormat32bppARGB, NULL, bitmap);
stat = GdipCreateBitmapFromScan0(width, height, stride, PixelFormat32bppARGB, NULL, bitmap);
if (stat != Ok) {
DeleteObject(iinfo.hbmColor);
DeleteObject(iinfo.hbmMask);
HeapFree(GetProcessHeap(), 0, bits);
return stat;
}
@ -1684,14 +1671,13 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
if (stat != Ok) {
DeleteObject(iinfo.hbmColor);
DeleteObject(iinfo.hbmMask);
HeapFree(GetProcessHeap(), 0, bits);
GdipDisposeImage((GpImage*)*bitmap);
return stat;
}
bih.biSize = sizeof(bih);
bih.biWidth = width;
bih.biHeight = -height;
bih.biHeight = iinfo.hbmColor ? -height: -height * 2;
bih.biPlanes = 1;
bih.biBitCount = 32;
bih.biCompression = BI_RGB;
@ -1701,17 +1687,17 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
bih.biClrUsed = 0;
bih.biClrImportant = 0;
screendc = GetDC(0);
screendc = CreateCompatibleDC(0);
if (iinfo.hbmColor)
{
GetDIBits(screendc, iinfo.hbmColor, 0, height, bits, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
GetDIBits(screendc, iinfo.hbmColor, 0, height, lockeddata.Scan0, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
if (bm.bmBitsPixel == 32)
{
has_alpha = FALSE;
/* If any pixel has a non-zero alpha, ignore hbmMask */
src = (DWORD*)bits;
src = (DWORD*)lockeddata.Scan0;
for (x=0; x<width && !has_alpha; x++)
for (y=0; y<height && !has_alpha; y++)
if ((*src++ & 0xff000000) != 0)
@ -1721,24 +1707,16 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
}
else
{
GetDIBits(screendc, iinfo.hbmMask, 0, height, bits, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
GetDIBits(screendc, iinfo.hbmMask, 0, height, lockeddata.Scan0, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
has_alpha = FALSE;
}
/* copy the image data to the Bitmap */
src = (DWORD*)bits;
dst_row = lockeddata.Scan0;
for (y=0; y<height; y++)
{
memcpy(dst_row, src, width*4);
src += width;
dst_row += lockeddata.Stride;
}
if (!has_alpha)
{
if (iinfo.hbmMask)
{
BYTE *bits = HeapAlloc(GetProcessHeap(), 0, height * stride);
/* read alpha data from the mask */
if (iinfo.hbmColor)
GetDIBits(screendc, iinfo.hbmMask, 0, height, bits, (BITMAPINFO*)&bih, DIB_RGB_COLORS);
@ -1760,11 +1738,13 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
}
dst_row += lockeddata.Stride;
}
HeapFree(GetProcessHeap(), 0, bits);
}
else
{
/* set constant alpha of 255 */
dst_row = bits;
dst_row = lockeddata.Scan0;
for (y=0; y<height; y++)
{
dst = (DWORD*)dst_row;
@ -1775,15 +1755,13 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
}
}
ReleaseDC(0, screendc);
DeleteDC(screendc);
DeleteObject(iinfo.hbmColor);
DeleteObject(iinfo.hbmMask);
GdipBitmapUnlockBits(*bitmap, &lockeddata);
HeapFree(GetProcessHeap(), 0, bits);
return Ok;
}
@ -1827,14 +1805,14 @@ static void generate_halftone_palette(ARGB *entries, UINT count)
static GpStatus get_screen_resolution(REAL *xres, REAL *yres)
{
HDC screendc = GetDC(0);
HDC screendc = CreateCompatibleDC(0);
if (!screendc) return GenericError;
*xres = (REAL)GetDeviceCaps(screendc, LOGPIXELSX);
*yres = (REAL)GetDeviceCaps(screendc, LOGPIXELSY);
ReleaseDC(0, screendc);
DeleteDC(screendc);
return Ok;
}
@ -3814,7 +3792,8 @@ static GpStatus get_decoder_info(IStream* stream, const struct image_codec **res
LARGE_INTEGER seek;
HRESULT hr;
UINT bytesread;
int i, j, sig;
int i;
DWORD j, sig;
/* seek to the start of the stream */
seek.QuadPart = 0;
@ -4724,28 +4703,17 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
if (retval == Ok && hpal)
{
WORD num_palette_entries;
PALETTEENTRY *palette_entries=NULL;
PALETTEENTRY entry[256];
ColorPalette *palette=NULL;
int i;
int i, num_palette_entries;
if (!GetObjectW(hpal, sizeof(num_palette_entries), &num_palette_entries))
num_palette_entries = GetPaletteEntries(hpal, 0, 256, entry);
if (!num_palette_entries)
retval = GenericError;
if (retval == Ok)
{
palette_entries = GdipAlloc(sizeof(PALETTEENTRY) * num_palette_entries);
palette = GdipAlloc(sizeof(ColorPalette) + sizeof(ARGB) * (num_palette_entries-1));
if (!palette_entries || !palette)
retval = OutOfMemory;
}
if (retval == Ok)
{
if (!GetPaletteEntries(hpal, 0, num_palette_entries, palette_entries))
retval = GenericError;
}
palette = GdipAlloc(sizeof(ColorPalette) + sizeof(ARGB) * (num_palette_entries-1));
if (!palette)
retval = OutOfMemory;
if (retval == Ok)
{
@ -4754,15 +4722,13 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
for (i=0; i<num_palette_entries; i++)
{
PALETTEENTRY * entry = &palette_entries[i];
palette->Entries[i] = 0xff000000 | entry->peRed << 16 |
entry->peGreen << 8 | entry->peBlue;
palette->Entries[i] = 0xff000000 | entry[i].peRed << 16 |
entry[i].peGreen << 8 | entry[i].peBlue;
}
retval = GdipSetImagePalette((GpImage*)*bitmap, palette);
}
GdipFree(palette_entries);
GdipFree(palette);
}

View file

@ -410,7 +410,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
if (record)
{
record->iType = recordType;
record->nSize = dataSize;
record->nSize = dataSize + 8;
memcpy(record->dParm, data, dataSize);
PlayEnhMetaFileRecord(metafile->playback_dc, metafile->handle_table,
@ -536,7 +536,9 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileSrcRectDestPoints(GpGraphics *graphics,
memcpy(real_metafile->playback_points, destPoints, sizeof(PointF) * 3);
stat = GdipTransformPoints(graphics, CoordinateSpaceDevice, CoordinateSpaceWorld, real_metafile->playback_points, 3);
if (stat == Ok && metafile->metafile_type == MetafileTypeEmf)
if (stat == Ok && (metafile->metafile_type == MetafileTypeEmf ||
metafile->metafile_type == MetafileTypeWmfPlaceable ||
metafile->metafile_type == MetafileTypeWmf))
stat = METAFILE_PlaybackGetDC((GpMetafile*)metafile);
if (stat == Ok)

View file

@ -282,7 +282,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
region_element *left, *right = NULL;
GpStatus stat;
TRACE("%p %p %d\n", region, rect, mode);
TRACE("%p %s %d\n", region, debugstr_rectf(rect), mode);
if (!(region && rect))
return InvalidParameter;
@ -588,7 +588,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
GpStatus stat;
GpPath* path;
GpRegion* local;
int i;
DWORD i;
TRACE("(%p, %p)\n", hrgn, region);
@ -894,7 +894,7 @@ static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn)
if (!graphics)
{
new_hdc = GetDC(0);
new_hdc = CreateCompatibleDC(0);
if (!new_hdc)
return OutOfMemory;
@ -902,13 +902,13 @@ static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn)
graphics = new_graphics;
if (stat != Ok)
{
ReleaseDC(0, new_hdc);
DeleteDC(new_hdc);
return stat;
}
}
else if (!graphics->hdc)
{
graphics->hdc = new_hdc = GetDC(0);
graphics->hdc = new_hdc = CreateCompatibleDC(0);
if (!new_hdc)
return OutOfMemory;
}
@ -929,7 +929,7 @@ static GpStatus get_path_hrgn(GpPath *path, GpGraphics *graphics, HRGN *hrgn)
RestoreDC(graphics->hdc, save_state);
if (new_hdc)
{
ReleaseDC(0, new_hdc);
DeleteDC(new_hdc);
if (new_graphics)
GdipDeleteGraphics(new_graphics);
else
@ -1467,7 +1467,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMat
GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *count, GpMatrix *matrix)
{
GpStatus stat;
INT i;
DWORD i;
LPRGNDATA data;
RECT *rects;
@ -1501,7 +1501,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *co
GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *scans, INT *count, GpMatrix *matrix)
{
GpStatus stat;
INT i;
DWORD i;
LPRGNDATA data;
RECT *rects;

View file

@ -63,7 +63,7 @@ reactos/dll/win32/dciman32 # Synced to Wine-1.5.19
reactos/dll/win32/dwmapi # Synced to Wine-1.5.19
reactos/dll/win32/faultrep # Synced to Wine-1.5.4
reactos/dll/win32/fusion # Synced to Wine-1.5.26
reactos/dll/win32/gdiplus # Synced to Wine-1.5.4
reactos/dll/win32/gdiplus # Synced to Wine-1.5.26
reactos/dll/win32/hhctrl.ocx # Synced to Wine-1.5.26
reactos/dll/win32/hlink # Synced to Wine-1.5.4
reactos/dll/win32/hnetcfg # Synced to Wine-1.5.4