Commit 27989a0a authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

gdiplus: Improve performance by switching loops and fix size.

parent 948412f0
...@@ -771,8 +771,8 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d ...@@ -771,8 +771,8 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d
max_green = (key->high>>8)&0xff; max_green = (key->high>>8)&0xff;
max_red = (key->high>>16)&0xff; max_red = (key->high>>16)&0xff;
for (x=0; x<width; x++)
for (y=0; y<height; y++) for (y=0; y<height; y++)
for (x=0; x<width; x++)
{ {
ARGB *src_color; ARGB *src_color;
BYTE blue, green, red; BYTE blue, green, red;
...@@ -799,8 +799,8 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d ...@@ -799,8 +799,8 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d
else else
table = &attributes->colorremaptables[ColorAdjustTypeDefault]; table = &attributes->colorremaptables[ColorAdjustTypeDefault];
for (x=0; x<width; x++)
for (y=0; y<height; y++) for (y=0; y<height; y++)
for (x=0; x<width; x++)
{ {
ARGB *src_color; ARGB *src_color;
src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x); src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
...@@ -838,10 +838,10 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d ...@@ -838,10 +838,10 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d
if (!identity) if (!identity)
{ {
for (x=0; x<width; x++)
{
for (y=0; y<height; y++) for (y=0; y<height; y++)
{ {
for (x=0; x<width; x++)
{
ARGB *src_color; ARGB *src_color;
src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x); src_color = (ARGB*)(data + stride * y + sizeof(ARGB) * x);
...@@ -872,8 +872,8 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d ...@@ -872,8 +872,8 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d
else else
gamma = attributes->gamma[ColorAdjustTypeDefault]; gamma = attributes->gamma[ColorAdjustTypeDefault];
for (x=0; x<width; x++)
for (y=0; y<height; y++) for (y=0; y<height; y++)
for (x=0; x<width; x++)
{ {
ARGB *src_color; ARGB *src_color;
BYTE blue, green, red; BYTE blue, green, red;
...@@ -1201,8 +1201,8 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush, ...@@ -1201,8 +1201,8 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush,
{ {
int x, y; int x, y;
GpSolidFill *fill = (GpSolidFill*)brush; GpSolidFill *fill = (GpSolidFill*)brush;
for (x=0; x<fill_area->Width; x++)
for (y=0; y<fill_area->Height; y++) for (y=0; y<fill_area->Height; y++)
for (x=0; x<fill_area->Width; x++)
argb_pixels[x + y*cdwStride] = fill->color; argb_pixels[x + y*cdwStride] = fill->color;
return Ok; return Ok;
} }
......
...@@ -1693,8 +1693,8 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap) ...@@ -1693,8 +1693,8 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
/* If any pixel has a non-zero alpha, ignore hbmMask */ /* If any pixel has a non-zero alpha, ignore hbmMask */
src = (DWORD*)lockeddata.Scan0; src = (DWORD*)lockeddata.Scan0;
for (x=0; x<width && !has_alpha; x++)
for (y=0; y<height && !has_alpha; y++) for (y=0; y<height && !has_alpha; y++)
for (x=0; x<width && !has_alpha; x++)
if ((*src++ & 0xff000000) != 0) if ((*src++ & 0xff000000) != 0)
has_alpha = TRUE; has_alpha = TRUE;
} }
...@@ -1723,7 +1723,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap) ...@@ -1723,7 +1723,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
for (y=0; y<height; y++) for (y=0; y<height; y++)
{ {
dst = (DWORD*)dst_row; dst = (DWORD*)dst_row;
for (x=0; x<height; x++) for (x=0; x<width; x++)
{ {
DWORD src_value = *src++; DWORD src_value = *src++;
if (src_value) if (src_value)
...@@ -1743,7 +1743,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap) ...@@ -1743,7 +1743,7 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHICON(HICON hicon, GpBitmap** bitmap)
for (y=0; y<height; y++) for (y=0; y<height; y++)
{ {
dst = (DWORD*)dst_row; dst = (DWORD*)dst_row;
for (x=0; x<height; x++) for (x=0; x<width; x++)
*dst++ |= 0xff000000; *dst++ |= 0xff000000;
dst_row += lockeddata.Stride; dst_row += lockeddata.Stride;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment