gdiplus: Get rid of no longer needed path and region fields.

This commit is contained in:
Dmitry Timoshkov 2013-11-12 18:16:28 +09:00 committed by Alexandre Julliard
parent b0da542210
commit f5d807b7d7
3 changed files with 20 additions and 43 deletions

View File

@ -459,7 +459,7 @@ void delete_element(region_element* element)
case RegionDataRect: case RegionDataRect:
break; break;
case RegionDataPath: case RegionDataPath:
GdipDeletePath(element->elementdata.pathdata.path); GdipDeletePath(element->elementdata.path);
break; break;
case RegionDataEmptyRect: case RegionDataEmptyRect:
case RegionDataInfiniteRect: case RegionDataInfiniteRect:

View File

@ -404,17 +404,7 @@ struct region_element
union union
{ {
GpRectF rect; GpRectF rect;
struct GpPath *path;
{
GpPath* path;
struct
{
DWORD size;
DWORD magic;
DWORD count;
DWORD flags;
} pathheader;
} pathdata;
struct struct
{ {
struct region_element *left; /* the original region */ struct region_element *left; /* the original region */
@ -424,13 +414,7 @@ struct region_element
}; };
struct GpRegion{ struct GpRegion{
struct DWORD num_children;
{
DWORD size;
DWORD checksum;
DWORD magic;
DWORD num_children;
} header;
region_element node; region_element node;
}; };

View File

@ -123,7 +123,7 @@ static inline INT get_element_size(const region_element* element)
return needed + sizeof(GpRect); return needed + sizeof(GpRect);
case RegionDataPath: case RegionDataPath:
{ {
const GpPath *path = element->elementdata.pathdata.path; const GpPath *path = element->elementdata.path;
DWORD flags = is_integer_path(path) ? FLAGS_INTPATH : FLAGS_NOFLAGS; DWORD flags = is_integer_path(path) ? FLAGS_INTPATH : FLAGS_NOFLAGS;
/* 3 for headers, once again size doesn't count itself */ /* 3 for headers, once again size doesn't count itself */
needed += sizeof(DWORD) * 3; needed += sizeof(DWORD) * 3;
@ -151,11 +151,8 @@ static inline INT get_element_size(const region_element* element)
/* Does not check parameters, caller must do that */ /* Does not check parameters, caller must do that */
static inline GpStatus init_region(GpRegion* region, const RegionType type) static inline GpStatus init_region(GpRegion* region, const RegionType type)
{ {
region->node.type = type; region->node.type = type;
region->header.checksum = 0xdeadbeef; region->num_children = 0;
region->header.magic = VERSION_MAGIC;
region->header.num_children = 0;
region->header.size = 0;
return Ok; return Ok;
} }
@ -183,9 +180,7 @@ static inline GpStatus clone_element(const region_element* element,
case RegionDataInfiniteRect: case RegionDataInfiniteRect:
return Ok; return Ok;
case RegionDataPath: case RegionDataPath:
(*element2)->elementdata.pathdata.pathheader = element->elementdata.pathdata.pathheader; stat = GdipClonePath(element->elementdata.path, &(*element2)->elementdata.path);
stat = GdipClonePath(element->elementdata.pathdata.path,
&(*element2)->elementdata.pathdata.path);
if (stat == Ok) return Ok; if (stat == Ok) return Ok;
break; break;
default: default:
@ -217,9 +212,7 @@ static inline void fuse_region(GpRegion* region, region_element* left,
region->node.type = mode; region->node.type = mode;
region->node.elementdata.combine.left = left; region->node.elementdata.combine.left = left;
region->node.elementdata.combine.right = right; region->node.elementdata.combine.right = right;
region->num_children += 2;
region->header.size = sizeheader_size + get_element_size(&region->node);
region->header.num_children += 2;
} }
/***************************************************************************** /*****************************************************************************
@ -249,7 +242,7 @@ GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
return OutOfMemory; return OutOfMemory;
element = &(*clone)->node; element = &(*clone)->node;
(*clone)->header = region->header; (*clone)->num_children = region->num_children;
return clone_element(&region->node, &element); return clone_element(&region->node, &element);
} }
@ -406,7 +399,7 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
} }
fuse_region(region1, left, right, mode); fuse_region(region1, left, right, mode);
region1->header.num_children += region2->header.num_children; region1->num_children += region2->num_children;
return Ok; return Ok;
} }
@ -470,7 +463,7 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
} }
element = &(*region)->node; element = &(*region)->node;
stat = GdipClonePath(path, &element->elementdata.pathdata.path); stat = GdipClonePath(path, &element->elementdata.path);
if (stat != Ok) if (stat != Ok)
{ {
GdipDeleteRegion(*region); GdipDeleteRegion(*region);
@ -741,7 +734,7 @@ static void write_element(const region_element* element, DWORD *buffer,
case RegionDataPath: case RegionDataPath:
{ {
INT i; INT i;
const GpPath* path = element->elementdata.pathdata.path; const GpPath* path = element->elementdata.path;
struct _pathheader struct _pathheader
{ {
DWORD size; DWORD size;
@ -845,7 +838,7 @@ GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE *buffer, UINT size,
region_header->size = sizeheader_size + get_element_size(&region->node); region_header->size = sizeheader_size + get_element_size(&region->node);
region_header->checksum = 0; region_header->checksum = 0;
region_header->magic = VERSION_MAGIC; region_header->magic = VERSION_MAGIC;
region_header->num_children = region->header.num_children; region_header->num_children = region->num_children;
filled += 4; filled += 4;
/* With few exceptions, everything written is DWORD aligned, /* With few exceptions, everything written is DWORD aligned,
* so use that as our base */ * so use that as our base */
@ -938,7 +931,7 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap
*hrgn = CreateRectRgn(0, 0, 0, 0); *hrgn = CreateRectRgn(0, 0, 0, 0);
return *hrgn ? Ok : OutOfMemory; return *hrgn ? Ok : OutOfMemory;
case RegionDataPath: case RegionDataPath:
return get_path_hrgn(element->elementdata.pathdata.path, graphics, hrgn); return get_path_hrgn(element->elementdata.path, graphics, hrgn);
case RegionDataRect: case RegionDataRect:
{ {
GpPath* path; GpPath* path;
@ -1298,12 +1291,12 @@ static GpStatus transform_region_element(region_element* element, GpMatrix *matr
} }
/* Fall-through to do the actual conversion. */ /* Fall-through to do the actual conversion. */
case RegionDataPath: case RegionDataPath:
if (!element->elementdata.pathdata.path->pathdata.Count) if (!element->elementdata.path->pathdata.Count)
return Ok; return Ok;
stat = GdipTransformMatrixPoints(matrix, stat = GdipTransformMatrixPoints(matrix,
element->elementdata.pathdata.path->pathdata.Points, element->elementdata.path->pathdata.Points,
element->elementdata.pathdata.path->pathdata.Count); element->elementdata.path->pathdata.Count);
return stat; return stat;
default: default:
stat = transform_region_element(element->elementdata.combine.left, matrix); stat = transform_region_element(element->elementdata.combine.left, matrix);
@ -1338,9 +1331,9 @@ static void translate_region_element(region_element* element, REAL dx, REAL dy)
element->elementdata.rect.Y += dy; element->elementdata.rect.Y += dy;
return; return;
case RegionDataPath: case RegionDataPath:
for(i = 0; i < element->elementdata.pathdata.path->pathdata.Count; i++){ for(i = 0; i < element->elementdata.path->pathdata.Count; i++){
element->elementdata.pathdata.path->pathdata.Points[i].X += dx; element->elementdata.path->pathdata.Points[i].X += dx;
element->elementdata.pathdata.path->pathdata.Points[i].Y += dy; element->elementdata.path->pathdata.Points[i].Y += dy;
} }
return; return;
default: default: