mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 11:30:48 +00:00
Implemented caching images
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14139 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7d05b5c4ab
commit
64ebc0c483
1 changed files with 34 additions and 3 deletions
|
@ -68,6 +68,7 @@
|
||||||
#include <AppKit/NSHelpManager.h>
|
#include <AppKit/NSHelpManager.h>
|
||||||
#include <AppKit/NSGraphics.h>
|
#include <AppKit/NSGraphics.h>
|
||||||
#include <AppKit/GSDisplayServer.h>
|
#include <AppKit/GSDisplayServer.h>
|
||||||
|
#include <AppKit/NSCachedImageRep.h>
|
||||||
|
|
||||||
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
|
BOOL GSViewAcceptsDrag(NSView *v, id<NSDraggingInfo> dragInfo);
|
||||||
|
|
||||||
|
@ -469,6 +470,7 @@ static NSNotificationCenter *nc = nil;
|
||||||
*/
|
*/
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
|
NSLog (@"NSWindow initialize");
|
||||||
if (self == [NSWindow class])
|
if (self == [NSWindow class])
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Initialize NSWindow class\n");
|
NSDebugLog(@"Initialize NSWindow class\n");
|
||||||
|
@ -622,6 +624,7 @@ static NSNotificationCenter *nc = nil;
|
||||||
TEST_RELEASE(_rectsBeingDrawn);
|
TEST_RELEASE(_rectsBeingDrawn);
|
||||||
TEST_RELEASE(_initialFirstResponder);
|
TEST_RELEASE(_initialFirstResponder);
|
||||||
TEST_RELEASE(_defaultButtonCell);
|
TEST_RELEASE(_defaultButtonCell);
|
||||||
|
TEST_RELEASE(_cachedImage);
|
||||||
RELEASE(_screen);
|
RELEASE(_screen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1735,6 +1738,7 @@ static NSNotificationCenter *nc = nil;
|
||||||
[_wv display];
|
[_wv display];
|
||||||
[self enableFlushWindow];
|
[self enableFlushWindow];
|
||||||
[self flushWindowIfNeeded];
|
[self flushWindowIfNeeded];
|
||||||
|
[self discardCachedImage];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) displayIfNeeded
|
- (void) displayIfNeeded
|
||||||
|
@ -1893,17 +1897,44 @@ static NSNotificationCenter *nc = nil;
|
||||||
|
|
||||||
- (void) cacheImageInRect: (NSRect)aRect
|
- (void) cacheImageInRect: (NSRect)aRect
|
||||||
{
|
{
|
||||||
// FIXME: This Method is missing
|
NSView *cacheView;
|
||||||
|
NSRect cacheRect;
|
||||||
|
|
||||||
|
aRect = NSIntegralRect (NSIntersectionRect(aRect, [_contentView frame]));
|
||||||
|
_cachedImageOrigin = aRect.origin;
|
||||||
|
DESTROY(_cachedImage);
|
||||||
|
|
||||||
|
if (NSIsEmptyRect (aRect))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheRect.origin = NSZeroPoint;
|
||||||
|
cacheRect.size = aRect.size;
|
||||||
|
_cachedImage = [[NSCachedImageRep alloc] initWithWindow: nil
|
||||||
|
rect: cacheRect];
|
||||||
|
cacheView = [[_cachedImage window] contentView];
|
||||||
|
[cacheView lockFocus];
|
||||||
|
NSCopyBits (_gstate, aRect, NSZeroPoint);
|
||||||
|
[cacheView unlockFocus];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) discardCachedImage
|
- (void) discardCachedImage
|
||||||
{
|
{
|
||||||
// FIXME: This Method is missing
|
DESTROY(_cachedImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) restoreCachedImage
|
- (void) restoreCachedImage
|
||||||
{
|
{
|
||||||
// FIXME: This Method is missing
|
if (_cachedImage == nil)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[_contentView lockFocus];
|
||||||
|
NSCopyBits ([[_cachedImage window] gState],
|
||||||
|
[_cachedImage rect],
|
||||||
|
_cachedImageOrigin);
|
||||||
|
[_contentView unlockFocus];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) useOptimizedDrawing: (BOOL)flag
|
- (void) useOptimizedDrawing: (BOOL)flag
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue