From 94d918446fa99ec0a5475723d5365e9dc6ac1def Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 10 Mar 2011 10:40:39 -0600 Subject: [PATCH 01/14] 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= 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; } -- 1.7.1