Commit 4c01c7d1 authored by trey's avatar trey
Browse files

Fixed 3094525 - Need to use SPI to fix flipped drag image problem

	We call the new SPI.  I also had to rework the dissolve steps to get it
	to non flip the image in Panther in millions (but leave the old code for
	the Jaguar case).

        Reviewed by cblu

        * Misc.subproj/WebNSImageExtras.m:
        (+[NSImage load]):  Call the SPI.
        (-[NSImage _web_dissolveToFraction:]):  Add new way of building the image for Panther.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3020 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8636c6f1
2002-12-12 Trey Matteson <trey@apple.com>
Fixed 3094525 - Need to use SPI to fix flipped drag image problem
We call the new SPI. I also had to rework the dissolve steps to get it
to non flip the image in Panther in millions (but leave the old code for
the Jaguar case).
Reviewed by cblu
* Misc.subproj/WebNSImageExtras.m:
(+[NSImage load]): Call the SPI.
(-[NSImage _web_dissolveToFraction:]): Add new way of building the image for Panther.
2002-12-12 Darin Adler <darin@apple.com>
Reviewed by Maciej.
......
......@@ -9,8 +9,29 @@
#import <WebKit/WebKitLogging.h>
#import <WebKit/WebNSImageExtras.h>
// see +load for details
@interface NSBitmapImageRep (SPINeededForJagGreen)
+ (void)_setEnableFlippedImageFix:(BOOL)f;
@end
static BOOL AKBugIsFixed = NO;
@implementation NSImage (WebExtras)
+ (void)load
{
// See 3094525, 3065097, 2767424. We need to call this SPI to get it fixed in JagGreen.
// Pre-green we're SOL. In Panther the fix is always on.
//
// FIXME 3125264: We can nuke this code, the category above, and half the code in
// _web_dissolveToFraction when we drop Jag support.
//
if ([[NSBitmapImageRep class] respondsToSelector:@selector(_setEnableFlippedImageFix:)]) {
[NSBitmapImageRep _setEnableFlippedImageFix:YES];
AKBugIsFixed = YES;
}
}
- (void)_web_scaleToMaxSize:(NSSize)size
{
float heightResizeDelta = 0.0, widthResizeDelta = 0.0, resizeDelta = 0.0;
......@@ -37,20 +58,36 @@ - (void)_web_scaleToMaxSize:(NSSize)size
- (void)_web_dissolveToFraction:(float)delta
{
NSImage *dissolvedImage = [[[NSImage alloc] initWithSize:[self size]] autorelease];
BOOL isFlipped = [self isFlipped];
[self setFlipped:NO];
[dissolvedImage lockFocus];
[self dissolveToPoint:NSZeroPoint fraction: delta];
[dissolvedImage unlockFocus];
NSImage *dissolvedImage = [[NSImage alloc] initWithSize:[self size]];
if (AKBugIsFixed) {
// In this case the dragging image is always correct.
[dissolvedImage setFlipped:[self isFlipped]];
[dissolvedImage lockFocus];
[self dissolveToPoint:NSMakePoint(0, [self size].height) fraction: delta];
[dissolvedImage unlockFocus];
[self lockFocus];
[dissolvedImage compositeToPoint:NSZeroPoint operation:NSCompositeCopy];
[self unlockFocus];
[self lockFocus];
[dissolvedImage compositeToPoint:NSMakePoint(0, [self size].height) operation:NSCompositeCopy];
[self unlockFocus];
} else {
// In this case Thousands mode will have an inverted drag image. Millions is OK.
// FIXME 3125264: this branch of code can go when we drop Jaguar support.
BOOL isFlipped = [self isFlipped];
[self setFlipped:NO];
[self setFlipped:isFlipped];
[dissolvedImage lockFocus];
[self dissolveToPoint:NSZeroPoint fraction: delta];
[dissolvedImage unlockFocus];
[self lockFocus];
[dissolvedImage compositeToPoint:NSZeroPoint operation:NSCompositeCopy];
[self unlockFocus];
[self setFlipped:isFlipped];
}
[dissolvedImage release];
}
@end
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