Module: wine Branch: master Commit: 51cf90d8ca14ed15737823f89495fcf605229766 URL: http://source.winehq.org/git/wine.git/?a=commit;h=51cf90d8ca14ed15737823f894...
Author: Vincent Povirk vincent@codeweavers.com Date: Thu Mar 10 10:40:39 2011 -0600
gdiplus: Move bitmap interpolation into a separate function.
---
dlls/gdiplus/graphics.c | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 89cd6ca..3b7b7ba 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -526,6 +526,24 @@ static ARGB sample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT wi return ((DWORD*)(bits))[(x - src_rect->X) + (y - src_rect->Y) * src_rect->Width]; }
+static ARGB resample_bitmap_pixel(GDIPCONST GpRect *src_rect, LPBYTE bits, UINT width, + UINT height, GpPointF *point, GDIPCONST GpImageAttributes *attributes, + InterpolationMode interpolation) +{ + static int fixme; + + switch (interpolation) + { + default: + if (!fixme++) + FIXME("Unimplemented interpolation %i\n", interpolation); + /* fall-through */ + case InterpolationModeNearestNeighbor: + return sample_bitmap_pixel(src_rect, bits, width, height, + roundr(point->X), roundr(point->Y), attributes); + } +} + static void brush_fill_path(GpGraphics *graphics, GpBrush* brush) { switch (brush->bt) @@ -2528,19 +2546,15 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image for (y=dst_area.top; y<dst_area.bottom; y++) { GpPointF src_pointf; - INT src_x, src_y; ARGB *dst_color;
src_pointf.X = dst_to_src_points[0].X + x * x_dx + y * y_dx; src_pointf.Y = dst_to_src_points[0].Y + x * x_dy + y * y_dy;
- src_x = roundr(src_pointf.X); - src_y = roundr(src_pointf.Y); - dst_color = (ARGB*)(dst_data + dst_stride * (y - dst_area.top) + sizeof(ARGB) * (x - dst_area.left));
if (src_pointf.X >= srcx && src_pointf.X < srcx + srcwidth && src_pointf.Y >= srcy && src_pointf.Y < srcy+srcheight) - *dst_color = sample_bitmap_pixel(&src_area, src_data, bitmap->width, bitmap->height, src_x, src_y, imageAttributes); + *dst_color = resample_bitmap_pixel(&src_area, src_data, bitmap->width, bitmap->height, &src_pointf, imageAttributes, interpolation); else *dst_color = 0; }