Author: dchapyshev
Date: Tue Jan 27 12:03:33 2009
New Revision: 39144
URL:
http://svn.reactos.org/svn/reactos?rev=39144&view=rev
Log:
- Sync gdiplus with Wine head
Modified:
trunk/reactos/dll/win32/gdiplus/brush.c
trunk/reactos/dll/win32/gdiplus/gdiplus.spec
trunk/reactos/dll/win32/gdiplus/gdiplus_private.h
trunk/reactos/dll/win32/gdiplus/graphics.c
trunk/reactos/dll/win32/gdiplus/image.c
trunk/reactos/dll/win32/gdiplus/pen.c
trunk/reactos/dll/win32/gdiplus/region.c
trunk/reactos/include/psdk/gdiplusenums.h
trunk/reactos/include/psdk/gdiplusgpstubs.h
Modified: trunk/reactos/dll/win32/gdiplus/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/brush.c?…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/brush.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/brush.c [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -53,6 +53,14 @@
(*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
break;
+ case BrushTypeHatchFill:
+ *clone = GdipAlloc(sizeof(GpHatch));
+ if (!*clone) return OutOfMemory;
+
+ memcpy(*clone, brush, sizeof(GpHatch));
+
+ (*clone)->gdibrush = CreateBrushIndirect(&(*clone)->lb);
+ break;
case BrushTypePathGradient:{
GpPathGradient *src, *dest;
INT count;
@@ -120,6 +128,67 @@
ERR("not implemented for brush type %d\n", brush->bt);
return NotImplemented;
}
+
+ return Ok;
+}
+
+static LONG HatchStyleToHatch(HatchStyle hatchstyle)
+{
+ switch (hatchstyle)
+ {
+ case HatchStyleHorizontal: return HS_HORIZONTAL;
+ case HatchStyleVertical: return HS_VERTICAL;
+ case HatchStyleForwardDiagonal: return HS_FDIAGONAL;
+ case HatchStyleBackwardDiagonal: return HS_BDIAGONAL;
+ case HatchStyleCross: return HS_CROSS;
+ case HatchStyleDiagonalCross: return HS_DIAGCROSS;
+ default: return 0;
+ }
+}
+
+/******************************************************************************
+ * GdipCreateHatchBrush [GDIPLUS.@]
+ */
+GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, ARGB
backcol, GpHatch **brush)
+{
+ COLORREF fgcol = ARGB2COLORREF(forecol);
+
+ TRACE("(%d, %d, %d, %p)\n", hatchstyle, forecol, backcol, brush);
+
+ if(!brush) return InvalidParameter;
+
+ *brush = GdipAlloc(sizeof(GpHatch));
+ if (!*brush) return OutOfMemory;
+
+ switch (hatchstyle)
+ {
+ case HatchStyleHorizontal:
+ case HatchStyleVertical:
+ case HatchStyleForwardDiagonal:
+ case HatchStyleBackwardDiagonal:
+ case HatchStyleCross:
+ case HatchStyleDiagonalCross:
+ /* Brushes that map to BS_HATCHED */
+ (*brush)->brush.lb.lbStyle = BS_HATCHED;
+ (*brush)->brush.lb.lbColor = fgcol;
+ (*brush)->brush.lb.lbHatch = HatchStyleToHatch(hatchstyle);
+ break;
+
+ default:
+ FIXME("Unimplemented hatch style %d\n", hatchstyle);
+
+ (*brush)->brush.lb.lbStyle = BS_SOLID;
+ (*brush)->brush.lb.lbColor = fgcol;
+ (*brush)->brush.lb.lbHatch = 0;
+ break;
+ }
+
+
+ (*brush)->brush.gdibrush = CreateBrushIndirect(&(*brush)->brush.lb);
+ (*brush)->brush.bt = BrushTypeHatchFill;
+ (*brush)->forecol = forecol;
+ (*brush)->backcol = backcol;
+ (*brush)->hatchstyle = hatchstyle;
return Ok;
}
@@ -644,6 +713,39 @@
if(!brush || !type) return InvalidParameter;
*type = brush->bt;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetHatchBackgroundColor(GpHatch *brush, ARGB *backcol)
+{
+ TRACE("(%p, %p)\n", brush, backcol);
+
+ if(!brush || !backcol) return InvalidParameter;
+
+ *backcol = brush->backcol;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch *brush, ARGB *forecol)
+{
+ TRACE("(%p, %p)\n", brush, forecol);
+
+ if(!brush || !forecol) return InvalidParameter;
+
+ *forecol = brush->forecol;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, HatchStyle *hatchstyle)
+{
+ TRACE("(%p, %p)\n", brush, hatchstyle);
+
+ if(!brush || !hatchstyle) return InvalidParameter;
+
+ *hatchstyle = brush->hatchstyle;
return Ok;
}
@@ -1331,3 +1433,17 @@
return ret;
}
+
+GpStatus WINGDIPAPI GdipRotateLineTransform(GpLineGradient* brush,
+ REAL angle, GpMatrixOrder order)
+{
+ static int calls;
+
+ if(!brush)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("(%p, %.2f, %d) stub\n", brush, angle, order);
+
+ return NotImplemented;
+}
Modified: trunk/reactos/dll/win32/gdiplus/gdiplus.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus.…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/gdiplus.spec [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -96,7 +96,7 @@
@ stdcall GdipCreateHBITMAPFromBitmap(ptr ptr long)
@ stub GdipCreateHICONFromBitmap
@ stdcall GdipCreateHalftonePalette()
-@ stub GdipCreateHatchBrush
+@ stdcall GdipCreateHatchBrush(long long long ptr)
@ stdcall GdipCreateImageAttributes(ptr)
@ stdcall GdipCreateLineBrush(ptr ptr long long long ptr)
@ stdcall GdipCreateLineBrushFromRect(ptr long long long long ptr)
@@ -275,9 +275,9 @@
@ stdcall GdipGetGenericFontFamilyMonospace(ptr)
@ stdcall GdipGetGenericFontFamilySansSerif(ptr)
@ stdcall GdipGetGenericFontFamilySerif(ptr)
-@ stub GdipGetHatchBackgroundColor
-@ stub GdipGetHatchForegroundColor
-@ stub GdipGetHatchStyle
+@ stdcall GdipGetHatchBackgroundColor(ptr ptr)
+@ stdcall GdipGetHatchForegroundColor(ptr ptr)
+@ stdcall GdipGetHatchStyle(ptr ptr)
@ stub GdipGetHemfFromMetafile
@ stub GdipGetImageAttributesAdjustedPalette
@ stdcall GdipGetImageBounds(ptr ptr ptr)
@@ -480,12 +480,12 @@
@ stub GdipResetPageTransform
@ stdcall GdipResetPath(ptr)
@ stub GdipResetPathGradientTransform
-@ stub GdipResetPenTransform
+@ stdcall GdipResetPenTransform(ptr)
@ stdcall GdipResetTextureTransform(ptr)
@ stdcall GdipResetWorldTransform(ptr)
@ stdcall GdipRestoreGraphics(ptr long)
@ stdcall GdipReversePath(ptr)
-@ stub GdipRotateLineTransform
+@ stdcall GdipRotateLineTransform(ptr long long)
@ stdcall GdipRotateMatrix(ptr long long)
@ stub GdipRotatePathGradientTransform
@ stub GdipRotatePenTransform
@@ -499,7 +499,7 @@
@ stub GdipScaleLineTransform
@ stdcall GdipScaleMatrix(ptr long long long)
@ stub GdipScalePathGradientTransform
-@ stub GdipScalePenTransform
+@ stdcall GdipScalePenTransform(ptr long long long)
@ stdcall GdipScaleTextureTransform(ptr long long long)
@ stdcall GdipScaleWorldTransform(ptr long long long)
@ stdcall GdipSetAdjustableArrowCapFillState(ptr long)
Modified: trunk/reactos/dll/win32/gdiplus/gdiplus_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/gdiplus_…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/gdiplus_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/gdiplus_private.h [iso-8859-1] Tue Jan 27 12:03:33
2009
@@ -109,6 +109,13 @@
HBRUSH gdibrush;
GpBrushType bt;
LOGBRUSH lb;
+};
+
+struct GpHatch{
+ GpBrush brush;
+ HatchStyle hatchstyle;
+ ARGB forecol;
+ ARGB backcol;
};
struct GpSolidFill{
Modified: trunk/reactos/dll/win32/gdiplus/graphics.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/graphics…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/graphics.c [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -3229,7 +3229,7 @@
m = *(graphics->worldtrans);
- ret = GdipMultiplyMatrix(&m, (GpMatrix*)matrix, order);
+ ret = GdipMultiplyMatrix(&m, matrix, order);
if(ret == Ok)
*(graphics->worldtrans) = m;
Modified: trunk/reactos/dll/win32/gdiplus/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/image.c?…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/image.c [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -1068,7 +1068,35 @@
else
GetDIBits(hdc, hbm, 0, 0, NULL, pbmi, DIB_RGB_COLORS);
- (*((GpBitmap**) image))->format = (bmch->bcBitCount << 8) |
PixelFormatGDI;
+ switch(bmch->bcBitCount)
+ {
+ case 1:
+ (*((GpBitmap**) image))->format = PixelFormat1bppIndexed;
+ break;
+ case 4:
+ (*((GpBitmap**) image))->format = PixelFormat4bppIndexed;
+ break;
+ case 8:
+ (*((GpBitmap**) image))->format = PixelFormat8bppIndexed;
+ break;
+ case 16:
+ (*((GpBitmap**) image))->format = PixelFormat16bppRGB565;
+ break;
+ case 24:
+ (*((GpBitmap**) image))->format = PixelFormat24bppRGB;
+ break;
+ case 32:
+ (*((GpBitmap**) image))->format = PixelFormat32bppRGB;
+ break;
+ case 48:
+ (*((GpBitmap**) image))->format = PixelFormat48bppRGB;
+ break;
+ default:
+ FIXME("Bit depth %d is not fully supported yet\n",
bmch->bcBitCount);
+ (*((GpBitmap**) image))->format = (bmch->bcBitCount << 8) |
PixelFormatGDI;
+ break;
+ }
+
GdipFree(pbmi);
}
else if(type == PICTYPE_METAFILE || type == PICTYPE_ENHMETAFILE){
@@ -1180,7 +1208,7 @@
*output = GdipAlloc(*output_size);
- bmp_file_hdr = (BITMAPFILEHEADER*) *output;
+ bmp_file_hdr = *output;
bmp_file_hdr->bfType = BITMAP_FORMAT_BMP;
bmp_file_hdr->bfSize = *output_size;
bmp_file_hdr->bfOffBits =
Modified: trunk/reactos/dll/win32/gdiplus/pen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/pen.c?re…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/pen.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/pen.c [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -385,6 +385,32 @@
return Ok;
}
+GpStatus WINGDIPAPI GdipResetPenTransform(GpPen *pen)
+{
+ static int calls;
+
+ if(!pen)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("(%p) stub\n", pen);
+
+ return NotImplemented;
+}
+
+GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder
order)
+{
+ static int calls;
+
+ if(!pen)
+ return InvalidParameter;
+
+ if(!(calls++))
+ FIXME("(%p, %.2f, %.2f, %d) stub\n", pen, sx, sy, order);
+
+ return NotImplemented;
+}
+
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
{
TRACE("(%p, %p)\n", pen, brush);
Modified: trunk/reactos/dll/win32/gdiplus/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdiplus/region.c…
==============================================================================
--- trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdiplus/region.c [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -268,7 +268,6 @@
out:
GdipFree(left);
- delete_element(right);
GdipDeleteRegion(path_region);
return stat;
}
@@ -315,7 +314,6 @@
out:
GdipFree(left);
- delete_element(right);
GdipDeleteRegion(rect_region);
return stat;
}
@@ -373,7 +371,6 @@
if (stat != Ok)
{
GdipFree(left);
- delete_element(right);
return OutOfMemory;
}
Modified: trunk/reactos/include/psdk/gdiplusenums.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/gdiplusenums.…
==============================================================================
--- trunk/reactos/include/psdk/gdiplusenums.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/gdiplusenums.h [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -355,6 +355,67 @@
MetafileFrameUnitDocument = UnitDocument,
MetafileFrameUnitMillimeter = UnitMillimeter,
MetafileFrameUnitGdi
+};
+
+enum HatchStyle
+{
+ HatchStyleHorizontal = 0,
+ HatchStyleVertical = 1,
+ HatchStyleForwardDiagonal = 2,
+ HatchStyleBackwardDiagonal = 3,
+ HatchStyleCross = 4,
+ HatchStyleDiagonalCross = 5,
+ HatchStyle05Percent = 6,
+ HatchStyle10Percent = 7,
+ HatchStyle20Percent = 8,
+ HatchStyle25Percent = 9,
+ HatchStyle30Percent = 10,
+ HatchStyle40Percent = 11,
+ HatchStyle50Percent = 12,
+ HatchStyle60Percent = 13,
+ HatchStyle70Percent = 14,
+ HatchStyle75Percent = 15,
+ HatchStyle80Percent = 16,
+ HatchStyle90Percent = 17,
+ HatchStyleLightDownwardDiagonal = 18,
+ HatchStyleLightUpwardDiagonal = 19,
+ HatchStyleDarkDownwardDiagonal = 20,
+ HatchStyleDarkUpwardDiagonal = 21,
+ HatchStyleWideDownwardDiagonal = 22,
+ HatchStyleWideUpwardDiagonal = 23,
+ HatchStyleLightVertical = 24,
+ HatchStyleLightHorizontal = 25,
+ HatchStyleNarrowVertical = 26,
+ HatchStyleNarrowHorizontal = 27,
+ HatchStyleDarkVertical = 28,
+ HatchStyleDarkHorizontal = 29,
+ HatchStyleDashedDownwardDiagonal = 30,
+ HatchStyleDashedUpwardDiagonal = 31,
+ HatchStyleDashedHorizontal = 32,
+ HatchStyleDashedVertical = 33,
+ HatchStyleSmallConfetti = 34,
+ HatchStyleLargeConfetti = 35,
+ HatchStyleZigZag = 36,
+ HatchStyleWave = 37,
+ HatchStyleDiagonalBrick = 38,
+ HatchStyleHorizontalBrick = 39,
+ HatchStyleWeave = 40,
+ HatchStylePlaid = 41,
+ HatchStyleDivot = 42,
+ HatchStyleDottedGrid = 43,
+ HatchStyleDottedDiamond = 44,
+ HatchStyleShingle = 45,
+ HatchStyleTrellis = 46,
+ HatchStyleSphere = 47,
+ HatchStyleSmallGrid = 48,
+ HatchStyleSmallCheckerBoard = 49,
+ HatchStyleLargeCheckerBoard = 50,
+ HatchStyleOutlinedDiamond = 51,
+ HatchStyleSolidDiamond = 52,
+ HatchStyleTotal = 53,
+ HatchStyleLargeGrid = HatchStyleCross,
+ HatchStyleMin = HatchStyleHorizontal,
+ HatchStyleMax = HatchStyleTotal - 1
};
#ifndef __cplusplus
@@ -395,6 +456,7 @@
typedef enum GpTestControlEnum GpTestControlEnum;
typedef enum MetafileFrameUnit MetafileFrameUnit;
typedef enum PenType PenType;
+typedef enum HatchStyle HatchStyle;
#endif /* end of c typedefs */
Modified: trunk/reactos/include/psdk/gdiplusgpstubs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/gdiplusgpstub…
==============================================================================
--- trunk/reactos/include/psdk/gdiplusgpstubs.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/gdiplusgpstubs.h [iso-8859-1] Tue Jan 27 12:03:33 2009
@@ -23,6 +23,7 @@
class GpGraphics {};
class GpBrush {};
+class GpHatch : public GpBrush {};
class GpSolidFill : public GpBrush {};
class GpPath {};
class GpMatrix {};
@@ -49,6 +50,7 @@
typedef struct GpGraphics GpGraphics;
typedef struct GpPen GpPen;
typedef struct GpBrush GpBrush;
+typedef struct GpHatch GpHatch;
typedef struct GpSolidFill GpSolidFill;
typedef struct GpPath GpPath;
typedef struct GpMatrix GpMatrix;