[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[platform-swt-dev] Re: ImageData / Image problem
|
L. Mihalkovic wrote:
noticed the following minor issue with Image.java in Carbon (others to?):
Image.getImageData() {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
int width = OS.CGImageGetWidth(handle);
int height = OS.CGImageGetHeight(handle);
int bpr = OS.CGImageGetBytesPerRow(handle);
int bpp = OS.CGImageGetBitsPerPixel(handle);
int dataSize = height * bpr;
byte[] srcData = new byte[dataSize];
OS.memmove(srcData, data, dataSize);
PaletteData palette = new PaletteData(0xFF0000, 0xFF00, 0xFF);
ImageData data = new ImageData(width, height, bpp, palette);
data.data = srcData;
....
}
new ImageData(width, height, bpp, palette) {
... ImageData(...)
.... setAllFields(
.....
data != null ? data : new byte[bytesPerLine * height],
.....
);
}
}
Image buffer gets allocated twice for no reason.
same problem in the gtk & motif code, but not in Win32. don't have time
to check the rest. I can't imagine it helps performance when dealing
with large numbers or larger images.
--
Laurent Mihalkovic, co-author SWT/JFace in Action (www.manning.com/scarpino)