mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Do all bitmap image drawing via GSDrawImage:: to allow better
implementations in backends. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25600 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0477e36f24
commit
56b6a0ff3e
5 changed files with 64 additions and 40 deletions
|
@ -1,3 +1,12 @@
|
|||
2007-11-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSGraphics.h: Make NSDrawBitmap a real function.
|
||||
* Source/Functions.m (NSDrawBitmap): Implement via
|
||||
NSBitmapImageRep and GSDrawImage::.
|
||||
* Source/NSGraphicsContext.m (-GSDrawImage::): Implement via
|
||||
NSDrawBitmap::::::. To be subclassed in backends.
|
||||
* Source/NSBitmapImageRep.m (-draw): Use GSDrawImage:: for drawing.
|
||||
|
||||
2007-11-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSCell.m (-initWithCoder:): Correct keyed decoding of
|
||||
|
|
|
@ -165,33 +165,17 @@ APPKIT_EXPORT void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect,
|
|||
APPKIT_EXPORT void NSCopyBits(int srcGstate, NSRect srcRect,
|
||||
NSPoint destPoint);
|
||||
|
||||
static inline void
|
||||
NSDrawBitmap(NSRect rect,
|
||||
int pixelsWide,
|
||||
int pixelsHigh,
|
||||
int bitsPerSample,
|
||||
int samplesPerPixel,
|
||||
int bitsPerPixel,
|
||||
int bytesPerRow,
|
||||
BOOL isPlanar,
|
||||
BOOL hasAlpha,
|
||||
NSString *colorSpaceName,
|
||||
const unsigned char *const data[5])
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
(ctxt->methods->NSDrawBitmap___________)
|
||||
(ctxt, @selector(NSDrawBitmap: : : : : : : : : : :), rect,
|
||||
pixelsWide,
|
||||
pixelsHigh,
|
||||
bitsPerSample,
|
||||
samplesPerPixel,
|
||||
bitsPerPixel,
|
||||
bytesPerRow,
|
||||
isPlanar,
|
||||
hasAlpha,
|
||||
colorSpaceName,
|
||||
data);
|
||||
}
|
||||
APPKIT_EXPORT void NSDrawBitmap(NSRect rect,
|
||||
int pixelsWide,
|
||||
int pixelsHigh,
|
||||
int bitsPerSample,
|
||||
int samplesPerPixel,
|
||||
int bitsPerPixel,
|
||||
int bytesPerRow,
|
||||
BOOL isPlanar,
|
||||
BOOL hasAlpha,
|
||||
NSString *colorSpaceName,
|
||||
const unsigned char *const data[5]);
|
||||
|
||||
static inline void
|
||||
NSBeep(void)
|
||||
|
|
|
@ -297,6 +297,37 @@ void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
|
|||
NSCompositeCopy);
|
||||
}
|
||||
|
||||
void NSDrawBitmap(NSRect rect,
|
||||
int pixelsWide,
|
||||
int pixelsHigh,
|
||||
int bitsPerSample,
|
||||
int samplesPerPixel,
|
||||
int bitsPerPixel,
|
||||
int bytesPerRow,
|
||||
BOOL isPlanar,
|
||||
BOOL hasAlpha,
|
||||
NSString *colorSpaceName,
|
||||
const unsigned char *const data[5])
|
||||
{
|
||||
NSBitmapImageRep *bitmap;
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
|
||||
bitmap = [[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes: data
|
||||
pixelsWide: pixelsWide
|
||||
pixelsHigh: pixelsHigh
|
||||
bitsPerSample: bitsPerSample
|
||||
samplesPerPixel: samplesPerPixel
|
||||
hasAlpha: hasAlpha
|
||||
isPlanar: isPlanar
|
||||
colorSpaceName: colorSpaceName
|
||||
bytesPerRow: bytesPerRow
|
||||
bitsPerPixel: bitsPerPixel];
|
||||
|
||||
[ctxt GSDrawImage: rect : bitmap];
|
||||
RELEASE(bitmap);
|
||||
}
|
||||
|
||||
/*
|
||||
* Rectangle Drawing
|
||||
*/
|
||||
|
|
|
@ -1071,18 +1071,9 @@
|
|||
- (BOOL) draw
|
||||
{
|
||||
NSRect irect = NSMakeRect(0, 0, _size.width, _size.height);
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
|
||||
NSDrawBitmap(irect,
|
||||
_pixelsWide,
|
||||
_pixelsHigh,
|
||||
_bitsPerSample,
|
||||
_numColors,
|
||||
_bitsPerPixel,
|
||||
_bytesPerRow,
|
||||
_isPlanar,
|
||||
_hasAlpha,
|
||||
_colorSpace,
|
||||
(const unsigned char **)_imagePlanes);
|
||||
[ctxt GSDrawImage: irect : self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -1463,9 +1463,18 @@ NSGraphicsContext *GSCurrentContext(void)
|
|||
/** Generic method to draw an image into a rect. The image is defined
|
||||
by imageref, an opaque structure. Support for this method hasn't
|
||||
been implemented yet, so it should not be used anywhere. */
|
||||
- (void) GSDrawImage: (NSRect) rect: (void *) imageref
|
||||
- (void) GSDrawImage: (NSRect)rect: (void *)imageref
|
||||
{
|
||||
[self subclassResponsibility: _cmd];
|
||||
NSBitmapImageRep *bitmap;
|
||||
const unsigned char *data[5];
|
||||
|
||||
bitmap = (NSBitmapImageRep*)imageref;
|
||||
[bitmap getBitmapDataPlanes: &data];
|
||||
[self NSDrawBitmap: rect : [bitmap pixelsWide] : [bitmap pixelsHigh]
|
||||
: [bitmap bitsPerSample] : [bitmap samplesPerPixel]
|
||||
: [bitmap bitsPerPixel] : [bitmap bytesPerRow] : [bitmap isPlanar]
|
||||
: [bitmap hasAlpha] : [bitmap colorSpaceName]
|
||||
: data];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
|
Loading…
Reference in a new issue