mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 20:01:22 +00:00
Backend part of graphic context rewrite.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@24965 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7f68c2ef43
commit
ff21318a0a
6 changed files with 159 additions and 90 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2007-04-04 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/gsc/GSContext.h: Remove ivar gtable.
|
||||
* Source/gsc/GSContext.m: Changed to use a gtable object
|
||||
shared between all contexts.
|
||||
* Headers/cairo/CairoGState.h:
|
||||
Declare new methods for save and restore.
|
||||
* Source/cairo/CairoContext.m (-DPSgrestore, -DPSgsave): Use these methods.
|
||||
* Source/cairo/CairoGState.m (-DPSgrestore, -DPSgsave): Implement
|
||||
these methods.
|
||||
* Source/cairo/CairoGState.m (-compositeGState:...fraction:):
|
||||
Another try on conversion of the coordinates.
|
||||
|
||||
2007-03-30 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* header/xlib/XGGeometry.h: Replace calls to the now deprecated
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
- (void) GSCurrentDevice: (void **)device: (int *)x : (int *)y;
|
||||
- (void) GSSetDevice: (void *)device : (int)x : (int)y;
|
||||
- (void) DPSgsave;
|
||||
- (void) DPSgrestore;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
void *opstack;
|
||||
void *gstack;
|
||||
GSGState *gstate;
|
||||
NSMapTable *gtable;
|
||||
}
|
||||
|
||||
- (GSGState *) currentGState;
|
||||
|
|
|
@ -113,4 +113,14 @@
|
|||
[CGSTATE GSSetDevice: device : x : y];
|
||||
}
|
||||
|
||||
- (void) DPSgrestore
|
||||
{
|
||||
[CGSTATE DPSgrestore];
|
||||
}
|
||||
|
||||
- (void) DPSgsave
|
||||
{
|
||||
[CGSTATE DPSgsave];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -169,6 +169,22 @@
|
|||
theOffset.y - size.height);
|
||||
}
|
||||
|
||||
- (void) DPSgrestore
|
||||
{
|
||||
if (_ct)
|
||||
{
|
||||
cairo_restore(_ct);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) DPSgsave
|
||||
{
|
||||
if (_ct)
|
||||
{
|
||||
cairo_save(_ct);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Color operations
|
||||
*/
|
||||
|
@ -967,15 +983,21 @@ _set_op(cairo_t *ct, NSCompositingOperation op)
|
|||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
With this bit of code enable scrolling works correctly, but images in cells get displayed wrongly.
|
||||
// Undo flipping in gui
|
||||
if (viewIsFlipped)
|
||||
{
|
||||
aPoint.y += NSHeight(aRect);
|
||||
aPoint.y -= NSHeight(aRect);
|
||||
}
|
||||
*/
|
||||
{
|
||||
NSRect newRect;
|
||||
|
||||
newRect.origin = aPoint;
|
||||
newRect.size = aRect.size;
|
||||
[ctm boundingRectFor: newRect result: &newRect];
|
||||
aPoint = newRect.origin;
|
||||
}
|
||||
//aPoint = [ctm transformPoint: aPoint];
|
||||
[source->ctm boundingRectFor: aRect result: &aRect];
|
||||
aPoint = [ctm transformPoint: aPoint];
|
||||
|
||||
x = aPoint.x;
|
||||
y = aPoint.y;
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
|
||||
/* Globally unique gstate number */
|
||||
static unsigned int unique_index = 0;
|
||||
static NSMapTable *gtable;
|
||||
|
||||
@interface GSContext (PrivateOps)
|
||||
- (void)DPSdefineuserobject;
|
||||
|
@ -112,6 +113,7 @@ static unsigned int unique_index = 0;
|
|||
- (void)DPSpop;
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
<unit>
|
||||
<heading>GSContext</heading>
|
||||
|
@ -128,6 +130,28 @@ static unsigned int unique_index = 0;
|
|||
</unit> */
|
||||
@implementation GSContext
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
gtable = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks, 20);
|
||||
}
|
||||
|
||||
+ (void) insertObject: (id)obj forKey: (int)index
|
||||
{
|
||||
NSMapInsert(gtable, (void *)(uintptr_t)index, obj);
|
||||
}
|
||||
|
||||
|
||||
+ (id) getObjectForKey: (int)index
|
||||
{
|
||||
return NSMapGet(gtable, (void *)(uintptr_t)index);
|
||||
}
|
||||
|
||||
+ (void) removeObjectForKey: (int)index
|
||||
{
|
||||
NSMapRemove(gtable, (void *)(uintptr_t)index);
|
||||
}
|
||||
|
||||
- (id) initWithContextInfo: (NSDictionary *)info
|
||||
{
|
||||
NSString *contextType;
|
||||
|
@ -152,9 +176,6 @@ static unsigned int unique_index = 0;
|
|||
GSIArrayInitWithZoneAndCapacity((GSIArray)opstack, z, 2);
|
||||
gstack = NSZoneMalloc(z, sizeof(GSIArray_t));
|
||||
GSIArrayInitWithZoneAndCapacity((GSIArray)gstack, z, 2);
|
||||
gtable = NSCreateMapTable(NSIntMapKeyCallBacks,
|
||||
NSObjectMapValueCallBacks, 20);
|
||||
|
||||
[super initWithContextInfo: info];
|
||||
|
||||
return self;
|
||||
|
@ -170,7 +191,6 @@ static unsigned int unique_index = 0;
|
|||
NSZoneFree([self zone], opstack);
|
||||
GSIArrayEmpty((GSIArray)gstack);
|
||||
NSZoneFree([self zone], gstack);
|
||||
NSFreeMapTable(gtable);
|
||||
DESTROY(gstate);
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -419,8 +439,8 @@ static unsigned int unique_index = 0;
|
|||
DPS_ERROR(DPSundefined, @"No gstate");
|
||||
return 0;
|
||||
}
|
||||
NSMapInsert(gtable,
|
||||
(void *)(uintptr_t)++unique_index, AUTORELEASE([gstate copy]));
|
||||
[isa insertObject: AUTORELEASE([gstate copy]) forKey: ++unique_index];
|
||||
|
||||
return unique_index;
|
||||
}
|
||||
|
||||
|
@ -433,7 +453,8 @@ static unsigned int unique_index = 0;
|
|||
{
|
||||
if (gst <= 0)
|
||||
return;
|
||||
NSMapInsert(gtable, (void *)(uintptr_t)gst, AUTORELEASE([gstate copy]));
|
||||
|
||||
[isa insertObject: AUTORELEASE([gstate copy]) forKey: gst];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
@ -865,27 +886,29 @@ static unsigned int unique_index = 0;
|
|||
if (n < 0)
|
||||
DPS_ERROR(DPSinvalidparam, @"Invalid userobject index");
|
||||
else
|
||||
NSMapInsert(gtable, (void *)(uintptr_t)n, obj);
|
||||
[isa insertObject: obj forKey: n];
|
||||
}
|
||||
|
||||
- (void)DPSexecuserobject: (int)index
|
||||
{
|
||||
if (index < 0 || NSMapGet(gtable, (void *)(uintptr_t)index) == nil)
|
||||
id obj;
|
||||
|
||||
if (index < 0 || (obj = [isa getObjectForKey: index]) == nil)
|
||||
{
|
||||
DPS_ERROR(DPSinvalidparam, @"Invalid userobject index");
|
||||
return;
|
||||
}
|
||||
ctxt_push((id)NSMapGet(gtable, (void *)(uintptr_t)index), opstack);
|
||||
ctxt_push(obj, opstack);
|
||||
}
|
||||
|
||||
- (void)DPSundefineuserobject: (int)index
|
||||
{
|
||||
if (index < 0 || NSMapGet(gtable, (void *)(uintptr_t)index) == nil)
|
||||
if (index < 0 || [isa getObjectForKey: index] == nil)
|
||||
{
|
||||
DPS_ERROR(DPSinvalidparam, @"Invalid gstate index");
|
||||
return;
|
||||
}
|
||||
NSMapRemove(gtable, (void *)(uintptr_t)index);
|
||||
[isa removeObjectForKey: index];
|
||||
}
|
||||
|
||||
- (void)DPSclear
|
||||
|
|
Loading…
Reference in a new issue