correct pixmap updating (sadly memcpy'ing is not enough)
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
d9ee157ee8
commit
6c53df0fc5
1 changed files with 16 additions and 0 deletions
|
|
@ -60,6 +60,22 @@ static NSPoint pointFlip(NSPoint point) {
|
|||
}
|
||||
- (void)updateWithData:(unsigned char *)_data {
|
||||
memcpy(self->buf, _data, width * height * 4);
|
||||
if (self->rep) {
|
||||
[self->image removeRepresentation:self->rep];
|
||||
[self->rep release];
|
||||
}
|
||||
self->rep =
|
||||
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&self->buf
|
||||
pixelsWide:(int)width
|
||||
pixelsHigh:(int)height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:(int)width * 4
|
||||
bitsPerPixel:32];
|
||||
[self->image addRepresentation:self->rep];
|
||||
}
|
||||
- (void)destroy {
|
||||
free(self->buf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue