[GDIPLUS] Sync with Wine Staging 1.7.55. CORE-10536
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 22 Nov 2015 10:10:02 +0000 (10:10 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 22 Nov 2015 10:10:02 +0000 (10:10 +0000)
svn path=/trunk/; revision=70003

17 files changed:
reactos/dll/win32/gdiplus/brush.c
reactos/dll/win32/gdiplus/customlinecap.c
reactos/dll/win32/gdiplus/font.c
reactos/dll/win32/gdiplus/gdiplus.c
reactos/dll/win32/gdiplus/gdiplus.spec
reactos/dll/win32/gdiplus/gdiplus_private.h
reactos/dll/win32/gdiplus/graphics.c
reactos/dll/win32/gdiplus/graphicspath.c
reactos/dll/win32/gdiplus/image.c
reactos/dll/win32/gdiplus/imageattributes.c
reactos/dll/win32/gdiplus/matrix.c
reactos/dll/win32/gdiplus/metafile.c
reactos/dll/win32/gdiplus/pathiterator.c
reactos/dll/win32/gdiplus/pen.c
reactos/dll/win32/gdiplus/region.c
reactos/dll/win32/gdiplus/stringformat.c
reactos/media/doc/README.WINE

index 733e7de..62523d3 100644 (file)
@@ -60,7 +60,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
     switch(brush->bt){
         case BrushTypeSolidColor:
         {
-            *clone = GdipAlloc(sizeof(GpSolidFill));
+            *clone = heap_alloc_zero(sizeof(GpSolidFill));
             if (!*clone) return OutOfMemory;
             memcpy(*clone, brush, sizeof(GpSolidFill));
             break;
@@ -76,7 +76,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
             INT count, pcount;
             GpStatus stat;
 
-            *clone = GdipAlloc(sizeof(GpPathGradient));
+            *clone = heap_alloc_zero(sizeof(GpPathGradient));
             if (!*clone) return OutOfMemory;
 
             src = (GpPathGradient*) brush,
@@ -87,7 +87,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
             stat = GdipClonePath(src->path, &dest->path);
 
             if(stat != Ok){
-                GdipFree(dest);
+                heap_free(dest);
                 return stat;
             }
 
@@ -96,25 +96,25 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
             /* blending */
             count = src->blendcount;
             dest->blendcount = count;
-            dest->blendfac = GdipAlloc(count * sizeof(REAL));
-            dest->blendpos = GdipAlloc(count * sizeof(REAL));
-            dest->surroundcolors = GdipAlloc(dest->surroundcolorcount * sizeof(ARGB));
+            dest->blendfac = heap_alloc_zero(count * sizeof(REAL));
+            dest->blendpos = heap_alloc_zero(count * sizeof(REAL));
+            dest->surroundcolors = heap_alloc_zero(dest->surroundcolorcount * sizeof(ARGB));
             pcount = dest->pblendcount;
             if (pcount)
             {
-                dest->pblendcolor = GdipAlloc(pcount * sizeof(ARGB));
-                dest->pblendpos = GdipAlloc(pcount * sizeof(REAL));
+                dest->pblendcolor = heap_alloc_zero(pcount * sizeof(ARGB));
+                dest->pblendpos = heap_alloc_zero(pcount * sizeof(REAL));
             }
 
             if(!dest->blendfac || !dest->blendpos || !dest->surroundcolors ||
                (pcount && (!dest->pblendcolor || !dest->pblendpos))){
                 GdipDeletePath(dest->path);
-                GdipFree(dest->blendfac);
-                GdipFree(dest->blendpos);
-                GdipFree(dest->surroundcolors);
-                GdipFree(dest->pblendcolor);
-                GdipFree(dest->pblendpos);
-                GdipFree(dest);
+                heap_free(dest->blendfac);
+                heap_free(dest->blendpos);
+                heap_free(dest->surroundcolors);
+                heap_free(dest->pblendcolor);
+                heap_free(dest->pblendpos);
+                heap_free(dest);
                 return OutOfMemory;
             }
 
@@ -134,7 +134,7 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
             GpLineGradient *dest, *src;
             INT count, pcount;
 
-            dest = GdipAlloc(sizeof(GpLineGradient));
+            dest = heap_alloc_zero(sizeof(GpLineGradient));
             if(!dest)    return OutOfMemory;
 
             src = (GpLineGradient*)brush;
@@ -142,23 +142,23 @@ GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
             memcpy(dest, src, sizeof(GpLineGradient));
 
             count = dest->blendcount;
-            dest->blendfac = GdipAlloc(count * sizeof(REAL));
-            dest->blendpos = GdipAlloc(count * sizeof(REAL));
+            dest->blendfac = heap_alloc_zero(count * sizeof(REAL));
+            dest->blendpos = heap_alloc_zero(count * sizeof(REAL));
             pcount = dest->pblendcount;
             if (pcount)
             {
-                dest->pblendcolor = GdipAlloc(pcount * sizeof(ARGB));
-                dest->pblendpos = GdipAlloc(pcount * sizeof(REAL));
+                dest->pblendcolor = heap_alloc_zero(pcount * sizeof(ARGB));
+                dest->pblendpos = heap_alloc_zero(pcount * sizeof(REAL));
             }
 
             if (!dest->blendfac || !dest->blendpos ||
                 (pcount && (!dest->pblendcolor || !dest->pblendpos)))
             {
-                GdipFree(dest->blendfac);
-                GdipFree(dest->blendpos);
-                GdipFree(dest->pblendcolor);
-                GdipFree(dest->pblendpos);
-                GdipFree(dest);
+                heap_free(dest->blendfac);
+                heap_free(dest->blendpos);
+                heap_free(dest->pblendcolor);
+                heap_free(dest->pblendpos);
+                heap_free(dest);
                 return OutOfMemory;
             }
 
@@ -260,7 +260,7 @@ GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, AR
 
     if(!brush)  return InvalidParameter;
 
-    *brush = GdipAlloc(sizeof(GpHatch));
+    *brush = heap_alloc_zero(sizeof(GpHatch));
     if (!*brush) return OutOfMemory;
 
     (*brush)->brush.bt = BrushTypeHatchFill;
@@ -288,7 +288,7 @@ GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint,
     if (startpoint->X == endpoint->X && startpoint->Y == endpoint->Y)
         return OutOfMemory;
 
-    *line = GdipAlloc(sizeof(GpLineGradient));
+    *line = heap_alloc_zero(sizeof(GpLineGradient));
     if(!*line)  return OutOfMemory;
 
     (*line)->brush.bt = BrushTypeLinearGradient;
@@ -319,14 +319,14 @@ GpStatus WINGDIPAPI GdipCreateLineBrush(GDIPCONST GpPointF* startpoint,
     }
 
     (*line)->blendcount = 1;
-    (*line)->blendfac = GdipAlloc(sizeof(REAL));
-    (*line)->blendpos = GdipAlloc(sizeof(REAL));
+    (*line)->blendfac = heap_alloc_zero(sizeof(REAL));
+    (*line)->blendpos = heap_alloc_zero(sizeof(REAL));
 
     if (!(*line)->blendfac || !(*line)->blendpos)
     {
-        GdipFree((*line)->blendfac);
-        GdipFree((*line)->blendpos);
-        GdipFree(*line);
+        heap_free((*line)->blendfac);
+        heap_free((*line)->blendpos);
+        heap_free(*line);
         *line = NULL;
         return OutOfMemory;
     }
@@ -527,7 +527,7 @@ static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradi
 
     GdipGetPathWorldBounds(path, &bounds, NULL, NULL);
 
-    *grad = GdipAlloc(sizeof(GpPathGradient));
+    *grad = heap_alloc_zero(sizeof(GpPathGradient));
     if (!*grad)
     {
         return OutOfMemory;
@@ -535,14 +535,14 @@ static GpStatus create_path_gradient(GpPath *path, ARGB centercolor, GpPathGradi
 
     GdipSetMatrixElements(&(*grad)->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
 
-    (*grad)->blendfac = GdipAlloc(sizeof(REAL));
-    (*grad)->blendpos = GdipAlloc(sizeof(REAL));
-    (*grad)->surroundcolors = GdipAlloc(sizeof(ARGB));
+    (*grad)->blendfac = heap_alloc_zero(sizeof(REAL));
+    (*grad)->blendpos = heap_alloc_zero(sizeof(REAL));
+    (*grad)->surroundcolors = heap_alloc_zero(sizeof(ARGB));
     if(!(*grad)->blendfac || !(*grad)->blendpos || !(*grad)->surroundcolors){
-        GdipFree((*grad)->blendfac);
-        GdipFree((*grad)->blendpos);
-        GdipFree((*grad)->surroundcolors);
-        GdipFree(*grad);
+        heap_free((*grad)->blendfac);
+        heap_free((*grad)->blendpos);
+        heap_free((*grad)->surroundcolors);
+        heap_free(*grad);
         *grad = NULL;
         return OutOfMemory;
     }
@@ -674,7 +674,7 @@ GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
 
     if(!sf)  return InvalidParameter;
 
-    *sf = GdipAlloc(sizeof(GpSolidFill));
+    *sf = heap_alloc_zero(sizeof(GpSolidFill));
     if (!*sf) return OutOfMemory;
 
     (*sf)->brush.bt = BrushTypeSolidColor;
@@ -783,7 +783,7 @@ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image,
     if (status != Ok)
         return status;
 
-    *texture = GdipAlloc(sizeof(GpTexture));
+    *texture = heap_alloc_zero(sizeof(GpTexture));
     if (!*texture){
         status = OutOfMemory;
         goto exit;
@@ -817,7 +817,7 @@ exit:
         if (*texture)
         {
             GdipDisposeImageAttributes((*texture)->imageattributes);
-            GdipFree(*texture);
+            heap_free(*texture);
             *texture = NULL;
         }
         GdipDisposeImage(new_image);
@@ -915,28 +915,28 @@ GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
     {
         case BrushTypePathGradient:
             GdipDeletePath(((GpPathGradient*) brush)->path);
-            GdipFree(((GpPathGradient*) brush)->blendfac);
-            GdipFree(((GpPathGradient*) brush)->blendpos);
-            GdipFree(((GpPathGradient*) brush)->surroundcolors);
-            GdipFree(((GpPathGradient*) brush)->pblendcolor);
-            GdipFree(((GpPathGradient*) brush)->pblendpos);
+            heap_free(((GpPathGradient*) brush)->blendfac);
+            heap_free(((GpPathGradient*) brush)->blendpos);
+            heap_free(((GpPathGradient*) brush)->surroundcolors);
+            heap_free(((GpPathGradient*) brush)->pblendcolor);
+            heap_free(((GpPathGradient*) brush)->pblendpos);
             break;
         case BrushTypeLinearGradient:
-            GdipFree(((GpLineGradient*)brush)->blendfac);
-            GdipFree(((GpLineGradient*)brush)->blendpos);
-            GdipFree(((GpLineGradient*)brush)->pblendcolor);
-            GdipFree(((GpLineGradient*)brush)->pblendpos);
+            heap_free(((GpLineGradient*)brush)->blendfac);
+            heap_free(((GpLineGradient*)brush)->blendpos);
+            heap_free(((GpLineGradient*)brush)->pblendcolor);
+            heap_free(((GpLineGradient*)brush)->pblendpos);
             break;
         case BrushTypeTextureFill:
             GdipDisposeImage(((GpTexture*)brush)->image);
             GdipDisposeImageAttributes(((GpTexture*)brush)->imageattributes);
-            GdipFree(((GpTexture*)brush)->bitmap_bits);
+            heap_free(((GpTexture*)brush)->bitmap_bits);
             break;
         default:
             break;
     }
 
-    GdipFree(brush);
+    heap_free(brush);
 
     return Ok;
 }
@@ -1291,21 +1291,21 @@ GpStatus WINGDIPAPI GdipSetLineBlend(GpLineGradient *brush,
        (count >= 2 && (positions[0] != 0.0f || positions[count-1] != 1.0f)))
         return InvalidParameter;
 
-    new_blendfac = GdipAlloc(count * sizeof(REAL));
-    new_blendpos = GdipAlloc(count * sizeof(REAL));
+    new_blendfac = heap_alloc_zero(count * sizeof(REAL));
+    new_blendpos = heap_alloc_zero(count * sizeof(REAL));
 
     if (!new_blendfac || !new_blendpos)
     {
-        GdipFree(new_blendfac);
-        GdipFree(new_blendpos);
+        heap_free(new_blendfac);
+        heap_free(new_blendpos);
         return OutOfMemory;
     }
 
     memcpy(new_blendfac, factors, count * sizeof(REAL));
     memcpy(new_blendpos, positions, count * sizeof(REAL));
 
-    GdipFree(brush->blendfac);
-    GdipFree(brush->blendpos);
+    heap_free(brush->blendfac);
+    heap_free(brush->blendpos);
 
     brush->blendcount = count;
     brush->blendfac = new_blendfac;
@@ -1436,21 +1436,21 @@ GpStatus WINGDIPAPI GdipSetPathGradientBlend(GpPathGradient *brush, GDIPCONST RE
        (count >= 2 && (pos[0] != 0.0f || pos[count-1] != 1.0f)))
         return InvalidParameter;
 
-    new_blendfac = GdipAlloc(count * sizeof(REAL));
-    new_blendpos = GdipAlloc(count * sizeof(REAL));
+    new_blendfac = heap_alloc_zero(count * sizeof(REAL));
+    new_blendpos = heap_alloc_zero(count * sizeof(REAL));
 
     if (!new_blendfac || !new_blendpos)
     {
-        GdipFree(new_blendfac);
-        GdipFree(new_blendpos);
+        heap_free(new_blendfac);
+        heap_free(new_blendpos);
         return OutOfMemory;
     }
 
     memcpy(new_blendfac, blend, count * sizeof(REAL));
     memcpy(new_blendpos, pos, count * sizeof(REAL));
 
-    GdipFree(brush->blendfac);
-    GdipFree(brush->blendpos);
+    heap_free(brush->blendfac);
+    heap_free(brush->blendpos);
 
     brush->blendcount = count;
     brush->blendfac = new_blendfac;
@@ -1505,20 +1505,20 @@ GpStatus WINGDIPAPI GdipSetPathGradientPresetBlend(GpPathGradient *brush,
         return InvalidParameter;
     }
 
-    new_color = GdipAlloc(count * sizeof(ARGB));
-    new_pos = GdipAlloc(count * sizeof(REAL));
+    new_color = heap_alloc_zero(count * sizeof(ARGB));
+    new_pos = heap_alloc_zero(count * sizeof(REAL));
     if (!new_color || !new_pos)
     {
-        GdipFree(new_color);
-        GdipFree(new_pos);
+        heap_free(new_color);
+        heap_free(new_pos);
         return OutOfMemory;
     }
 
     memcpy(new_color, blend, sizeof(ARGB) * count);
     memcpy(new_pos, pos, sizeof(REAL) * count);
 
-    GdipFree(brush->pblendcolor);
-    GdipFree(brush->pblendpos);
+    heap_free(brush->pblendcolor);
+    heap_free(brush->pblendpos);
 
     brush->pblendcolor = new_color;
     brush->pblendpos = new_pos;
@@ -1717,13 +1717,13 @@ GpStatus WINGDIPAPI GdipSetPathGradientSurroundColorsWithCount(GpPathGradient
             num_colors = 1;
     }
 
-    new_surroundcolors = GdipAlloc(num_colors * sizeof(ARGB));
+    new_surroundcolors = heap_alloc_zero(num_colors * sizeof(ARGB));
     if (!new_surroundcolors)
         return OutOfMemory;
 
     memcpy(new_surroundcolors, argb, num_colors * sizeof(ARGB));
 
-    GdipFree(grad->surroundcolors);
+    heap_free(grad->surroundcolors);
 
     grad->surroundcolors = new_surroundcolors;
     grad->surroundcolorcount = num_colors;
@@ -1954,20 +1954,20 @@ GpStatus WINGDIPAPI GdipSetLinePresetBlend(GpLineGradient *brush,
         return InvalidParameter;
     }
 
-    new_color = GdipAlloc(count * sizeof(ARGB));
-    new_pos = GdipAlloc(count * sizeof(REAL));
+    new_color = heap_alloc_zero(count * sizeof(ARGB));
+    new_pos = heap_alloc_zero(count * sizeof(REAL));
     if (!new_color || !new_pos)
     {
-        GdipFree(new_color);
-        GdipFree(new_pos);
+        heap_free(new_color);
+        heap_free(new_pos);
         return OutOfMemory;
     }
 
     memcpy(new_color, blend, sizeof(ARGB) * count);
     memcpy(new_pos, positions, sizeof(REAL) * count);
 
-    GdipFree(brush->pblendcolor);
-    GdipFree(brush->pblendpos);
+    heap_free(brush->pblendcolor);
+    heap_free(brush->pblendpos);
 
     brush->pblendcolor = new_color;
     brush->pblendpos = new_pos;
index 797e5b1..3d7e51a 100644 (file)
@@ -26,18 +26,18 @@ GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
     if(!from || !to)
         return InvalidParameter;
 
-    *to = GdipAlloc(sizeof(GpCustomLineCap));
+    *to = heap_alloc_zero(sizeof(GpCustomLineCap));
     if(!*to)   return OutOfMemory;
 
     memcpy(*to, from, sizeof(GpCustomLineCap));
 
-    (*to)->pathdata.Points = GdipAlloc(from->pathdata.Count * sizeof(PointF));
-    (*to)->pathdata.Types = GdipAlloc(from->pathdata.Count);
+    (*to)->pathdata.Points = heap_alloc_zero(from->pathdata.Count * sizeof(PointF));
+    (*to)->pathdata.Types = heap_alloc_zero(from->pathdata.Count);
 
     if((!(*to)->pathdata.Types  || !(*to)->pathdata.Points) && (*to)->pathdata.Count){
-        GdipFree((*to)->pathdata.Points);
-        GdipFree((*to)->pathdata.Types);
-        GdipFree(*to);
+        heap_free((*to)->pathdata.Points);
+        heap_free((*to)->pathdata.Types);
+        heap_free(*to);
         return OutOfMemory;
     }
 
@@ -62,7 +62,7 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
     if(!customCap || !(fillPath || strokePath))
         return InvalidParameter;
 
-    *customCap = GdipAlloc(sizeof(GpCustomLineCap));
+    *customCap = heap_alloc_zero(sizeof(GpCustomLineCap));
     if(!*customCap)    return OutOfMemory;
 
     if(strokePath){
@@ -74,14 +74,14 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
         pathdata = &fillPath->pathdata;
     }
 
-    (*customCap)->pathdata.Points = GdipAlloc(pathdata->Count * sizeof(PointF));
-    (*customCap)->pathdata.Types = GdipAlloc(pathdata->Count);
+    (*customCap)->pathdata.Points = heap_alloc_zero(pathdata->Count * sizeof(PointF));
+    (*customCap)->pathdata.Types = heap_alloc_zero(pathdata->Count);
 
     if((!(*customCap)->pathdata.Types || !(*customCap)->pathdata.Points) &&
         pathdata->Count){
-        GdipFree((*customCap)->pathdata.Points);
-        GdipFree((*customCap)->pathdata.Types);
-        GdipFree(*customCap);
+        heap_free((*customCap)->pathdata.Points);
+        heap_free((*customCap)->pathdata.Types);
+        heap_free(*customCap);
         return OutOfMemory;
     }
 
@@ -107,9 +107,9 @@ GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap *customCap)
     if(!customCap)
         return InvalidParameter;
 
-    GdipFree(customCap->pathdata.Points);
-    GdipFree(customCap->pathdata.Types);
-    GdipFree(customCap);
+    heap_free(customCap->pathdata.Points);
+    heap_free(customCap->pathdata.Types);
+    heap_free(customCap);
 
     return Ok;
 }
index 5630972..399595f 100644 (file)
@@ -163,7 +163,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
 
     if (!ret) return NotTrueTypeFont;
 
-    *font = GdipAlloc(sizeof(GpFont));
+    *font = heap_alloc_zero(sizeof(GpFont));
     if (!*font) return OutOfMemory;
 
     (*font)->unit = unit;
@@ -173,7 +173,7 @@ GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
     stat = clone_font_family(fontFamily, &(*font)->family);
     if (stat != Ok)
     {
-        GdipFree(*font);
+        heap_free(*font);
         return stat;
     }
 
@@ -209,7 +209,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
 
     if (!ret) return NotTrueTypeFont;
 
-    *font = GdipAlloc(sizeof(GpFont));
+    *font = heap_alloc_zero(sizeof(GpFont));
     if (!*font) return OutOfMemory;
 
     (*font)->unit = UnitWorld;
@@ -219,7 +219,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc,
     stat = GdipCreateFontFamilyFromName(facename, NULL, &(*font)->family);
     if (stat != Ok)
     {
-        GdipFree(*font);
+        heap_free(*font);
         return NotTrueTypeFont;
     }
 
@@ -260,7 +260,7 @@ GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
         return InvalidParameter;
 
     GdipDeleteFontFamily(font->family);
-    GdipFree(font);
+    heap_free(font);
 
     return Ok;
 }
@@ -511,12 +511,12 @@ GpStatus WINGDIPAPI GdipCloneFont(GpFont *font, GpFont **cloneFont)
     if(!font || !cloneFont)
         return InvalidParameter;
 
-    *cloneFont = GdipAlloc(sizeof(GpFont));
+    *cloneFont = heap_alloc_zero(sizeof(GpFont));
     if(!*cloneFont)    return OutOfMemory;
 
     **cloneFont = *font;
     stat = GdipCloneFontFamily(font->family, &(*cloneFont)->family);
-    if (stat != Ok) GdipFree(*cloneFont);
+    if (stat != Ok) heap_free(*cloneFont);
 
     return stat;
 }
@@ -615,11 +615,15 @@ 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)
 {
+    const ENUMLOGFONTW *elfW = (const ENUMLOGFONTW *)elf;
+    LOGFONTW *lf = (LOGFONTW *)lParam;
+
     if (type & RASTER_FONTTYPE)
         return 1;
 
-    *(LOGFONTW *)lParam = *elf;
-
+    *lf = *elf;
+    /* replace substituted font name by a real one */
+    lstrcpynW(lf->lfFaceName, elfW->elfFullName, LF_FACESIZE);
     return 0;
 }
 
@@ -641,8 +645,6 @@ static BOOL get_font_metrics(HDC hdc, struct font_metrics *fm)
     otm.otmSize = sizeof(otm);
     if (!GetOutlineTextMetricsW(hdc, otm.otmSize, &otm)) return FALSE;
 
-    GetTextFaceW(hdc, LF_FACESIZE, fm->facename);
-
     fm->em_height = otm.otmEMSquare;
     fm->dpi = GetDeviceCaps(hdc, LOGPIXELSY);
 
@@ -691,6 +693,8 @@ static GpStatus find_installed_font(const WCHAR *name, struct font_metrics *fm)
     {
         HFONT hfont, old_font;
 
+        strcpyW(fm->facename, lf.lfFaceName);
+
         hfont = CreateFontIndirectW(&lf);
         old_font = SelectObject(hdc, hfont);
         ret = get_font_metrics(hdc, fm) ? Ok : NotTrueTypeFont;
@@ -740,7 +744,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
     stat = find_installed_font(name, &fm);
     if (stat != Ok) return stat;
 
-    ffamily = GdipAlloc(sizeof (GpFontFamily));
+    ffamily = heap_alloc_zero(sizeof (GpFontFamily));
     if (!ffamily) return OutOfMemory;
 
     lstrcpyW(ffamily->FamilyName, fm.facename);
@@ -759,7 +763,7 @@ GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
 
 static GpStatus clone_font_family(const GpFontFamily *family, GpFontFamily **clone)
 {
-    *clone = GdipAlloc(sizeof(GpFontFamily));
+    *clone = heap_alloc_zero(sizeof(GpFontFamily));
     if (!*clone) return OutOfMemory;
 
     **clone = *family;
@@ -851,7 +855,7 @@ GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
         return InvalidParameter;
     TRACE("Deleting %p (%s)\n", FontFamily, debugstr_w(FontFamily->FamilyName));
 
-    GdipFree (FontFamily);
+    heap_free (FontFamily);
 
     return Ok;
 }
@@ -1079,7 +1083,7 @@ GpStatus WINGDIPAPI GdipNewPrivateFontCollection(GpFontCollection** fontCollecti
     if (!fontCollection)
         return InvalidParameter;
 
-    *fontCollection = GdipAlloc(sizeof(GpFontCollection));
+    *fontCollection = heap_alloc_zero(sizeof(GpFontCollection));
     if (!*fontCollection) return OutOfMemory;
 
     (*fontCollection)->FontFamilies = NULL;
@@ -1103,8 +1107,8 @@ GpStatus WINGDIPAPI GdipDeletePrivateFontCollection(GpFontCollection **fontColle
     if (!fontCollection)
         return InvalidParameter;
 
-    for (i = 0; i < (*fontCollection)->count; i++) GdipFree((*fontCollection)->FontFamilies[i]);
-    GdipFree(*fontCollection);
+    for (i = 0; i < (*fontCollection)->count; i++) heap_free((*fontCollection)->FontFamilies[i]);
+    heap_free(*fontCollection);
 
     return Ok;
 }
@@ -1571,7 +1575,7 @@ void free_installed_fonts(void)
 {
     while (installedFontCollection.count)
         GdipDeleteFontFamily(installedFontCollection.FontFamilies[--installedFontCollection.count]);
-    HeapFree(GetProcessHeap(), 0, installedFontCollection.FontFamilies);
+    heap_free(installedFontCollection.FontFamilies);
     installedFontCollection.FontFamilies = NULL;
     installedFontCollection.allocated = 0;
 }
@@ -1593,13 +1597,13 @@ static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm,
     if (fonts->allocated == fonts->count)
     {
         INT new_alloc_count = fonts->allocated+50;
-        GpFontFamily** new_family_list = HeapAlloc(GetProcessHeap(), 0, new_alloc_count*sizeof(void*));
+        GpFontFamily** new_family_list = heap_alloc(new_alloc_count*sizeof(void*));
 
         if (!new_family_list)
             return 0;
 
         memcpy(new_family_list, fonts->FontFamilies, fonts->count*sizeof(void*));
-        HeapFree(GetProcessHeap(), 0, fonts->FontFamilies);
+        heap_free(fonts->FontFamilies);
         fonts->FontFamilies = new_family_list;
         fonts->allocated = new_alloc_count;
     }
index 2204e6a..b3ed4aa 100644 (file)
@@ -389,12 +389,12 @@ BOOL lengthen_path(GpPath *path, INT len)
     if(path->datalen == 0){
         path->datalen = len * 2;
 
-        path->pathdata.Points = GdipAlloc(path->datalen * sizeof(PointF));
+        path->pathdata.Points = heap_alloc_zero(path->datalen * sizeof(PointF));
         if(!path->pathdata.Points)   return FALSE;
 
-        path->pathdata.Types = GdipAlloc(path->datalen);
+        path->pathdata.Types = heap_alloc_zero(path->datalen);
         if(!path->pathdata.Types){
-            GdipFree(path->pathdata.Points);
+            heap_free(path->pathdata.Points);
             return FALSE;
         }
     }
@@ -403,12 +403,10 @@ BOOL lengthen_path(GpPath *path, INT len)
         while(path->datalen - path->pathdata.Count < len)
             path->datalen *= 2;
 
-        path->pathdata.Points = HeapReAlloc(GetProcessHeap(), 0,
-            path->pathdata.Points, path->datalen * sizeof(PointF));
+        path->pathdata.Points = heap_realloc(path->pathdata.Points, path->datalen * sizeof(PointF));
         if(!path->pathdata.Points)  return FALSE;
 
-        path->pathdata.Types = HeapReAlloc(GetProcessHeap(), 0,
-            path->pathdata.Types, path->datalen);
+        path->pathdata.Types = heap_realloc(path->pathdata.Types, path->datalen);
         if(!path->pathdata.Types)   return FALSE;
     }
 
@@ -450,8 +448,8 @@ void delete_element(region_element* element)
         default:
             delete_element(element->elementdata.combine.left);
             delete_element(element->elementdata.combine.right);
-            GdipFree(element->elementdata.combine.left);
-            GdipFree(element->elementdata.combine.right);
+            heap_free(element->elementdata.combine.left);
+            heap_free(element->elementdata.combine.right);
             break;
     }
 }
index 64c9b95..9f7ce5f 100644 (file)
 610 stdcall GdipFindFirstImageItem(ptr ptr)
 611 stub GdipFindNextImageItem
 612 stdcall GdipGetImageItemData(ptr ptr)
-613 stdcall -stub GdipCreateEffect(ptr ptr)
+613 stdcall GdipCreateEffect(int128 ptr)
 614 stdcall GdipDeleteEffect(ptr)
 615 stub GdipGetEffectParameterSize
 616 stub GdipGetEffectParameters
 620 stdcall GdipBitmapApplyEffect(ptr ptr ptr long ptr ptr)
 621 stub GdipBitmapGetHistogram
 622 stub GdipBitmapGetHistogramSize
-623 stub GdipBitmapConvertFormat
+623 stdcall GdipBitmapConvertFormat(ptr long long long ptr float)
 624 stdcall GdipImageSetAbort(ptr ptr)
 625 stub GdipGraphicsSetAbort
 626 stub GdipDrawImageFX
index 54e7664..9cde1f8 100644 (file)
@@ -56,6 +56,29 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
 #define GIF_DISPOSE_RESTORE_TO_BKGND 2
 #define GIF_DISPOSE_RESTORE_TO_PREV 3
 
+static void *heap_alloc(size_t len) __WINE_ALLOC_SIZE(1);
+static inline void *heap_alloc(size_t len)
+{
+    return HeapAlloc(GetProcessHeap(), 0, len);
+}
+
+static void *heap_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1);
+static inline void *heap_alloc_zero(size_t len)
+{
+    return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
+}
+
+static void *heap_realloc(void *mem, size_t len) __WINE_ALLOC_SIZE(2);
+static inline void *heap_realloc(void *mem, size_t len)
+{
+    return HeapReAlloc(GetProcessHeap(), 0, mem, len);
+}
+
+static inline BOOL heap_free(void *mem)
+{
+    return HeapFree(GetProcessHeap(), 0, mem);
+}
+
 COLORREF ARGB2COLORREF(ARGB color) DECLSPEC_HIDDEN;
 HBITMAP ARGB2BMP(ARGB color) DECLSPEC_HIDDEN;
 extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
