Tread a zero source rectangle as the full image and clip to the

image bounds.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25649 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-11-30 19:52:26 +00:00
parent 296fd50a2e
commit ff79c63530
2 changed files with 45 additions and 29 deletions

View file

@ -1,3 +1,9 @@
2007-11-30 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSImage.m (-drawInRect:fromRect:operation:fraction:):
Tread a zero source rectangle as the full image and clip to the
image bounds.
2007-11-30 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSClipView.m: ([scrollToPoint]) reset cursor rectangles when

View file

@ -970,22 +970,35 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
{
NSGraphicsContext *ctxt = GSCurrentContext();
NSAffineTransform *transform;
NSSize s;
s = [self size];
if (NSEqualRects(srcRect, NSZeroRect))
srcRect = NSMakeRect(0, 0, s.width, s.height);
if (!dstRect.size.width || !dstRect.size.height
|| !srcRect.size.width || !srcRect.size.height)
return;
// CLip to image bounds
if (srcRect.origin.x < 0)
srcRect.origin.x = 0;
if (srcRect.origin.y < 0)
srcRect.origin.y = 0;
if (NSMaxX(srcRect) > s.width)
srcRect.size.width = s.width - srcRect.origin.x;
if (NSMaxY(srcRect) > s.height)
srcRect.size.height = s.height - srcRect.origin.y;
if (![ctxt isDrawingToScreen])
{
/* We can't composite or dissolve if we aren't drawing to a screen,
so we'll just draw the right part of the image in the right
place. */
NSSize s;
NSPoint p;
double fx, fy;
s = [self size];
fx = dstRect.size.width / srcRect.size.width;
fy = dstRect.size.height / srcRect.size.height;
@ -1049,14 +1062,11 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
{
NSCachedImageRep *cache;
NSAffineTransformStruct ts;
NSSize s;
NSPoint p;
double x0, y0, x1, y1, w, h;
int gState;
NSGraphicsContext *ctxt1;
s = [self size];
/* Figure out how big we need to make the window that'll hold the
transformed image. */
p = [transform transformPoint: NSMakePoint(0, s.height)];