From ef0ee6e556891f019fb655579d0c97a76a38d43c Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Wed, 12 Aug 2009 15:37:09 -0500 Subject: [PATCH] gdiplus: Implement GdipGetVisibleClipBounds. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphics.c | 67 +++++++++++++++++++++++++++++++++------ include/gdiplusflat.h | 2 ++ 3 files changed, 61 insertions(+), 10 deletions(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 8863c378fb5..51c6d069e40 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -400,7 +400,7 @@ @ stub GdipGetTextureImage @ stdcall GdipGetTextureTransform(ptr ptr) @ stdcall GdipGetTextureWrapMode(ptr ptr) -@ stub GdipGetVisibleClipBounds +@ stdcall GdipGetVisibleClipBounds(ptr ptr) @ stdcall GdipGetVisibleClipBoundsI(ptr ptr) @ stdcall GdipGetWorldTransform(ptr ptr) @ stdcall GdipGraphicsClear(ptr long) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 8f73ee99fe2..0a8aa451458 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3124,6 +3124,64 @@ GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics *graphics, return Ok; } +GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect) +{ + GpRegion *clip_rgn; + GpStatus stat; + GpRectF wnd_rect; + + TRACE("(%p, %p)\n", graphics, rect); + + if(!graphics || !rect) + return InvalidParameter; + + if(graphics->busy) + return ObjectBusy; + + /* get window bounds */ + if((stat = get_graphics_bounds(graphics, &wnd_rect)) != Ok) + return stat; + + /* intersect window and graphics clipping regions */ + if((stat = GdipCreateRegion(&clip_rgn)) != Ok) + return stat; + + if((stat = GdipCombineRegionRect(clip_rgn, &wnd_rect, CombineModeIntersect)) != Ok) + goto cleanup; + + if((stat = GdipCombineRegionRegion(clip_rgn, graphics->clip, CombineModeIntersect)) != Ok) + goto cleanup; + + /* get bounds of the region */ + stat = GdipGetRegionBounds(clip_rgn, graphics, rect); + +cleanup: + GdipDeleteRegion(clip_rgn); + + return stat; +} + +GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect) +{ + GpRectF rectf; + GpStatus stat; + + TRACE("(%p, %p)\n", graphics, rect); + + if(!graphics || !rect) + return InvalidParameter; + + if((stat = GdipGetVisibleClipBounds(graphics, &rectf)) == Ok) + { + rect->X = roundr(rectf.X); + rect->Y = roundr(rectf.Y); + rect->Width = roundr(rectf.Width); + rect->Height = roundr(rectf.Height); + } + + return stat; +} + GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix) { TRACE("(%p, %p)\n", graphics, matrix); @@ -4085,15 +4143,6 @@ GpStatus WINGDIPAPI GdipMeasureDriverString(GpGraphics *graphics, GDIPCONST UINT return NotImplemented; } -/***************************************************************************** - * GdipGetVisibleClipBoundsI [GDIPLUS.@] - */ -GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect) -{ - FIXME("(%p %p): stub\n", graphics, rect); - return NotImplemented; -} - /***************************************************************************** * GdipDrawDriverString [GDIPLUS.@] */ diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 71101ce1e9e..704be0ac042 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -227,6 +227,8 @@ GpStatus WINGDIPAPI GdipGetTextContrast(GpGraphics*,UINT*); GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics*,TextRenderingHint*); GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics*,GpMatrix*); GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics*,ARGB); +GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics*,GpRectF*); +GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI(GpGraphics*,GpRect*); GpStatus WINGDIPAPI GdipIsClipEmpty(GpGraphics*, BOOL*); GpStatus WINGDIPAPI GdipIsVisiblePoint(GpGraphics*,REAL,REAL,BOOL*); GpStatus WINGDIPAPI GdipIsVisiblePointI(GpGraphics*,INT,INT,BOOL*);