index cdb5541..0a4eedd 100644 (file)
@@ -454,7 +454,7 @@ static GpStatus alpha_blend_pixels_hrgn(GpGraphics *graphics, INT dst_x, INT dst
 
         size = GetRegionData(hrgn, 0, NULL);
 
-        rgndata = GdipAlloc(size);
+        rgndata = heap_alloc_zero(size);
         if (!rgndata)
         {
             DeleteObject(hrgn);
@@ -473,7 +473,7 @@ static GpStatus alpha_blend_pixels_hrgn(GpGraphics *graphics, INT dst_x, INT dst
                 src_stride, fmt);
         }
 
-        GdipFree(rgndata);
+        heap_free(rgndata);
 
         DeleteObject(hrgn);
 
@@ -1230,7 +1230,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
         {
             BitmapData lockeddata;
 
-            fill->bitmap_bits = GdipAlloc(sizeof(ARGB) * bitmap->width * bitmap->height);
+            fill->bitmap_bits = heap_alloc_zero(sizeof(ARGB) * bitmap->width * bitmap->height);
             if (!fill->bitmap_bits)
                 stat = OutOfMemory;
 
@@ -1256,7 +1256,7 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
 
             if (stat != Ok)
             {
-                GdipFree(fill->bitmap_bits);
+                heap_free(fill->bitmap_bits);
                 fill->bitmap_bits = NULL;
             }
         }
@@ -1652,9 +1652,9 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
                 break;
 
             count = custom->pathdata.Count;
-            custptf = GdipAlloc(count * sizeof(PointF));
-            custpt = GdipAlloc(count * sizeof(POINT));
-            tp = GdipAlloc(count);
+            custptf = heap_alloc_zero(count * sizeof(PointF));
+            custpt = heap_alloc_zero(count * sizeof(POINT));
+            tp = heap_alloc_zero(count);
 
             if(!custptf || !custpt || !tp)
                 goto custend;
@@ -1683,9 +1683,9 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s
                 PolyDraw(graphics->hdc, custpt, tp, count);
 
 custend:
-            GdipFree(custptf);
-            GdipFree(custpt);
-            GdipFree(tp);
+            heap_free(custptf);
+            heap_free(custpt);
+            heap_free(tp);
             break;
         default:
             break;
@@ -1787,9 +1787,9 @@ static void shorten_bezier_amt(GpPointF * pt, REAL amt, BOOL rev)
 static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF * pt,
     GDIPCONST BYTE * types, INT count, BOOL caps)
 {
-    POINT *pti = GdipAlloc(count * sizeof(POINT));
-    BYTE *tp = GdipAlloc(count);
-    GpPointF *ptcopy = GdipAlloc(count * sizeof(GpPointF));
+    POINT *pti = heap_alloc_zero(count * sizeof(POINT));
+    BYTE *tp = heap_alloc_zero(count);
+    GpPointF *ptcopy = heap_alloc_zero(count * sizeof(GpPointF));
     INT i, j;
     GpStatus status = GenericError;
 
@@ -1902,9 +1902,9 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *
     status = Ok;
 
 end:
-    GdipFree(pti);
-    GdipFree(ptcopy);
-    GdipFree(tp);
+    heap_free(pti);
+    heap_free(ptcopy);
+    heap_free(tp);
 
     return status;
 }
@@ -1942,7 +1942,7 @@ static GpStatus init_container(GraphicsContainerItem** container,
         GDIPCONST GpGraphics* graphics){
     GpStatus sts;
 
-    *container = GdipAlloc(sizeof(GraphicsContainerItem));
+    *container = heap_alloc_zero(sizeof(GraphicsContainerItem));
     if(!(*container))
         return OutOfMemory;
 
@@ -1963,7 +1963,7 @@ static GpStatus init_container(GraphicsContainerItem** container,
 
     sts = GdipCloneRegion(graphics->clip, &(*container)->clip);
     if(sts != Ok){
-        GdipFree(*container);
+        heap_free(*container);
         *container = NULL;
         return sts;
     }
@@ -1974,7 +1974,7 @@ static GpStatus init_container(GraphicsContainerItem** container,
 static void delete_container(GraphicsContainerItem* container)
 {
     GdipDeleteRegion(container->clip);
-    GdipFree(container);
+    heap_free(container);
 }
 
 static GpStatus restore_container(GpGraphics* graphics,
@@ -2212,13 +2212,13 @@ GpStatus WINGDIPAPI GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **gra
     if(graphics == NULL)
         return InvalidParameter;
 
-    *graphics = GdipAlloc(sizeof(GpGraphics));
+    *graphics = heap_alloc_zero(sizeof(GpGraphics));
     if(!*graphics)  return OutOfMemory;
 
     GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
 
     if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
-        GdipFree(*graphics);
+        heap_free(*graphics);
         return retval;
     }
 
@@ -2255,13 +2255,13 @@ GpStatus graphics_from_image(GpImage *image, GpGraphics **graphics)
 {
     GpStatus retval;
 
-    *graphics = GdipAlloc(sizeof(GpGraphics));
+    *graphics = heap_alloc_zero(sizeof(GpGraphics));
     if(!*graphics)  return OutOfMemory;
 
     GdipSetMatrixElements(&(*graphics)->worldtrans, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
 
     if((retval = GdipCreateRegion(&(*graphics)->clip)) != Ok){
-        GdipFree(*graphics);
+        heap_free(*graphics);
         return retval;
     }
 
@@ -2374,7 +2374,7 @@ GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
      * accessing freed memory. */
     graphics->busy = TRUE;
 
-    GdipFree(graphics);
+    heap_free(graphics);
 
     return Ok;
 }
@@ -2488,7 +2488,7 @@ GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen,
     if(graphics->busy)
         return ObjectBusy;
 
-    pts = GdipAlloc(sizeof(GpPointF) * count);
+    pts = heap_alloc_zero(sizeof(GpPointF) * count);
     if(!pts)
         return OutOfMemory;
 
@@ -2499,7 +2499,7 @@ GpStatus WINGDIPAPI GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen,
 
     ret = GdipDrawBeziers(graphics,pen,pts,count);
 
-    GdipFree(pts);
+    heap_free(pts);
 
     return ret;
 }
@@ -2558,7 +2558,7 @@ GpStatus WINGDIPAPI GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen,
     if(!points || count <= 0)
         return InvalidParameter;
 
-    ptf = GdipAlloc(sizeof(GpPointF)*count);
+    ptf = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!ptf)
         return OutOfMemory;
 
@@ -2569,7 +2569,7 @@ GpStatus WINGDIPAPI GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen,
 
     stat = GdipDrawClosedCurve2(graphics, pen, ptf, count, tension);
 
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return stat;
 }
@@ -2594,7 +2594,7 @@ GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics *graphics, GpPen *pen,
     if(!points)
         return InvalidParameter;
 
-    pointsF = GdipAlloc(sizeof(GpPointF)*count);
+    pointsF = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!pointsF)
         return OutOfMemory;
 
@@ -2604,7 +2604,7 @@ GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics *graphics, GpPen *pen,
     }
 
     ret = GdipDrawCurve(graphics,pen,pointsF,count);
-    GdipFree(pointsF);
+    heap_free(pointsF);
 
     return ret;
 }
@@ -2650,7 +2650,7 @@ GpStatus WINGDIPAPI GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen,
     if(!points)
         return InvalidParameter;
 
-    pointsF = GdipAlloc(sizeof(GpPointF)*count);
+    pointsF = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!pointsF)
         return OutOfMemory;
 
@@ -2660,7 +2660,7 @@ GpStatus WINGDIPAPI GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen,
     }
 
     ret = GdipDrawCurve2(graphics,pen,pointsF,count,tension);
-    GdipFree(pointsF);
+    heap_free(pointsF);
 
     return ret;
 }
@@ -3000,7 +3000,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
 
             TRACE("src_area: %d x %d\n", src_area.Width, src_area.Height);
 
-            src_data = GdipAlloc(sizeof(ARGB) * src_area.Width * src_area.Height);
+            src_data = heap_alloc_zero(sizeof(ARGB) * src_area.Width * src_area.Height);
             if (!src_data)
                 return OutOfMemory;
             src_stride = sizeof(ARGB) * src_area.Width;
@@ -3023,7 +3023,7 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
 
             if (stat != Ok)
             {
-                GdipFree(src_data);
+                heap_free(src_data);
                 return stat;
             }
 
@@ -3034,10 +3034,10 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
             if (do_resampling)
             {
                 /* Transform the bits as needed to the destination. */
-                dst_data = dst_dyn_data = GdipAlloc(sizeof(ARGB) * (dst_area.right - dst_area.left) * (dst_area.bottom - dst_area.top));
+                dst_data = dst_dyn_data = heap_alloc_zero(sizeof(ARGB) * (dst_area.right - dst_area.left) * (dst_area.bottom - dst_area.top));
                 if (!dst_data)
                 {
-                    GdipFree(src_data);
+                    heap_free(src_data);
                     return OutOfMemory;
                 }
 
@@ -3080,9 +3080,9 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
                 dst_data, dst_area.right - dst_area.left, dst_area.bottom - dst_area.top, dst_stride,
                 lockeddata.PixelFormat);
 
-            GdipFree(src_data);
+            heap_free(src_data);
 
-            GdipFree(dst_dyn_data);
+            heap_free(dst_dyn_data);
 
             return stat;
         }
@@ -3349,7 +3349,7 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST
 
     TRACE("(%p, %p, %p, %d)\n", graphics, pen, points, count);
 
-    ptf = GdipAlloc(count * sizeof(GpPointF));
+    ptf = heap_alloc_zero(count * sizeof(GpPointF));
     if(!ptf) return OutOfMemory;
 
     for(i = 0; i < count; i ++){
@@ -3359,7 +3359,7 @@ GpStatus WINGDIPAPI GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST
 
     retval = GdipDrawLines(graphics, pen, ptf, count);
 
-    GdipFree(ptf);
+    heap_free(ptf);
     return retval;
 }
 
@@ -3508,7 +3508,7 @@ GpStatus WINGDIPAPI GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen,
     if(!rects || count<=0)
         return InvalidParameter;
 
-    rectsF = GdipAlloc(sizeof(GpRectF) * count);
+    rectsF = heap_alloc_zero(sizeof(GpRectF) * count);
     if(!rectsF)
         return OutOfMemory;
 
@@ -3520,7 +3520,7 @@ GpStatus WINGDIPAPI GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen,
     }
 
     ret = GdipDrawRectangles(graphics, pen, rectsF, count);
-    GdipFree(rectsF);
+    heap_free(rectsF);
 
     return ret;
 }
@@ -3570,7 +3570,7 @@ GpStatus WINGDIPAPI GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush,
     if(count == 1)    /* Do nothing */
         return Ok;
 
-    ptf = GdipAlloc(sizeof(GpPointF)*count);
+    ptf = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!ptf)
         return OutOfMemory;
 
@@ -3581,7 +3581,7 @@ GpStatus WINGDIPAPI GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush,
 
     stat = GdipFillClosedCurve2(graphics, brush, ptf, count, tension, fill);
 
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return stat;
 }
@@ -3913,7 +3913,7 @@ GpStatus WINGDIPAPI GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, GD
     if(!rects || count <= 0)
         return InvalidParameter;
 
-    rectsF = GdipAlloc(sizeof(GpRectF)*count);
+    rectsF = heap_alloc_zero(sizeof(GpRectF)*count);
     if(!rectsF)
         return OutOfMemory;
 
@@ -3925,7 +3925,7 @@ GpStatus WINGDIPAPI GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, GD
     }
 
     ret = GdipFillRectangles(graphics,brush,rectsF,count);
-    GdipFree(rectsF);
+    heap_free(rectsF);
 
     return ret;
 }
@@ -4016,7 +4016,7 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush,
         gp_bound_rect.Width = bound_rect.right - bound_rect.left;
         gp_bound_rect.Height = bound_rect.bottom - bound_rect.top;
 
-        pixel_data = GdipAlloc(sizeof(*pixel_data) * gp_bound_rect.Width * gp_bound_rect.Height);
+        pixel_data = heap_alloc_zero(sizeof(*pixel_data) * gp_bound_rect.Width * gp_bound_rect.Height);
         if (!pixel_data)
             stat = OutOfMemory;
 
@@ -4031,7 +4031,7 @@ static GpStatus SOFTWARE_GdipFillRegion(GpGraphics *graphics, GpBrush *brush,
                     gp_bound_rect.Height, gp_bound_rect.Width * 4, hregion,
                     PixelFormat32bppARGB);
 
-            GdipFree(pixel_data);
+            heap_free(pixel_data);
         }
 
         DeleteObject(hregion);
@@ -4496,7 +4496,7 @@ GpStatus gdip_format_string(HDC hdc,
 
     if(length == -1) length = lstrlenW(string);
 
-    stringdup = GdipAlloc((length + 1) * sizeof(WCHAR));
+    stringdup = heap_alloc_zero((length + 1) * sizeof(WCHAR));
     if(!stringdup) return OutOfMemory;
 
     if (!format)
@@ -4504,7 +4504,7 @@ GpStatus gdip_format_string(HDC hdc,
         stat = GdipStringFormatGetGenericDefault(&dyn_format);
         if (stat != Ok)
         {
-            GdipFree(stringdup);
+            heap_free(stringdup);
             return stat;
         }
         format = dyn_format;
@@ -4530,7 +4530,7 @@ GpStatus gdip_format_string(HDC hdc,
     }
 
     if (hotkeyprefix_count)
-        hotkeyprefix_offsets = GdipAlloc(sizeof(INT) * hotkeyprefix_count);
+        hotkeyprefix_offsets = heap_alloc_zero(sizeof(INT) * hotkeyprefix_count);
 
     hotkeyprefix_count = 0;
 
@@ -4656,8 +4656,8 @@ GpStatus gdip_format_string(HDC hdc,
             break;
     }
 
-    GdipFree(stringdup);
-    GdipFree(hotkeyprefix_offsets);
+    heap_free(stringdup);
+    heap_free(hotkeyprefix_offsets);
     GdipDeleteStringFormat(dyn_format);
 
     return stat;
@@ -5632,7 +5632,7 @@ GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST Gp
         return Ok;
     }
 
-    pti = GdipAlloc(sizeof(POINT) * count);
+    pti = heap_alloc_zero(sizeof(POINT) * count);
 
     save_state = prepare_dc(graphics, pen);
     SelectObject(graphics->hdc, GetStockObject(NULL_BRUSH));
@@ -5641,7 +5641,7 @@ GpStatus WINGDIPAPI GdipDrawPolygon(GpGraphics *graphics,GpPen *pen,GDIPCONST Gp
     Polygon(graphics->hdc, pti, count);
 
     restore_dc(graphics, save_state);
-    GdipFree(pti);
+    heap_free(pti);
 
     return Ok;
 }
@@ -5656,7 +5656,7 @@ GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics *graphics,GpPen *pen,GDIPCONST G
     TRACE("(%p, %p, %p, %d)\n", graphics, pen, points, count);
 
     if(count<=0)    return InvalidParameter;
-    ptf = GdipAlloc(sizeof(GpPointF) * count);
+    ptf = heap_alloc_zero(sizeof(GpPointF) * count);
 
     for(i = 0;i < count; i++){
         ptf[i].X = (REAL)points[i].X;
@@ -5664,7 +5664,7 @@ GpStatus WINGDIPAPI GdipDrawPolygonI(GpGraphics *graphics,GpPen *pen,GDIPCONST G
     }
 
     ret = GdipDrawPolygon(graphics,pen,ptf,count);
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return ret;
 }
@@ -5878,7 +5878,7 @@ GpStatus WINGDIPAPI GdipGetClip(GpGraphics *graphics, GpRegion *region)
     /* free everything except root node and header */
     delete_element(&region->node);
     memcpy(region, clip, sizeof(GpRegion));
-    GdipFree(clip);
+    heap_free(clip);
 
     return Ok;
 }
@@ -5970,7 +5970,7 @@ GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace
     if(count <= 0)
         return InvalidParameter;
 
-    pointsF = GdipAlloc(sizeof(GpPointF) * count);
+    pointsF = heap_alloc_zero(sizeof(GpPointF) * count);
     if(!pointsF)
         return OutOfMemory;
 
@@ -5986,7 +5986,7 @@ GpStatus WINGDIPAPI GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace
             points[i].X = gdip_round(pointsF[i].X);
             points[i].Y = gdip_round(pointsF[i].Y);
         }
-    GdipFree(pointsF);
+    heap_free(pointsF);
 
     return ret;
 }
@@ -6099,7 +6099,7 @@ GpStatus WINGDIPAPI GdipMeasureDriverString(GpGraphics *graphics, GDIPCONST UINT
 
     if (flags & DriverStringOptionsCmapLookup)
     {
-        glyph_indices = dynamic_glyph_indices = GdipAlloc(sizeof(WORD) * length);
+        glyph_indices = dynamic_glyph_indices = heap_alloc_zero(sizeof(WORD) * length);
         if (!glyph_indices)
         {
             DeleteDC(hdc);
@@ -6141,7 +6141,7 @@ GpStatus WINGDIPAPI GdipMeasureDriverString(GpGraphics *graphics, GDIPCONST UINT
         if (max_x < x) max_x = x;
     }
 
-    GdipFree(dynamic_glyph_indices);
+    heap_free(dynamic_glyph_indices);
     DeleteDC(hdc);
     DeleteObject(hfont);
 
@@ -6223,7 +6223,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
     if (flags & unsupported_flags)
         FIXME("Ignoring flags %x\n", flags & unsupported_flags);
 
-    pti = GdipAlloc(sizeof(POINT) * length);
+    pti = heap_alloc_zero(sizeof(POINT) * length);
     if (!pti)
         return OutOfMemory;
 
@@ -6235,10 +6235,10 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
     }
     else
     {
-        real_positions = GdipAlloc(sizeof(PointF) * length);
+        real_positions = heap_alloc_zero(sizeof(PointF) * length);
         if (!real_positions)
         {
-            GdipFree(pti);
+            heap_free(pti);
             return OutOfMemory;
         }
 
@@ -6246,7 +6246,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
 
         transform_and_round_points(graphics, pti, real_positions, length);
 
-        GdipFree(real_positions);
+        heap_free(real_positions);
     }
 
     get_font_hfont(graphics, font, format, &hfont, matrix);
@@ -6266,7 +6266,7 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
         if (glyphsize == GDI_ERROR)
         {
             ERR("GetGlyphOutlineW failed\n");
-            GdipFree(pti);
+            heap_free(pti);
             DeleteDC(hdc);
             DeleteObject(hfont);
             return GenericError;
@@ -6299,15 +6299,15 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
         /* Nothing to draw. */
         return Ok;
 
-    glyph_mask = GdipAlloc(max_glyphsize);
-    text_mask = GdipAlloc((max_x - min_x) * (max_y - min_y));
+    glyph_mask = heap_alloc_zero(max_glyphsize);
+    text_mask = heap_alloc_zero((max_x - min_x) * (max_y - min_y));
     text_mask_stride = max_x - min_x;
 
     if (!(glyph_mask && text_mask))
     {
-        GdipFree(glyph_mask);
-        GdipFree(text_mask);
-        GdipFree(pti);
+        heap_free(glyph_mask);
+        heap_free(text_mask);
+        heap_free(pti);
         DeleteDC(hdc);
         DeleteObject(hfont);
         return OutOfMemory;
@@ -6342,16 +6342,16 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
         }
     }
 
-    GdipFree(pti);
+    heap_free(pti);
     DeleteDC(hdc);
     DeleteObject(hfont);
-    GdipFree(glyph_mask);
+    heap_free(glyph_mask);
 
     /* get the brush data */
-    pixel_data = GdipAlloc(4 * (max_x - min_x) * (max_y - min_y));
+    pixel_data = heap_alloc_zero(4 * (max_x - min_x) * (max_y - min_y));
     if (!pixel_data)
     {
-        GdipFree(text_mask);
+        heap_free(text_mask);
         return OutOfMemory;
     }
 
@@ -6364,8 +6364,8 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
     stat = brush_fill_pixels(graphics, (GpBrush*)brush, (DWORD*)pixel_data, &pixel_area, pixel_area.Width);
     if (stat != Ok)
     {
-        GdipFree(text_mask);
-        GdipFree(pixel_data);
+        heap_free(text_mask);
+        heap_free(pixel_data);
         return stat;
     }
 
@@ -6382,13 +6382,13 @@ static GpStatus SOFTWARE_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UI
         }
     }
 
-    GdipFree(text_mask);
+    heap_free(text_mask);
 
     /* draw the result */
     stat = alpha_blend_pixels(graphics, min_x, min_y, pixel_data, pixel_area.Width,
         pixel_area.Height, pixel_data_stride, PixelFormat32bppARGB);
 
-    GdipFree(pixel_data);
+    heap_free(pixel_data);
 
     return stat;
 }
index e56f380..d37efe9 100644 (file)
@@ -29,7 +29,7 @@ struct path_list_node_t {
 /* init list */
 static BOOL init_path_list(path_list_node_t **node, REAL x, REAL y)
 {
-    *node = GdipAlloc(sizeof(path_list_node_t));
+    *node = heap_alloc_zero(sizeof(path_list_node_t));
     if(!*node)
         return FALSE;
 
@@ -48,7 +48,7 @@ static void free_path_list(path_list_node_t *node)
 
     while(n){
         n = n->next;
-        GdipFree(node);
+        heap_free(node);
         node = n;
     }
 }
@@ -63,7 +63,7 @@ static path_list_node_t* add_path_list_node(path_list_node_t *node, REAL x, REAL
 {
     path_list_node_t *new;
 
-    new = GdipAlloc(sizeof(path_list_node_t));
+    new = heap_alloc_zero(sizeof(path_list_node_t));
     if(!new)
         return NULL;
 
@@ -279,7 +279,7 @@ GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points,
     if(!points || ((count - 1) % 3))
         return InvalidParameter;
 
-    ptsF = GdipAlloc(sizeof(GpPointF) * count);
+    ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
     if(!ptsF)
         return OutOfMemory;
 
@@ -289,7 +289,7 @@ GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points,
     }
 
     ret = GdipAddPathBeziers(path, ptsF, count);
-    GdipFree(ptsF);
+    heap_free(ptsF);
 
     return ret;
 }
@@ -324,11 +324,11 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *po
     if(!path || !points || count <= 1)
         return InvalidParameter;
 
-    pt = GdipAlloc(len_pt * sizeof(GpPointF));
-    pts = GdipAlloc((count + 1)*sizeof(GpPointF));
+    pt = heap_alloc_zero(len_pt * sizeof(GpPointF));
+    pts = heap_alloc_zero((count + 1)*sizeof(GpPointF));
     if(!pt || !pts){
-        GdipFree(pt);
-        GdipFree(pts);
+        heap_free(pt);
+        heap_free(pts);
         return OutOfMemory;
     }
 
@@ -374,8 +374,8 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *po
         path->newfigure = TRUE;
     }
 
-    GdipFree(pts);
-    GdipFree(pt);
+    heap_free(pts);
+    heap_free(pt);
 
     return stat;
 }
@@ -392,7 +392,7 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *po
     if(!path || !points || count <= 1)
         return InvalidParameter;
 
-    ptf = GdipAlloc(sizeof(GpPointF)*count);
+    ptf = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!ptf)
         return OutOfMemory;
 
@@ -403,7 +403,7 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *po
 
     stat = GdipAddPathClosedCurve2(path, ptf, count, tension);
 
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return stat;
 }
@@ -441,7 +441,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points,
     if(!path || !points || count <= 1)
         return InvalidParameter;
 
-    pt = GdipAlloc(len_pt * sizeof(GpPointF));
+    pt = heap_alloc_zero(len_pt * sizeof(GpPointF));
     if(!pt)
         return OutOfMemory;
 
@@ -476,7 +476,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points,
 
     stat = GdipAddPathBeziers(path, pt, len_pt);
 
-    GdipFree(pt);
+    heap_free(pt);
 
     return stat;
 }
@@ -493,7 +493,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points,
     if(!path || !points || count <= 1)
         return InvalidParameter;
 
-    ptf = GdipAlloc(sizeof(GpPointF)*count);
+    ptf = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!ptf)
         return OutOfMemory;
 
@@ -504,7 +504,7 @@ GpStatus WINGDIPAPI GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points,
 
     stat = GdipAddPathCurve2(path, ptf, count, tension);
 
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return stat;
 }
@@ -613,7 +613,7 @@ GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, I
     if(count <= 0)
         return InvalidParameter;
 
-    pointsF = GdipAlloc(sizeof(GpPointF) * count);
+    pointsF = heap_alloc_zero(sizeof(GpPointF) * count);
     if(!pointsF)    return OutOfMemory;
 
     for(i = 0;i < count; i++){
@@ -623,7 +623,7 @@ GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, I
 
     stat = GdipAddPathLine2(path, pointsF, count);
 
-    GdipFree(pointsF);
+    heap_free(pointsF);
 
     return stat;
 }
@@ -724,7 +724,7 @@ GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REA
     if(count == 0)
         return Ok;
 
-    ptf = GdipAlloc(sizeof(GpPointF)*count);
+    ptf = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!ptf)
         return OutOfMemory;
 
@@ -732,12 +732,12 @@ GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REA
 
     status = GdipAddPathLine(path, x + width/2, y + height/2, ptf[0].X, ptf[0].Y);
     if(status != Ok){
-        GdipFree(ptf);
+        heap_free(ptf);
         return status;
     }
     /* one spline is already added as a line endpoint */
     if(!lengthen_path(path, count - 1)){
-        GdipFree(ptf);
+        heap_free(ptf);
         return OutOfMemory;
     }
 
@@ -749,7 +749,7 @@ GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REA
 
     GdipClosePathFigure(path);
 
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return status;
 }
@@ -800,7 +800,7 @@ GpStatus WINGDIPAPI GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points,
     if(!points || count < 3)
         return InvalidParameter;
 
-    ptf = GdipAlloc(sizeof(GpPointF) * count);
+    ptf = heap_alloc_zero(sizeof(GpPointF) * count);
     if(!ptf)
         return OutOfMemory;
 
@@ -811,7 +811,7 @@ GpStatus WINGDIPAPI GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points,
 
     status = GdipAddPathPolygon(path, ptf, count);
 
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return status;
 }
@@ -863,7 +863,7 @@ static GpStatus format_string_callback(HDC dc,
             status = GenericError;
             break;
         }
-        origph = ph = GdipAlloc(len);
+        origph = ph = heap_alloc_zero(len);
         start = (char *)ph;
         if (!ph || !lengthen_path(path, len / sizeof(POINTFX)))
         {
@@ -917,7 +917,7 @@ static GpStatus format_string_callback(HDC dc,
         x += gm.gmCellIncX * args->scale;
         y += gm.gmCellIncY * args->scale;
 
-        GdipFree(origph);
+        heap_free(origph);
         if (status != Ok)
             break;
     }
@@ -1003,10 +1003,10 @@ GpStatus WINGDIPAPI GdipAddPathString(GpPath* path, GDIPCONST WCHAR* string, INT
 
     if (status != Ok) /* free backup */
     {
-        GdipFree(path->pathdata.Points);
-        GdipFree(path->pathdata.Types);
+        heap_free(path->pathdata.Points);
+        heap_free(path->pathdata.Types);
         *path = *backup;
-        GdipFree(backup);
+        heap_free(backup);
         return status;
     }
     if (format && format->vertalign == StringAlignmentCenter && layoutRect->Y + args.maxY < layoutRect->Height)
@@ -1046,17 +1046,17 @@ GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone)
     if(!path || !clone)
         return InvalidParameter;
 
-    *clone = GdipAlloc(sizeof(GpPath));
+    *clone = heap_alloc_zero(sizeof(GpPath));
     if(!*clone) return OutOfMemory;
 
     **clone = *path;
 
-    (*clone)->pathdata.Points = GdipAlloc(path->datalen * sizeof(PointF));
-    (*clone)->pathdata.Types = GdipAlloc(path->datalen);
+    (*clone)->pathdata.Points = heap_alloc_zero(path->datalen * sizeof(PointF));
+    (*clone)->pathdata.Types = heap_alloc_zero(path->datalen);
     if(!(*clone)->pathdata.Points || !(*clone)->pathdata.Types){
-        GdipFree((*clone)->pathdata.Points);
-        GdipFree((*clone)->pathdata.Types);
-        GdipFree(*clone);
+        heap_free((*clone)->pathdata.Points);
+        heap_free((*clone)->pathdata.Types);
+        heap_free(*clone);
         return OutOfMemory;
     }
 
@@ -1108,7 +1108,7 @@ GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
     if(!path)
         return InvalidParameter;
 
-    *path = GdipAlloc(sizeof(GpPath));
+    *path = heap_alloc_zero(sizeof(GpPath));
     if(!*path)  return OutOfMemory;
 
     (*path)->fill = fill;
@@ -1125,16 +1125,16 @@ GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF* points,
     if(!path)
         return InvalidParameter;
 
-    *path = GdipAlloc(sizeof(GpPath));
+    *path = heap_alloc_zero(sizeof(GpPath));
     if(!*path)  return OutOfMemory;
 
-    (*path)->pathdata.Points = GdipAlloc(count * sizeof(PointF));
-    (*path)->pathdata.Types = GdipAlloc(count);
+    (*path)->pathdata.Points = heap_alloc_zero(count * sizeof(PointF));
+    (*path)->pathdata.Types = heap_alloc_zero(count);
 
     if(!(*path)->pathdata.Points || !(*path)->pathdata.Types){
-        GdipFree((*path)->pathdata.Points);
-        GdipFree((*path)->pathdata.Types);
-        GdipFree(*path);
+        heap_free((*path)->pathdata.Points);
+        heap_free((*path)->pathdata.Types);
+        heap_free(*path);
         return OutOfMemory;
     }
 
@@ -1158,7 +1158,7 @@ GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint* points,
 
     TRACE("(%p, %p, %d, %d, %p)\n", points, types, count, fill, path);
 
-    ptF = GdipAlloc(sizeof(GpPointF)*count);
+    ptF = heap_alloc_zero(sizeof(GpPointF)*count);
 
     for(i = 0;i < count; i++){
         ptF[i].X = (REAL)points[i].X;
@@ -1167,7 +1167,7 @@ GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint* points,
 
     ret = GdipCreatePath2(ptF, types, count, fill, path);
 
-    GdipFree(ptF);
+    heap_free(ptF);
 
     return ret;
 }
@@ -1179,9 +1179,9 @@ GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
     if(!path)
         return InvalidParameter;
 
-    GdipFree(path->pathdata.Points);
-    GdipFree(path->pathdata.Types);
-    GdipFree(path);
+    heap_free(path->pathdata.Points);
+    heap_free(path->pathdata.Types);
+    heap_free(path);
 
     return Ok;
 }
@@ -1354,7 +1354,7 @@ GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath *path, GpPoint* points, INT count)
     if(count <= 0)
         return InvalidParameter;
 
-    ptf = GdipAlloc(sizeof(GpPointF)*count);
+    ptf = heap_alloc_zero(sizeof(GpPointF)*count);
     if(!ptf)    return OutOfMemory;
 
     ret = GdipGetPathPoints(path,ptf,count);
@@ -1363,7 +1363,7 @@ GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath *path, GpPoint* points, INT count)
             points[i].X = gdip_round(ptf[i].X);
             points[i].Y = gdip_round(ptf[i].Y);
         };
-    GdipFree(ptf);
+    heap_free(ptf);
 
     return ret;
 }
@@ -1517,12 +1517,12 @@ GpStatus WINGDIPAPI GdipReversePath(GpPath* path)
 
     if(count == 0) return Ok;
 
-    revpath.Points = GdipAlloc(sizeof(GpPointF)*count);
-    revpath.Types  = GdipAlloc(sizeof(BYTE)*count);
+    revpath.Points = heap_alloc_zero(sizeof(GpPointF)*count);
+    revpath.Types  = heap_alloc_zero(sizeof(BYTE)*count);
     revpath.Count  = count;
     if(!revpath.Points || !revpath.Types){
-        GdipFree(revpath.Points);
-        GdipFree(revpath.Types);
+        heap_free(revpath.Points);
+        heap_free(revpath.Types);
         return OutOfMemory;
     }
 
@@ -1552,8 +1552,8 @@ GpStatus WINGDIPAPI GdipReversePath(GpPath* path)
     memcpy(path->pathdata.Points, revpath.Points, sizeof(GpPointF)*count);
     memcpy(path->pathdata.Types,  revpath.Types,  sizeof(BYTE)*count);
 
-    GdipFree(revpath.Points);
-    GdipFree(revpath.Types);
+    heap_free(revpath.Points);
+    heap_free(revpath.Types);
 
     return Ok;
 }
@@ -1957,7 +1957,7 @@ static void widen_dashed_figure(GpPath *path, GpPen *pen, int start, int end,
         break;
     }
 
-    tmp_points = GdipAlloc((end - start + 2) * sizeof(GpPoint));
+    tmp_points = heap_alloc_zero((end - start + 2) * sizeof(GpPoint));
     if (!tmp_points) return; /* FIXME */
 
     if (!closed)
@@ -2037,7 +2037,7 @@ static void widen_dashed_figure(GpPath *path, GpPen *pen, int start, int end,
             closed ? LineCapFlat : pen->endcap, pen->customend, last_point);
     }
 
-    GdipFree(tmp_points);
+    heap_free(tmp_points);
 }
 
 GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
@@ -2175,10 +2175,10 @@ GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y,
 
 fail:
     /* reverting */
-    GdipFree(path->pathdata.Points);
-    GdipFree(path->pathdata.Types);
+    heap_free(path->pathdata.Points);
+    heap_free(path->pathdata.Types);
     memcpy(path, backup, sizeof(*path));
-    GdipFree(backup);
+    heap_free(backup);
 
     return retstat;
 }
@@ -2221,10 +2221,10 @@ GpStatus WINGDIPAPI GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects
 
 fail:
     /* reverting */
-    GdipFree(path->pathdata.Points);
-    GdipFree(path->pathdata.Types);
+    heap_free(path->pathdata.Points);
+    heap_free(path->pathdata.Types);
     memcpy(path, backup, sizeof(*path));
-    GdipFree(backup);
+    heap_free(backup);
 
     return retstat;
 }
@@ -2243,7 +2243,7 @@ GpStatus WINGDIPAPI GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects
     if(count < 0)
         return OutOfMemory;
 
-    rectsF = GdipAlloc(sizeof(GpRectF)*count);
+    rectsF = heap_alloc_zero(sizeof(GpRectF)*count);
 
     for(i = 0;i < count;i++){
         rectsF[i].X      = (REAL)rects[i].X;
@@ -2253,7 +2253,7 @@ GpStatus WINGDIPAPI GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects
     }
 
     retstat = GdipAddPathRectangles(path, rectsF, count);
-    GdipFree(rectsF);
+    heap_free(rectsF);
 
     return retstat;
 }
index c2ee585..7d6849d 100644 (file)
@@ -75,7 +75,7 @@ static ColorPalette *get_palette(IWICBitmapFrameDecode *frame, WICBitmapPaletteT
             UINT count;
 
             IWICPalette_GetColorCount(wic_palette, &count);
-            palette = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(UINT) + count * sizeof(ARGB));
+            palette = heap_alloc(2 * sizeof(UINT) + count * sizeof(ARGB));
             IWICPalette_GetColors(wic_palette, count, palette->Entries, &palette->Count);
 
             IWICPalette_GetType(wic_palette, &type);
@@ -135,15 +135,6 @@ static INT ipicture_pixel_width(IPicture *pic)
     return x;
 }
 
-#ifndef __REACTOS__
-GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect)
-{
-    FIXME("(%s, %p): stub\n", debugstr_guid(&guid), effect);
-    *effect = NULL;
-    return NotImplemented;
-}
-#endif
-
 GpStatus WINGDIPAPI GdipBitmapApplyEffect(GpBitmap* bitmap, CGpEffect* effect,
     RECT* roi, BOOL useAuxData, VOID** auxData, INT* auxDataSize)
 {
@@ -1120,7 +1111,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
     {
         lockeddata->Stride = (((act_rect.Width * bitspp + 7) / 8) + 3) & ~3;
 
-        bitmap->bitmapbits = GdipAlloc(lockeddata->Stride * act_rect.Height);
+        bitmap->bitmapbits = heap_alloc_zero(lockeddata->Stride * act_rect.Height);
 
         if (!bitmap->bitmapbits) return OutOfMemory;
 
@@ -1145,7 +1136,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
 
         if (stat != Ok)
         {
-            GdipFree(bitmap->bitmapbits);
+            heap_free(bitmap->bitmapbits);
             bitmap->bitmapbits = NULL;
             return stat;
         }
@@ -1190,7 +1181,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
         if(!(--bitmap->numlocks))
             bitmap->lockmode = 0;
 
-        GdipFree(bitmap->bitmapbits);
+        heap_free(bitmap->bitmapbits);
         bitmap->bitmapbits = NULL;
         return Ok;
     }
@@ -1220,7 +1211,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
         ERR("failed to convert pixels; this should never happen\n");
     }
 
-    GdipFree(bitmap->bitmapbits);
+    heap_free(bitmap->bitmapbits);
     bitmap->bitmapbits = NULL;
     bitmap->lockmode = 0;
     bitmap->numlocks = 0;
@@ -1266,7 +1257,7 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height,
 
             src_palette = srcBitmap->image.palette;
 
-            dst_palette = GdipAlloc(sizeof(UINT) * 2 + sizeof(ARGB) * src_palette->Count);
+            dst_palette = heap_alloc_zero(sizeof(UINT) * 2 + sizeof(ARGB) * src_palette->Count);
 
             if (dst_palette)
             {
@@ -1274,7 +1265,7 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height,
                 dst_palette->Count = src_palette->Count;
                 memcpy(dst_palette->Entries, src_palette->Entries, sizeof(ARGB) * src_palette->Count);
 
-                GdipFree((*dstBitmap)->image.palette);
+                heap_free((*dstBitmap)->image.palette);
                 (*dstBitmap)->image.palette = dst_palette;
             }
             else
@@ -1352,7 +1343,7 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
 
         metafile = (GpMetafile*)image;
 
-        result = GdipAlloc(sizeof(*result));
+        result = heap_alloc_zero(sizeof(*result));
         if (!result)
             return OutOfMemory;
 
@@ -1369,7 +1360,7 @@ GpStatus WINGDIPAPI GdipCloneImage(GpImage *image, GpImage **cloneImage)
 
         if (!result->hemf)
         {
-            GdipFree(result);
+            heap_free(result);
             return OutOfMemory;
         }
 
@@ -1684,7 +1675,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
     {
         if (iinfo.hbmMask)
         {
-            BYTE *bits = HeapAlloc(GetProcessHeap(), 0, height * stride);
+            BYTE *bits = heap_alloc(height * stride);
 
             /* read alpha data from the mask */
             if (iinfo.hbmColor)
@@ -1708,7 +1699,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
                 dst_row += lockeddata.Stride;
             }
 
-            HeapFree(GetProcessHeap(), 0, bits);
+            heap_free(bits);
         }
         else
         {
@@ -1849,7 +1840,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
         {
             INT size = abs(stride) * height;
 
-            own_bits = bits = GdipAlloc(size);
+            own_bits = bits = heap_alloc_zero(size);
             if (!own_bits) return OutOfMemory;
 
             if (stride < 0)
@@ -1857,11 +1848,11 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
         }
     }
 
-    *bitmap = GdipAlloc(sizeof(GpBitmap));
+    *bitmap = heap_alloc_zero(sizeof(GpBitmap));
     if(!*bitmap)
     {
         DeleteObject(hbitmap);
-        GdipFree(own_bits);
+        heap_free(own_bits);
         return OutOfMemory;
     }
 
@@ -1895,7 +1886,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride,
         format == PixelFormat4bppIndexed ||
         format == PixelFormat8bppIndexed)
     {
-        (*bitmap)->image.palette = GdipAlloc(sizeof(UINT) * 2 + sizeof(ARGB) * (1 << PIXELFORMATBPP(format)));
+        (*bitmap)->image.palette = heap_alloc_zero(sizeof(UINT) * 2 + sizeof(ARGB) * (1 << PIXELFORMATBPP(format)));
 
         if (!(*bitmap)->image.palette)
         {
@@ -1967,13 +1958,13 @@ GpStatus WINGDIPAPI GdipCreateCachedBitmap(GpBitmap *bitmap, GpGraphics *graphic
     if(!bitmap || !graphics || !cachedbmp)
         return InvalidParameter;
 
-    *cachedbmp = GdipAlloc(sizeof(GpCachedBitmap));
+    *cachedbmp = heap_alloc_zero(sizeof(GpCachedBitmap));
     if(!*cachedbmp)
         return OutOfMemory;
 
     stat = GdipCloneImage(&(bitmap->image), &(*cachedbmp)->image);
     if(stat != Ok){
-        GdipFree(*cachedbmp);
+        heap_free(*cachedbmp);
         return stat;
     }
 
@@ -2001,7 +1992,7 @@ GpStatus WINGDIPAPI GdipCreateHICONFromBitmap(GpBitmap *bitmap, HICON *hicon)
         xorstride = lockeddata.Width*4;
         bitssize = (andstride + xorstride) * lockeddata.Height;
 
-        andbits = GdipAlloc(bitssize);
+        andbits = heap_alloc_zero(bitssize);
 
         if (andbits)
         {
@@ -2023,7 +2014,7 @@ GpStatus WINGDIPAPI GdipCreateHICONFromBitmap(GpBitmap *bitmap, HICON *hicon)
             *hicon = CreateIcon(NULL, lockeddata.Width, lockeddata.Height, 1, 32,
                 andbits, xorbits);
 
-            GdipFree(andbits);
+            heap_free(andbits);
         }
         else
             stat = OutOfMemory;
@@ -2042,7 +2033,7 @@ GpStatus WINGDIPAPI GdipDeleteCachedBitmap(GpCachedBitmap *cachedbmp)
         return InvalidParameter;
 
     GdipDisposeImage(cachedbmp->image);
-    GdipFree(cachedbmp);
+    heap_free(cachedbmp);
 
     return Ok;
 }
@@ -2065,18 +2056,18 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
     assert(src->image.type == ImageTypeBitmap);
     assert(dst->image.type == ImageTypeBitmap);
 
-    GdipFree(dst->bitmapbits);
-    GdipFree(dst->own_bits);
+    heap_free(dst->bitmapbits);
+    heap_free(dst->own_bits);
     DeleteDC(dst->hdc);
     DeleteObject(dst->hbitmap);
 
     if (clobber_palette)
     {
-        GdipFree(dst->image.palette);
+        heap_free(dst->image.palette);
         dst->image.palette = src->image.palette;
     }
     else
-        GdipFree(src->image.palette);
+        heap_free(src->image.palette);
 
     dst->image.xres = src->image.xres;
     dst->image.yres = src->image.yres;
@@ -2091,7 +2082,7 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
     if (dst->metadata_reader)
         IWICMetadataReader_Release(dst->metadata_reader);
     dst->metadata_reader = src->metadata_reader;
-    GdipFree(dst->prop_item);
+    heap_free(dst->prop_item);
     dst->prop_item = src->prop_item;
     dst->prop_count = src->prop_count;
     if (dst->image.decoder)
@@ -2102,7 +2093,7 @@ static void move_bitmap(GpBitmap *dst, GpBitmap *src, BOOL clobber_palette)
     dst->image.format = src->image.format;
 
     src->image.type = ~0;
-    GdipFree(src);
+    heap_free(src);
 }
 
 static GpStatus free_image_data(GpImage *image)
@@ -2112,18 +2103,18 @@ static GpStatus free_image_data(GpImage *image)
 
     if (image->type == ImageTypeBitmap)
     {
-        GdipFree(((GpBitmap*)image)->bitmapbits);
-        GdipFree(((GpBitmap*)image)->own_bits);
+        heap_free(((GpBitmap*)image)->bitmapbits);
+        heap_free(((GpBitmap*)image)->own_bits);
         DeleteDC(((GpBitmap*)image)->hdc);
         DeleteObject(((GpBitmap*)image)->hbitmap);
         if (((GpBitmap*)image)->metadata_reader)
             IWICMetadataReader_Release(((GpBitmap*)image)->metadata_reader);
-        GdipFree(((GpBitmap*)image)->prop_item);
+        heap_free(((GpBitmap*)image)->prop_item);
     }
     else if (image->type == ImageTypeMetafile)
     {
         GpMetafile *metafile = (GpMetafile*)image;
-        GdipFree(metafile->comment_data);
+        heap_free(metafile->comment_data);
         DeleteEnhMetaFile(CloseEnhMetaFile(metafile->record_dc));
         if (!metafile->preserve_hemf)
             DeleteEnhMetaFile(metafile->hemf);
@@ -2144,7 +2135,7 @@ static GpStatus free_image_data(GpImage *image)
         IPicture_Release(image->picture);
     if (image->decoder)
         IWICBitmapDecoder_Release(image->decoder);
-    GdipFree(image->palette);
+    heap_free(image->palette);
 
     return Ok;
 }
@@ -2158,7 +2149,7 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
     status = free_image_data(image);
     if (status != Ok) return status;
     image->type = ~0;
-    GdipFree(image);
+    heap_free(image);
 
     return Ok;
 }
@@ -2866,7 +2857,7 @@ GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT size,
         item_size = propvariant_size(&value);
         if (item_size)
         {
-            item = HeapAlloc(GetProcessHeap(), 0, item_size + sizeof(*item));
+            item = heap_alloc(item_size + sizeof(*item));
 
             propvariant_to_item(&value, item, item_size + sizeof(*item), id.u.uiVal);
             buf[i].id = item->id;
@@ -2876,7 +2867,7 @@ GpStatus WINGDIPAPI GdipGetAllPropertyItems(GpImage *image, UINT size,
             memcpy(item_value, item->value, item_size);
             item_value += item_size;
 
-            HeapFree(GetProcessHeap(), 0, item);
+            heap_free(item);
         }
 
         PropVariantClear(&id);
@@ -3007,7 +2998,7 @@ static void add_property(GpBitmap *bitmap, PropertyItem *item)
     if (bitmap->prop_item == NULL)
     {
         prop_size = prop_count = 0;
-        prop_item = GdipAlloc(item->length + sizeof(PropertyItem));
+        prop_item = heap_alloc_zero(item->length + sizeof(PropertyItem));
         if (!prop_item) return;
     }
     else
@@ -3017,7 +3008,7 @@ static void add_property(GpBitmap *bitmap, PropertyItem *item)
 
         GdipGetPropertySize((GpImage *)bitmap, &prop_size, &prop_count);
 
-        prop_item = GdipAlloc(prop_size + item->length + sizeof(PropertyItem));
+        prop_item = heap_alloc_zero(prop_size + item->length + sizeof(PropertyItem));
         if (!prop_item) return;
         memcpy(prop_item, bitmap->prop_item, sizeof(PropertyItem) * bitmap->prop_count);
         prop_size -= sizeof(PropertyItem) * bitmap->prop_count;
@@ -3038,7 +3029,7 @@ static void add_property(GpBitmap *bitmap, PropertyItem *item)
     prop_item[prop_count].value = (char *)(prop_item + prop_count + 1) + prop_size;
     memcpy(prop_item[prop_count].value, item->value, item->length);
 
-    GdipFree(bitmap->prop_item);
+    heap_free(bitmap->prop_item);
     bitmap->prop_item = prop_item;
     bitmap->prop_count++;
 }
@@ -3057,7 +3048,7 @@ static BOOL get_bool_property(IWICMetadataReader *reader, const GUID *guid, cons
     PropVariantInit(&value);
 
     id.vt = VT_LPWSTR;
-    id.u.pwszVal = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(prop_name) + 1) * sizeof(WCHAR));
+    id.u.pwszVal = CoTaskMemAlloc((lstrlenW(prop_name) + 1) * sizeof(WCHAR));
     if (!id.u.pwszVal) return FALSE;
     lstrcpyW(id.u.pwszVal, prop_name);
     hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
@@ -3084,7 +3075,7 @@ static PropertyItem *get_property(IWICMetadataReader *reader, const GUID *guid,
     PropVariantInit(&value);
 
     id.vt = VT_LPWSTR;
-    id.u.pwszVal = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(prop_name) + 1) * sizeof(WCHAR));
+    id.u.pwszVal = CoTaskMemAlloc((lstrlenW(prop_name) + 1) * sizeof(WCHAR));
     if (!id.u.pwszVal) return NULL;
     lstrcpyW(id.u.pwszVal, prop_name);
     hr = IWICMetadataReader_GetValue(reader, NULL, &id, &value);
@@ -3094,10 +3085,10 @@ static PropertyItem *get_property(IWICMetadataReader *reader, const GUID *guid,
         if (item_size)
         {
             item_size += sizeof(*item);
-            item = GdipAlloc(item_size);
+            item = heap_alloc_zero(item_size);
             if (propvariant_to_item(&value, item, item_size, 0) != Ok)
             {
-                GdipFree(item);
+                heap_free(item);
                 item = NULL;
             }
         }
@@ -3141,7 +3132,7 @@ static PropertyItem *get_gif_loopcount(IWICMetadataReader *reader)
                     BYTE *data = appdata->value;
                     if (data[0] == 3 && data[1] == 1)
                     {
-                        loop = GdipAlloc(sizeof(*loop) + sizeof(SHORT));
+                        loop = heap_alloc_zero(sizeof(*loop) + sizeof(SHORT));
                         if (loop)
                         {
                             loop->type = PropertyTagTypeShort;
@@ -3156,8 +3147,8 @@ static PropertyItem *get_gif_loopcount(IWICMetadataReader *reader)
         }
     }
 
-    GdipFree(appext);
-    GdipFree(appdata);
+    heap_free(appext);
+    heap_free(appdata);
 
     return loop;
 }
@@ -3207,7 +3198,7 @@ static PropertyItem *get_gif_palette(IWICBitmapDecoder *decoder, IWICMetadataRea
         UINT i;
         BYTE *rgb;
 
-        pal = GdipAlloc(sizeof(*pal) + count * 3);
+        pal = heap_alloc_zero(sizeof(*pal) + count * 3);
         if (!pal) return NULL;
         pal->type = PropertyTagTypeByte;
         pal->id = PropertyTagGlobalPalette;
@@ -3272,7 +3263,7 @@ static LONG get_gif_frame_property(IWICBitmapFrameDecode *frame, const GUID *for
                         else if (prop->type == PropertyTagTypeShort && prop->length == 2)
                             value = *(SHORT *)prop->value;
 
-                        GdipFree(prop);
+                        heap_free(prop);
                     }
                     IWICMetadataReader_Release(reader);
                 }
@@ -3298,7 +3289,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
     IWICBitmapDecoder_GetFrameCount(decoder, &frame_count);
     if (frame_count > 1)
     {
-        delay = GdipAlloc(sizeof(*delay) + frame_count * sizeof(LONG));
+        delay = heap_alloc_zero(sizeof(*delay) + frame_count * sizeof(LONG));
         if (delay)
         {
             LONG *value;
@@ -3355,7 +3346,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
 
     if (frame_count > 1 && !loop)
     {
-        loop = GdipAlloc(sizeof(*loop) + sizeof(SHORT));
+        loop = heap_alloc_zero(sizeof(*loop) + sizeof(SHORT));
         if (loop)
         {
             loop->type = PropertyTagTypeShort;
@@ -3372,11 +3363,11 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
     if (palette) add_property(bitmap, palette);
     if (background) add_property(bitmap, background);
 
-    GdipFree(delay);
-    GdipFree(comment);
-    GdipFree(loop);
-    GdipFree(palette);
-    GdipFree(background);
+    heap_free(delay);
+    heap_free(comment);
+    heap_free(loop);
+    heap_free(palette);
+    heap_free(background);
 
     /* Win7 gdiplus always returns transparent color index from frame 0 */
     hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame);
@@ -3404,7 +3395,7 @@ static void gif_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
     }
 
     if (transparent_idx) add_property(bitmap, transparent_idx);
-    GdipFree(transparent_idx);
+    heap_free(transparent_idx);
 
     IWICBitmapFrameDecode_Release(frame);
 }
@@ -3417,10 +3408,10 @@ static PropertyItem* create_prop(PROPID propid, PROPVARIANT* value)
     if (item_size)
     {
         item_size += sizeof(*item);
-        item = GdipAlloc(item_size);
+        item = heap_alloc_zero(item_size);
         if (propvariant_to_item(value, item, item_size, propid) != Ok)
         {
-            GdipFree(item);
+            heap_free(item);
             item = NULL;
         }
     }
@@ -3510,7 +3501,7 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
                                     item = create_prop(keywords[j].propid, &value);
                                     if (item)
                                         add_property(bitmap, item);
-                                    GdipFree(item);
+                                    heap_free(item);
                                 }
                             }
 
@@ -3524,7 +3515,7 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
 
                         if (!seen_gamma)
                         {
-                            item = GdipAlloc(sizeof(PropertyItem) + sizeof(ULONG) * 2);
+                            item = heap_alloc_zero(sizeof(PropertyItem) + sizeof(ULONG) * 2);
                             if (item)
                             {
                                 ULONG *rational;
@@ -3536,7 +3527,7 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
                                 rational[1] = get_ulong_by_index(reader, 0);
                                 add_property(bitmap, item);
                                 seen_gamma = TRUE;
-                                GdipFree(item);
+                                heap_free(item);
                             }
                         }
                     }
@@ -3704,7 +3695,7 @@ static GpStatus decode_frame_wic(IWICBitmapDecoder *decoder, BOOL force_conversi
         IWICBitmapDecoder_AddRef(decoder);
         if (palette)
         {
-            GdipFree(bitmap->image.palette);
+            heap_free(bitmap->image.palette);
             bitmap->image.palette = palette;
         }
         else
@@ -3749,7 +3740,7 @@ static GpStatus select_frame_wic(GpImage *image, UINT active_frame)
     else if (image->type == ImageTypeMetafile)
         *(GpMetafile *)image = *(GpMetafile *)new_image;
     new_image->type = ~0;
-    GdipFree(new_image);
+    heap_free(new_image);
     return Ok;
 }
 
@@ -3780,14 +3771,14 @@ static HRESULT blit_gif_frame(GpBitmap *bitmap, IWICBitmapFrameDecode *frame, BO
     if(FAILED(hr))
         return hr;
 
-    new_bits = GdipAlloc(width*height*4);
+    new_bits = heap_alloc_zero(width*height*4);
     if(!new_bits)
         return E_OUTOFMEMORY;
 
     hr = IWICBitmapSource_CopyPixels(source, NULL, width*4, width*height*4, new_bits);
     IWICBitmapSource_Release(source);
     if(FAILED(hr)) {
-        GdipFree(new_bits);
+        heap_free(new_bits);
         return hr;
     }
 
@@ -3800,7 +3791,7 @@ static HRESULT blit_gif_frame(GpBitmap *bitmap, IWICBitmapFrameDecode *frame, BO
                 *dst = *src;
         }
     }
-    GdipFree(new_bits);
+    heap_free(new_bits);
     return hr;
 }
 
@@ -3830,7 +3821,7 @@ static DWORD get_gif_background_color(GpBitmap *bitmap)
         if(bitmap->prop_item[i].id == PropertyTagGlobalPalette) {
             if(bitmap->prop_item[i].length/3 > bgcolor_idx) {
                 BYTE *color = ((BYTE*)bitmap->prop_item[i].value)+bgcolor_idx*3;
-                return color[2] + (color[1]<<8) + (color[0]<<16) + (0xff<<24);
+                return color[2] + (color[1]<<8) + (color[0]<<16) + (0xffu<<24);
             }
             break;
         }
@@ -3963,7 +3954,7 @@ static GpStatus decode_image_gif(IStream* stream, GpImage **image)
         return status;
 
     if(frame_count > 1) {
-        GdipFree((*image)->palette);
+        heap_free((*image)->palette);
         (*image)->palette = NULL;
     }
     return Ok;
@@ -3990,7 +3981,7 @@ static GpStatus decode_image_olepicture_metafile(IStream* stream, GpImage **imag
     }
 
     /* FIXME: missing initialization code */
-    *image = GdipAlloc(sizeof(GpMetafile));
+    *image = heap_alloc_zero(sizeof(GpMetafile));
     if(!*image) return OutOfMemory;
     (*image)->type = ImageTypeMetafile;
     (*image)->decoder = NULL;
@@ -4485,10 +4476,10 @@ GpStatus WINGDIPAPI GdipSetImagePalette(GpImage *image,
     if(!image || !palette || palette->Count > 256)
         return InvalidParameter;
 
-    new_palette = GdipAlloc(2 * sizeof(UINT) + palette->Count * sizeof(ARGB));
+    new_palette = heap_alloc_zero(2 * sizeof(UINT) + palette->Count * sizeof(ARGB));
     if (!new_palette) return OutOfMemory;
 
-    GdipFree(image->palette);
+    heap_free(image->palette);
     image->palette = new_palette;
     image->palette->Flags = palette->Flags;
     image->palette->Count = palette->Count;
@@ -4969,7 +4960,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
             if (!num_palette_entries)
                 retval = GenericError;
 
-            palette = GdipAlloc(sizeof(ColorPalette) + sizeof(ARGB) * (num_palette_entries-1));
+            palette = heap_alloc_zero(sizeof(ColorPalette) + sizeof(ARGB) * (num_palette_entries-1));
             if (!palette)
                 retval = OutOfMemory;
 
@@ -4987,7 +4978,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
                 retval = GdipSetImagePalette((GpImage*)*bitmap, palette);
             }
 
-            GdipFree(palette);
+            heap_free(palette);
         }
 
         if (retval != Ok)
@@ -5000,6 +4991,24 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi
     return retval;
 }
 
+/*****************************************************************************
+ * GdipCreateEffect [GDIPLUS.@]
+ */
+GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect)
+{
+    FIXME("(%s, %p): stub\n", debugstr_guid(&guid), effect);
+
+    if(!effect)
+        return InvalidParameter;
+
+    *effect = NULL;
+
+    return NotImplemented;
+}
+
+/*****************************************************************************
+ * GdipDeleteEffect [GDIPLUS.@]
+ */
 GpStatus WINGDIPAPI GdipDeleteEffect(CGpEffect *effect)
 {
     FIXME("(%p): stub\n", effect);
@@ -5242,3 +5251,13 @@ GpStatus WINGDIPAPI GdipImageSetAbort(GpImage *image, GdiplusAbort *pabort)
     FIXME("(%p, %p): stub\n", image, pabort);
     return NotImplemented;
 }
+
+/*****************************************************************************
+ * GdipBitmapConvertFormat [GDIPLUS.@]
+ */
+GpStatus WINGDIPAPI GdipBitmapConvertFormat(GpBitmap *bitmap, PixelFormat format, DitherType dithertype,
+    PaletteType palettetype, ColorPalette *palette, REAL alphathreshold)
+{
+    FIXME("(%p, 0x%08x, %d, %d, %p, %f): stub\n", bitmap, format, dithertype, palettetype, palette, alphathreshold);
+    return NotImplemented;
+}
index 700c7bb..4c9972f 100644 (file)
@@ -41,7 +41,7 @@ GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
     if(!imageattr)
         return InvalidParameter;
 
-    *imageattr = GdipAlloc(sizeof(GpImageAttributes));
+    *imageattr = heap_alloc_zero(sizeof(GpImageAttributes));
     if(!*imageattr)    return OutOfMemory;
 
     (*imageattr)->wrap = WrapModeClamp;
@@ -61,9 +61,9 @@ GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
         return InvalidParameter;
 
     for (i=0; i<ColorAdjustTypeCount; i++)
-        GdipFree(imageattr->colorremaptables[i].colormap);
+        heap_free(imageattr->colorremaptables[i].colormap);
 
-    GdipFree(imageattr);
+    heap_free(imageattr);
 
     return Ok;
 }
@@ -213,21 +213,21 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt
         if(!map || !mapSize)
            return InvalidParameter;
 
-        new_map = GdipAlloc(sizeof(*map) * mapSize);
+        new_map = heap_alloc_zero(sizeof(*map) * mapSize);
 
         if (!new_map)
             return OutOfMemory;
 
         memcpy(new_map, map, sizeof(*map) * mapSize);
 
-        GdipFree(imageAttr->colorremaptables[type].colormap);
+        heap_free(imageAttr->colorremaptables[type].colormap);
 
         imageAttr->colorremaptables[type].mapsize = mapSize;
         imageAttr->colorremaptables[type].colormap = new_map;
     }
     else
     {
-        GdipFree(imageAttr->colorremaptables[type].colormap);
+        heap_free(imageAttr->colorremaptables[type].colormap);
         imageAttr->colorremaptables[type].colormap = NULL;
     }
 
index 469e809..0945e43 100644 (file)
@@ -53,7 +53,7 @@ GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22,
     if(!matrix)
         return InvalidParameter;
 
-    *matrix = GdipAlloc(sizeof(GpMatrix));
+    *matrix = heap_alloc_zero(sizeof(GpMatrix));
     if(!*matrix)    return OutOfMemory;
 
     /* first row */
@@ -116,7 +116,7 @@ GpStatus WINGDIPAPI GdipCloneMatrix(GpMatrix *matrix, GpMatrix **clone)
     if(!matrix || !clone)
         return InvalidParameter;
 
-    *clone = GdipAlloc(sizeof(GpMatrix));
+    *clone = heap_alloc_zero(sizeof(GpMatrix));
     if(!*clone)    return OutOfMemory;
 
     **clone = *matrix;
@@ -131,7 +131,7 @@ GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
     if(!matrix)
         return InvalidParameter;
 
-    *matrix = GdipAlloc(sizeof(GpMatrix));
+    *matrix = heap_alloc_zero(sizeof(GpMatrix));
     if(!*matrix)    return OutOfMemory;
 
     (*matrix)->matrix[0] = 1.0;
@@ -151,7 +151,7 @@ GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
     if(!matrix)
         return InvalidParameter;
 
-    GdipFree(matrix);
+    heap_free(matrix);
 
     return Ok;
 }
@@ -367,7 +367,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
     if(count <= 0)
         return InvalidParameter;
 
-    ptsF = GdipAlloc(sizeof(GpPointF) * count);
+    ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
     if(!ptsF)
         return OutOfMemory;
 
@@ -383,7 +383,7 @@ GpStatus WINGDIPAPI GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, I
             pts[i].X = gdip_round(ptsF[i].X);
             pts[i].Y = gdip_round(ptsF[i].Y);
         }
-    GdipFree(ptsF);
+    heap_free(ptsF);
 
     return ret;
 }
@@ -448,7 +448,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
     if(count <= 0)
         return InvalidParameter;
 
-    ptsF = GdipAlloc(sizeof(GpPointF) * count);
+    ptsF = heap_alloc_zero(sizeof(GpPointF) * count);
     if(!ptsF)
         return OutOfMemory;
 
@@ -464,7 +464,7 @@ GpStatus WINGDIPAPI GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *
             pts[i].X = gdip_round(ptsF[i].X);
             pts[i].Y = gdip_round(ptsF[i].Y);
         }
-    GdipFree(ptsF);
+    heap_free(ptsF);
 
     return ret;
 }
@@ -500,7 +500,7 @@ GpStatus WINGDIPAPI GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *resul
     if(ret == Ok)
         *result = isIdentity;
 
-    GdipFree(e);
+    heap_free(e);
 
     return ret;
 }
index 4f82341..40a03e2 100644 (file)
@@ -64,7 +64,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void *
     if (!metafile->comment_data_size)
     {
         DWORD data_size = max(256, size * 2 + 4);
-        metafile->comment_data = GdipAlloc(data_size);
+        metafile->comment_data = heap_alloc_zero(data_size);
 
         if (!metafile->comment_data)
             return OutOfMemory;
@@ -80,7 +80,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void *
     if (size_needed > metafile->comment_data_size)
     {
         DWORD data_size = size_needed * 2;
-        BYTE *new_data = GdipAlloc(data_size);
+        BYTE *new_data = heap_alloc_zero(data_size);
 
         if (!new_data)
             return OutOfMemory;
@@ -88,7 +88,7 @@ static GpStatus METAFILE_AllocateRecord(GpMetafile *metafile, DWORD size, void *
         memcpy(new_data, metafile->comment_data, metafile->comment_data_length);
 
         metafile->comment_data_size = data_size;
-        GdipFree(metafile->comment_data);
+        heap_free(metafile->comment_data);
         metafile->comment_data = new_data;
     }
 
@@ -171,6 +171,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
                                        MetafileFrameUnit frameUnit, GDIPCONST WCHAR *desc, GpMetafile **metafile)
 {
     HDC record_dc;
+    REAL dpix, dpiy;
     REAL framerect_factor_x, framerect_factor_y;
     RECT rc;
     GpStatus stat;
@@ -186,11 +187,14 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
         return NotImplemented;
     }
 
+    dpix = (REAL)GetDeviceCaps(hdc, HORZRES) / GetDeviceCaps(hdc, HORZSIZE) * 25.4;
+    dpiy = (REAL)GetDeviceCaps(hdc, VERTRES) / GetDeviceCaps(hdc, VERTSIZE) * 25.4;
+
     switch (frameUnit)
     {
     case MetafileFrameUnitPixel:
-        framerect_factor_x = 2540.0 / GetDeviceCaps(hdc, LOGPIXELSX);
-        framerect_factor_y = 2540.0 / GetDeviceCaps(hdc, LOGPIXELSY);
+        framerect_factor_x = 2540.0 / dpix;
+        framerect_factor_y = 2540.0 / dpiy;
         break;
     case MetafileFrameUnitPoint:
         framerect_factor_x = framerect_factor_y = 2540.0 / 72.0;
@@ -221,7 +225,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
     if (!record_dc)
         return GenericError;
 
-    *metafile = GdipAlloc(sizeof(GpMetafile));
+    *metafile = heap_alloc_zero(sizeof(GpMetafile));
     if(!*metafile)
     {
         DeleteEnhMetaFile(CloseEnhMetaFile(record_dc));
@@ -232,8 +236,8 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
     (*metafile)->image.picture = NULL;
     (*metafile)->image.flags   = ImageFlagsNone;
     (*metafile)->image.palette = NULL;
-    (*metafile)->image.xres = 72.0;
-    (*metafile)->image.yres = 72.0;
+    (*metafile)->image.xres = dpix;
+    (*metafile)->image.yres = dpiy;
     (*metafile)->bounds = *frameRect;
     (*metafile)->unit = frameUnit;
     (*metafile)->metafile_type = type;
@@ -248,7 +252,7 @@ GpStatus WINGDIPAPI GdipRecordMetafile(HDC hdc, EmfType type, GDIPCONST GpRectF
     if (stat != Ok)
     {
         DeleteEnhMetaFile(CloseEnhMetaFile(record_dc));
-        GdipFree(*metafile);
+        heap_free(*metafile);
         *metafile = NULL;
         return OutOfMemory;
     }
@@ -441,7 +445,7 @@ GpStatus METAFILE_GraphicsDeleted(GpMetafile* metafile)
     metafile->hemf = CloseEnhMetaFile(metafile->record_dc);
     metafile->record_dc = NULL;
 
-    GdipFree(metafile->comment_data);
+    heap_free(metafile->comment_data);
     metafile->comment_data = NULL;
     metafile->comment_data_size = 0;
 
@@ -543,7 +547,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
         {
             ENHMETARECORD *record;
 
-            record = GdipAlloc(dataSize + 8);
+            record = heap_alloc_zero(dataSize + 8);
 
             if (record)
             {
@@ -554,7 +558,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
                 PlayEnhMetaFileRecord(metafile->playback_dc, metafile->handle_table,
                     record, metafile->handle_count);
 
-                GdipFree(record);
+                heap_free(record);
             }
             else
                 return OutOfMemory;
@@ -612,7 +616,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
                     EmfPlusRect *int_rects = (EmfPlusRect*)(record+1);
                     int i;
 
-                    rects = temp_rects = GdipAlloc(sizeof(GpRectF) * record->Count);
+                    rects = temp_rects = heap_alloc_zero(sizeof(GpRectF) * record->Count);
                     if (rects)
                     {
                         for (i=0; i<record->Count; i++)
@@ -636,7 +640,7 @@ GpStatus WINGDIPAPI GdipPlayMetafileRecord(GDIPCONST GpMetafile *metafile,
             }
 
             GdipDeleteBrush(temp_brush);
-            GdipFree(temp_rects);
+            heap_free(temp_rects);
 
             return stat;
         }
@@ -861,10 +865,28 @@ GpStatus WINGDIPAPI GdipEnumerateMetafileDestPointI(GpGraphics *graphics,
     return GdipEnumerateMetafileDestPoint(graphics, metafile, &ptf, callback, cb_data, attrs);
 }
 
-static int CALLBACK get_metafile_type_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR,
+GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile * metafile,
+    MetafileHeader * header)
+{
+    static int calls;
+
+    TRACE("(%p, %p)\n", metafile, header);
+
+    if(!metafile || !header)
+        return InvalidParameter;
+
+    if(!(calls++))
+        FIXME("not implemented\n");
+
+    memset(header, 0, sizeof(MetafileHeader));
+
+    return Ok;
+}
+
+static int CALLBACK get_emfplus_header_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR,
     int nObj, LPARAM lpData)
 {
-    MetafileType *result = (MetafileType*)lpData;
+    EmfPlusHeader *dst_header = (EmfPlusHeader*)lpData;
 
     if (lpEMFR->iType == EMR_GDICOMMENT)
     {
@@ -874,61 +896,74 @@ static int CALLBACK get_metafile_type_proc(HDC hDC, HANDLETABLE *lpHTable, const
         {
             const EmfPlusRecordHeader *header = (const EmfPlusRecordHeader*)&comment->Data[4];
 
-            if (4 + sizeof(EmfPlusRecordHeader) <= comment->cbData &&
+            if (4 + sizeof(EmfPlusHeader) <= comment->cbData &&
                 header->Type == EmfPlusRecordTypeHeader)
             {
-                if ((header->Flags & 1) == 1)
-                    *result = MetafileTypeEmfPlusDual;
-                else
-                    *result = MetafileTypeEmfPlusOnly;
+                memcpy(dst_header, header, sizeof(*dst_header));
             }
         }
-        else
-            *result = MetafileTypeEmf;
     }
-    else
-        *result = MetafileTypeEmf;
+    else if (lpEMFR->iType == EMR_HEADER)
+        return TRUE;
 
     return FALSE;
 }
 
-static MetafileType METAFILE_GetEmfType(HENHMETAFILE hemf)
-{
-    MetafileType result = MetafileTypeInvalid;
-    EnumEnhMetaFile(NULL, hemf, get_metafile_type_proc, &result, NULL);
-    return result;
-}
-
-GpStatus WINGDIPAPI GdipGetMetafileHeaderFromMetafile(GpMetafile * metafile,
-    MetafileHeader * header)
+GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hemf,
+    MetafileHeader *header)
 {
-    static int calls;
+    ENHMETAHEADER3 emfheader;
+    EmfPlusHeader emfplusheader;
+    MetafileType metafile_type;
 
-    TRACE("(%p, %p)\n", metafile, header);
+    TRACE("(%p,%p)\n", hemf, header);
 
-    if(!metafile || !header)
+    if(!hemf || !header)
         return InvalidParameter;
 
-    if(!(calls++))
-        FIXME("not implemented\n");
-
-    memset(header, 0, sizeof(MetafileHeader));
-
-    return Ok;
-}
-
-GpStatus WINGDIPAPI GdipGetMetafileHeaderFromEmf(HENHMETAFILE hEmf,
-    MetafileHeader *header)
-{
-    static int calls;
+    if (GetEnhMetaFileHeader(hemf, sizeof(emfheader), (ENHMETAHEADER*)&emfheader) == 0)
+        return GenericError;
 
-    if(!hEmf || !header)
-        return InvalidParameter;
+    emfplusheader.Header.Type = 0;
 
-    if(!(calls++))
-        FIXME("not implemented\n");
+    EnumEnhMetaFile(NULL, hemf, get_emfplus_header_proc, &emfplusheader, NULL);
 
-    memset(header, 0, sizeof(MetafileHeader));
+    if (emfplusheader.Header.Type == EmfPlusRecordTypeHeader)
+    {
+        if ((emfplusheader.Header.Flags & 1) == 1)
+            metafile_type = MetafileTypeEmfPlusDual;
+        else
+            metafile_type = MetafileTypeEmfPlusOnly;
+    }
+    else
+        metafile_type = MetafileTypeEmf;
+
+    header->Type = metafile_type;
+    header->Size = emfheader.nBytes;
+    header->DpiX = (REAL)emfheader.szlDevice.cx * 25.4 / emfheader.szlMillimeters.cx;
+    header->DpiY = (REAL)emfheader.szlDevice.cy * 25.4 / emfheader.szlMillimeters.cy;
+    header->X = gdip_round((REAL)emfheader.rclFrame.left / 2540.0 * header->DpiX);
+    header->Y = gdip_round((REAL)emfheader.rclFrame.top / 2540.0 * header->DpiY);
+    header->Width = gdip_round((REAL)(emfheader.rclFrame.right - emfheader.rclFrame.left) / 2540.0 * header->DpiX);
+    header->Height = gdip_round((REAL)(emfheader.rclFrame.bottom - emfheader.rclFrame.top) / 2540.0 * header->DpiY);
+    header->u.EmfHeader = emfheader;
+
+    if (metafile_type == MetafileTypeEmfPlusDual || metafile_type == MetafileTypeEmfPlusOnly)
+    {
+        header->Version = emfplusheader.Version;
+        header->EmfPlusFlags = emfplusheader.EmfPlusFlags;
+        header->EmfPlusHeaderSize = emfplusheader.Header.Size;
+        header->LogicalDpiX = emfplusheader.LogicalDpiX;
+        header->LogicalDpiY = emfplusheader.LogicalDpiY;
+    }
+    else
+    {
+        header->Version = emfheader.nVersion;
+        header->EmfPlusFlags = 0;
+        header->EmfPlusHeaderSize = 0;
+        header->LogicalDpiX = 0;
+        header->LogicalDpiY = 0;
+    }
 
     return Ok;
 }
@@ -972,37 +1007,35 @@ GpStatus WINGDIPAPI GdipGetMetafileHeaderFromStream(IStream *stream,
 GpStatus WINGDIPAPI GdipCreateMetafileFromEmf(HENHMETAFILE hemf, BOOL delete,
     GpMetafile **metafile)
 {
-    ENHMETAHEADER header;
-    MetafileType metafile_type;
+    GpStatus stat;
+    MetafileHeader header;
 
     TRACE("(%p,%i,%p)\n", hemf, delete, metafile);
 
     if(!hemf || !metafile)
         return InvalidParameter;
 
-    if (GetEnhMetaFileHeader(hemf, sizeof(header), &header) == 0)
-        return GenericError;
-
-    metafile_type = METAFILE_GetEmfType(hemf);
-
-    if (metafile_type == MetafileTypeInvalid)
-        return GenericError;
+    stat = GdipGetMetafileHeaderFromEmf(hemf, &header);
+    if (stat != Ok)
+        return stat;
 
-    *metafile = GdipAlloc(sizeof(GpMetafile));
+    *metafile = heap_alloc_zero(sizeof(GpMetafile));
     if (!*metafile)
         return OutOfMemory;
 
     (*metafile)->image.type = ImageTypeMetafile;
     (*metafile)->image.format = ImageFormatEMF;
     (*metafile)->image.frame_count = 1;
-    (*metafile)->image.xres = (REAL)header.szlDevice.cx;
-    (*metafile)->image.yres = (REAL)header.szlDevice.cy;
-    (*metafile)->bounds.X = (REAL)header.rclBounds.left;
-    (*metafile)->bounds.Y = (REAL)header.rclBounds.top;
-    (*metafile)->bounds.Width = (REAL)(header.rclBounds.right - header.rclBounds.left);
-    (*metafile)->bounds.Height = (REAL)(header.rclBounds.bottom - header.rclBounds.top);
+    (*metafile)->image.xres = header.DpiX;
+    (*metafile)->image.yres = header.DpiY;
+    (*metafile)->bounds.X = (REAL)header.u.EmfHeader.rclFrame.left / 2540.0 * header.DpiX;
+    (*metafile)->bounds.Y = (REAL)header.u.EmfHeader.rclFrame.top / 2540.0 * header.DpiY;
+    (*metafile)->bounds.Width = (REAL)(header.u.EmfHeader.rclFrame.right - header.u.EmfHeader.rclFrame.left)
+                                / 2540.0 * header.DpiX;
+    (*metafile)->bounds.Height = (REAL)(header.u.EmfHeader.rclFrame.bottom - header.u.EmfHeader.rclFrame.top)
+                                 / 2540.0 * header.DpiY;
     (*metafile)->unit = UnitPixel;
-    (*metafile)->metafile_type = metafile_type;
+    (*metafile)->metafile_type = header.Type;
     (*metafile)->hemf = hemf;
     (*metafile)->preserve_hemf = !delete;
 
@@ -1021,33 +1054,38 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromWmf(HMETAFILE hwmf, BOOL delete,
 
     TRACE("(%p, %d, %p, %p)\n", hwmf, delete, placeable, metafile);
 
-    if(!hwmf || !metafile || !placeable)
+    if(!hwmf || !metafile)
         return InvalidParameter;
 
     *metafile = NULL;
     read = GetMetaFileBitsEx(hwmf, 0, NULL);
     if(!read)
         return GenericError;
-    copy = GdipAlloc(read);
+    copy = heap_alloc_zero(read);
     GetMetaFileBitsEx(hwmf, read, copy);
 
     hemf = SetWinMetaFileBits(read, copy, NULL, NULL);
-    GdipFree(copy);
+    heap_free(copy);
 
     /* FIXME: We should store and use hwmf instead of converting to hemf */
     retval = GdipCreateMetafileFromEmf(hemf, TRUE, metafile);
 
     if (retval == Ok)
     {
-        (*metafile)->image.xres = (REAL)placeable->Inch;
-        (*metafile)->image.yres = (REAL)placeable->Inch;
-        (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch);
-        (*metafile)->bounds.Y = ((REAL)placeable->BoundingBox.Top) / ((REAL)placeable->Inch);
-        (*metafile)->bounds.Width = (REAL)(placeable->BoundingBox.Right -
-                                           placeable->BoundingBox.Left);
-        (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom -
-                                            placeable->BoundingBox.Top);
-        (*metafile)->metafile_type = MetafileTypeWmfPlaceable;
+        if (placeable)
+        {
+            (*metafile)->image.xres = (REAL)placeable->Inch;
+            (*metafile)->image.yres = (REAL)placeable->Inch;
+            (*metafile)->bounds.X = ((REAL)placeable->BoundingBox.Left) / ((REAL)placeable->Inch);
+            (*metafile)->bounds.Y = ((REAL)placeable->BoundingBox.Top) / ((REAL)placeable->Inch);
+            (*metafile)->bounds.Width = (REAL)(placeable->BoundingBox.Right -
+                                               placeable->BoundingBox.Left);
+            (*metafile)->bounds.Height = (REAL)(placeable->BoundingBox.Bottom -
+                                                placeable->BoundingBox.Top);
+            (*metafile)->metafile_type = MetafileTypeWmfPlaceable;
+        }
+        else
+            (*metafile)->metafile_type = MetafileTypeWmf;
         (*metafile)->image.format = ImageFormatWMF;
 
         if (delete) DeleteMetaFile(hwmf);
@@ -1086,14 +1124,9 @@ GpStatus WINGDIPAPI GdipCreateMetafileFromStream(IStream *stream,
 GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile,
     UINT limitDpi)
 {
-    static int calls;
-
     TRACE("(%p,%u)\n", metafile, limitDpi);
 
-    if(!(calls++))
-        FIXME("not implemented\n");
-
-    return NotImplemented;
+    return Ok;
 }
 
 GpStatus WINGDIPAPI GdipConvertToEmfPlus(const GpGraphics* ref,
index be5e51a..7fc2711 100644 (file)
@@ -28,14 +28,14 @@ GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator **iterator, GpPath* path)
     if(!iterator)
         return InvalidParameter;
 
-    *iterator = GdipAlloc(sizeof(GpPathIterator));
+    *iterator = heap_alloc_zero(sizeof(GpPathIterator));
     if(!*iterator)  return OutOfMemory;
 
     if(path){
         size = path->pathdata.Count;
 
-        (*iterator)->pathdata.Types  = GdipAlloc(size);
-        (*iterator)->pathdata.Points = GdipAlloc(size * sizeof(PointF));
+        (*iterator)->pathdata.Types  = heap_alloc_zero(size);
+        (*iterator)->pathdata.Points = heap_alloc_zero(size * sizeof(PointF));
 
         memcpy((*iterator)->pathdata.Types, path->pathdata.Types, size);
         memcpy((*iterator)->pathdata.Points, path->pathdata.Points,size * sizeof(PointF));
@@ -61,9 +61,9 @@ GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator *iter)
     if(!iter)
         return InvalidParameter;
 
-    GdipFree(iter->pathdata.Types);
-    GdipFree(iter->pathdata.Points);
-    GdipFree(iter);
+    heap_free(iter->pathdata.Types);
+    heap_free(iter->pathdata.Points);
+    heap_free(iter);
 
     return Ok;
 }
index 3cf018c..0104d95 100644 (file)
@@ -82,7 +82,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
     if(!pen || !clonepen)
         return InvalidParameter;
 
-    *clonepen = GdipAlloc(sizeof(GpPen));
+    *clonepen = heap_alloc_zero(sizeof(GpPen));
     if(!*clonepen)  return OutOfMemory;
 
     **clonepen = *pen;
@@ -102,7 +102,7 @@ GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
 
     if (stat == Ok && pen->dashes)
     {
-        (*clonepen)->dashes = GdipAlloc(pen->numdashes * sizeof(REAL));
+        (*clonepen)->dashes = heap_alloc_zero(pen->numdashes * sizeof(REAL));
         if ((*clonepen)->dashes)
             memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL));
         else
@@ -146,7 +146,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
     if(!pen || !brush)
         return InvalidParameter;
 
-    gp_pen = GdipAlloc(sizeof(GpPen));
+    gp_pen = heap_alloc_zero(sizeof(GpPen));
     if(!gp_pen)    return OutOfMemory;
 
     gp_pen->style = GP_DEFAULT_PENSTYLE;
@@ -162,7 +162,7 @@ GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit,
 
     if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
         FIXME("UnitWorld, UnitPixel only supported units\n");
-        GdipFree(gp_pen);
+        heap_free(gp_pen);
         return NotImplemented;
     }
 
@@ -185,8 +185,8 @@ GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
     GdipDeleteBrush(pen->brush);
     GdipDeleteCustomLineCap(pen->customstart);
     GdipDeleteCustomLineCap(pen->customend);
-    GdipFree(pen->dashes);
-    GdipFree(pen);
+    heap_free(pen->dashes);
+    heap_free(pen);
 
     return Ok;
 }
@@ -616,11 +616,11 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
     if(sum == 0.0 && count)
         return InvalidParameter;
 
-    GdipFree(pen->dashes);
+    heap_free(pen->dashes);
     pen->dashes = NULL;
 
     if(count > 0)
-        pen->dashes = GdipAlloc(count * sizeof(REAL));
+        pen->dashes = heap_alloc_zero(count * sizeof(REAL));
     if(!pen->dashes){
         pen->numdashes = 0;
         return OutOfMemory;
@@ -666,7 +666,7 @@ GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
         return InvalidParameter;
 
     if(dash != DashStyleCustom){
-        GdipFree(pen->dashes);
+        heap_free(pen->dashes);
         pen->dashes = NULL;
         pen->numdashes = 0;
     }
index 01c4f6f..858d03d 100644 (file)
@@ -177,7 +177,7 @@ static inline GpStatus clone_element(const region_element* element,
 
     /* root node is allocated with GpRegion */
     if(!*element2){
-        *element2 = GdipAlloc(sizeof(region_element));
+        *element2 = heap_alloc_zero(sizeof(region_element));
         if (!*element2)
             return OutOfMemory;
     }
@@ -250,7 +250,7 @@ GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
     if (!(region && clone))
         return InvalidParameter;
 
-    *clone = GdipAlloc(sizeof(GpRegion));
+    *clone = heap_alloc_zero(sizeof(GpRegion));
     if (!*clone)
         return OutOfMemory;
     element = &(*clone)->node;
@@ -281,11 +281,11 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin
     if(mode == CombineModeReplace){
         delete_element(&region->node);
         memcpy(region, path_region, sizeof(GpRegion));
-        GdipFree(path_region);
+        heap_free(path_region);
         return Ok;
     }
 
-    left = GdipAlloc(sizeof(region_element));
+    left = heap_alloc_zero(sizeof(region_element));
     if (left)
     {
         *left = region->node;
@@ -300,7 +300,7 @@ GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, Combin
     else
         stat = OutOfMemory;
 
-    GdipFree(left);
+    heap_free(left);
     GdipDeleteRegion(path_region);
     return stat;
 }
@@ -328,11 +328,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
     if(mode == CombineModeReplace){
         delete_element(&region->node);
         memcpy(region, rect_region, sizeof(GpRegion));
-        GdipFree(rect_region);
+        heap_free(rect_region);
         return Ok;
     }
 
-    left = GdipAlloc(sizeof(region_element));
+    left = heap_alloc_zero(sizeof(region_element));
     if (left)
     {
         memcpy(left, &region->node, sizeof(region_element));
@@ -347,7 +347,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
     else
         stat = OutOfMemory;
 
-    GdipFree(left);
+    heap_free(left);
     GdipDeleteRegion(rect_region);
     return stat;
 }
@@ -395,11 +395,11 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
 
         delete_element(&region1->node);
         memcpy(region1, reg2copy, sizeof(GpRegion));
-        GdipFree(reg2copy);
+        heap_free(reg2copy);
         return Ok;
     }
 
-    left  = GdipAlloc(sizeof(region_element));
+    left  = heap_alloc_zero(sizeof(region_element));
     if (!left)
         return OutOfMemory;
 
@@ -407,7 +407,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
     stat = clone_element(&region2->node, &right);
     if (stat != Ok)
     {
-        GdipFree(left);
+        heap_free(left);
         return OutOfMemory;
     }
 
@@ -427,7 +427,7 @@ GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
     if(!region)
         return InvalidParameter;
 
-    *region = GdipAlloc(sizeof(GpRegion));
+    *region = heap_alloc_zero(sizeof(GpRegion));
     if(!*region)
         return OutOfMemory;
 
@@ -465,7 +465,7 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
     if (!(path && region))
         return InvalidParameter;
 
-    *region = GdipAlloc(sizeof(GpRegion));
+    *region = heap_alloc_zero(sizeof(GpRegion));
     if(!*region)
         return OutOfMemory;
     stat = init_region(*region, RegionDataPath);
@@ -499,7 +499,7 @@ GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect,
     if (!(rect && region))
         return InvalidParameter;
 
-    *region = GdipAlloc(sizeof(GpRegion));
+    *region = heap_alloc_zero(sizeof(GpRegion));
     stat = init_region(*region, RegionDataRect);
     if(stat != Ok)
     {
@@ -551,32 +551,32 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
     if(!region || !(size = GetRegionData(hrgn, 0, NULL)))
         return InvalidParameter;
 
-    buf = GdipAlloc(size);
+    buf = heap_alloc_zero(size);
     if(!buf)
         return OutOfMemory;
 
     if(!GetRegionData(hrgn, size, buf)){
-        GdipFree(buf);
+        heap_free(buf);
         return GenericError;
     }
 
     if(buf->rdh.nCount == 0){
         if((stat = GdipCreateRegion(&local)) != Ok){
-            GdipFree(buf);
+            heap_free(buf);
             return stat;
         }
         if((stat = GdipSetEmpty(local)) != Ok){
-            GdipFree(buf);
+            heap_free(buf);
             GdipDeleteRegion(local);
             return stat;
         }
         *region = local;
-        GdipFree(buf);
+        heap_free(buf);
         return Ok;
     }
 
     if((stat = GdipCreatePath(FillModeAlternate, &path)) != Ok){
-        GdipFree(buf);
+        heap_free(buf);
         return stat;
     }
 
@@ -584,7 +584,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
     for(i = 0; i < buf->rdh.nCount; i++){
         if((stat = GdipAddPathRectangle(path, (REAL)rect->left, (REAL)rect->top,
                         (REAL)(rect->right - rect->left), (REAL)(rect->bottom - rect->top))) != Ok){
-            GdipFree(buf);
+            heap_free(buf);
             GdipDeletePath(path);
             return stat;
         }
@@ -593,7 +593,7 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
 
     stat = GdipCreateRegionPath(path, region);
 
-    GdipFree(buf);
+    heap_free(buf);
     GdipDeletePath(path);
     return stat;
 }
@@ -609,7 +609,7 @@ GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
         return InvalidParameter;
 
     delete_element(&region->node);
-    GdipFree(region);
+    heap_free(region);
 
     return Ok;
 }
@@ -894,12 +894,12 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio
     {
         region_element *left, *right;
 
-        left = GdipAlloc(sizeof(region_element));
+        left = heap_alloc_zero(sizeof(region_element));
         if (!left) return OutOfMemory;
-        right = GdipAlloc(sizeof(region_element));
+        right = heap_alloc_zero(sizeof(region_element));
         if (!right)
         {
-            GdipFree(left);
+            heap_free(left);
             return OutOfMemory;
         }
 
@@ -916,8 +916,8 @@ static GpStatus read_element(struct memory_buffer *mbuf, GpRegion *region, regio
             }
         }
 
-        GdipFree(left);
-        GdipFree(right);
+        heap_free(left);
+        heap_free(right);
         return status;
     }
 
@@ -1513,7 +1513,7 @@ static GpStatus transform_region_element(region_element* element, GpMatrix *matr
             {
                 /* Steal the element from the created region. */
                 memcpy(element, &new_region->node, sizeof(region_element));
-                GdipFree(new_region);
+                heap_free(new_region);
             }
             else
                 return stat;
@@ -1619,7 +1619,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND
             {
                 data_size = GetRegionData(hrgn, 0, NULL);
 
-                *data = GdipAlloc(data_size);
+                *data = heap_alloc_zero(data_size);
 
                 if (*data)
                     GetRegionData(hrgn, data_size, *data);
@@ -1632,7 +1632,7 @@ static GpStatus get_region_scans_data(GpRegion *region, GpMatrix *matrix, LPRGND
             {
                 data_size = sizeof(RGNDATAHEADER) + sizeof(RECT);
 
-                *data = GdipAlloc(data_size);
+                *data = heap_alloc_zero(data_size);
 
                 if (*data)
                 {
@@ -1671,7 +1671,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansCount(GpRegion *region, UINT *count, GpMat
     if (stat == Ok)
     {
         *count = data->rdh.nCount;
-        GdipFree(data);
+        heap_free(data);
     }
 
     return stat;
@@ -1705,7 +1705,7 @@ GpStatus WINGDIPAPI GdipGetRegionScansI(GpRegion *region, GpRect *scans, INT *co
             }
         }
 
-        GdipFree(data);
+        heap_free(data);
     }
 
     return Ok;
@@ -1739,7 +1739,7 @@ GpStatus WINGDIPAPI GdipGetRegionScans(GpRegion *region, GpRectF *scans, INT *co
             }
         }
 
-        GdipFree(data);
+        heap_free(data);
     }
 
     return Ok;
index 3b78817..6341148 100644 (file)
@@ -27,7 +27,7 @@ GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
     if(!format)
         return InvalidParameter;
 
-    *format = GdipAlloc(sizeof(GpStringFormat));
+    *format = heap_alloc_zero(sizeof(GpStringFormat));
     if(!*format)   return OutOfMemory;
 
     (*format)->attr = attr;
@@ -53,9 +53,9 @@ GpStatus WINGDIPAPI GdipDeleteStringFormat(GpStringFormat *format)
     if(!format)
         return InvalidParameter;
 
-    GdipFree(format->character_ranges);
-    GdipFree(format->tabs);
-    GdipFree(format);
+    heap_free(format->character_ranges);
+    heap_free(format->tabs);
+    heap_free(format);
 
     return Ok;
 }
@@ -247,11 +247,11 @@ GpStatus WINGDIPAPI GdipSetStringFormatMeasurableCharacterRanges(
 
     TRACE("%p, %d, %p\n", format, rangeCount, ranges);
 
-    new_ranges = GdipAlloc(rangeCount * sizeof(CharacterRange));
+    new_ranges = heap_alloc_zero(rangeCount * sizeof(CharacterRange));
     if (!new_ranges)
         return OutOfMemory;
 
-    GdipFree(format->character_ranges);
+    heap_free(format->character_ranges);
     format->character_ranges = new_ranges;
     memcpy(format->character_ranges, ranges, sizeof(CharacterRange) * rangeCount);
     format->range_count = rangeCount;
@@ -271,14 +271,14 @@ GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL fir
         if(firsttab < 0.0)  return NotImplemented;
         /* first time allocation */
         if(format->tabcount == 0){
-            format->tabs = GdipAlloc(sizeof(REAL)*count);
+            format->tabs = heap_alloc_zero(sizeof(REAL)*count);
             if(!format->tabs)
                 return OutOfMemory;
         }
         /* reallocation */
         if((format->tabcount < count) && (format->tabcount > 0)){
             REAL *ptr;
-            ptr = HeapReAlloc(GetProcessHeap(), 0, format->tabs, sizeof(REAL)*count);
+            ptr = heap_realloc(format->tabs, sizeof(REAL)*count);
             if(!ptr)
                 return OutOfMemory;
             format->tabs = ptr;
@@ -321,15 +321,15 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
     if(!format || !newFormat)
         return InvalidParameter;
 
-    *newFormat = GdipAlloc(sizeof(GpStringFormat));
+    *newFormat = heap_alloc_zero(sizeof(GpStringFormat));
     if(!*newFormat)    return OutOfMemory;
 
     **newFormat = *format;
 
     if(format->tabcount > 0){
-        (*newFormat)->tabs = GdipAlloc(sizeof(REAL) * format->tabcount);
+        (*newFormat)->tabs = heap_alloc_zero(sizeof(REAL) * format->tabcount);
         if(!(*newFormat)->tabs){
-            GdipFree(*newFormat);
+            heap_free(*newFormat);
             return OutOfMemory;
         }
         memcpy((*newFormat)->tabs, format->tabs, sizeof(REAL) * format->tabcount);
@@ -338,10 +338,10 @@ GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpSt
         (*newFormat)->tabs = NULL;
 
     if(format->range_count > 0){
-        (*newFormat)->character_ranges = GdipAlloc(sizeof(CharacterRange) * format->range_count);
+        (*newFormat)->character_ranges = heap_alloc_zero(sizeof(CharacterRange) * format->range_count);
         if(!(*newFormat)->character_ranges){
-            GdipFree((*newFormat)->tabs);
-            GdipFree(*newFormat);
+            heap_free((*newFormat)->tabs);
+            heap_free(*newFormat);
             return OutOfMemory;
         }
         memcpy((*newFormat)->character_ranges, format->character_ranges,
index 6cfc0fd..1cadcf7 100644 (file)
@@ -68,7 +68,7 @@ reactos/dll/win32/dciman32            # Synced to WineStaging-1.7.47
 reactos/dll/win32/faultrep            # Synced to WineStaging-1.7.47
 reactos/dll/win32/fltlib              # Synced to WineStaging-1.7.47
 reactos/dll/win32/fusion              # Synced to WineStaging-1.7.47
-reactos/dll/win32/gdiplus             # Synced to WineStaging-1.7.47
+reactos/dll/win32/gdiplus             # Synced to WineStaging-1.7.55
 reactos/dll/win32/hhctrl.ocx          # Synced to WineStaging-1.7.47
 reactos/dll/win32/hlink               # Synced to WineStaging-1.7.47
 reactos/dll/win32/hnetcfg             # Synced to WineStaging-1.7.55