diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2019-09-05 23:29:04 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2020-01-05 22:37:36 +0100 |
commit | 5d3029a6ccfb2226bdf0ffa5dedb6880ef832e5e (patch) | |
tree | 00e4681b9c2042c3056210b7b25ea4497c35c888 /nx-X11/programs/Xserver | |
parent | f469ac534f917b9c9cc32e8a66c253dc39418f9f (diff) | |
download | nx-libs-5d3029a6ccfb2226bdf0ffa5dedb6880ef832e5e.tar.gz nx-libs-5d3029a6ccfb2226bdf0ffa5dedb6880ef832e5e.tar.bz2 nx-libs-5d3029a6ccfb2226bdf0ffa5dedb6880ef832e5e.zip |
Image.c: scope improvements
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Image.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index dcd7c49c0..a655e1428 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -875,12 +875,6 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, int w, int h, int leftPad, int format, char *data) { - int length; - - int bytesPerLine; - int numSubImages; - int totalHeight; - /* * NXPutPackedImage is longer than PutPackedImage so that we * subtract the bigger one to be sure. @@ -923,21 +917,21 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, * Get bytes per line according to format. */ - bytesPerLine = nxagentImagePad(w, format, leftPad, depth); + int bytesPerLine = nxagentImagePad(w, format, leftPad, depth); if (nxagentOption(Shadow) == 1 && format == ZPixmap && (nxagentOption(XRatio) != DONT_SCALE || nxagentOption(YRatio) != DONT_SCALE) && pDrawable == (DrawablePtr) nxagentShadowPixmapPtr) { - int scaledx; - int scaledy; - image = XCreateImage(nxagentDisplay, pVisual, depth, ZPixmap, 0, data, w, h, BitmapPad(nxagentDisplay), bytesPerLine); if (image != NULL) { + int scaledx; + int scaledy; + image -> byte_order = IMAGE_BYTE_ORDER; image -> bitmap_bit_order = BITMAP_BIT_ORDER; @@ -972,13 +966,13 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, goto nxagentRealizeImageEnd; } - totalHeight = h; + int totalHeight = h; - length = bytesPerLine * h; + int length = bytesPerLine * h; h = (subSize < length ? subSize : length) / bytesPerLine; - numSubImages = totalHeight / h + 1; + int numSubImages = totalHeight / h + 1; while (numSubImages > 0) { @@ -1635,10 +1629,9 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio, #else - char *srcPixel = &image -> data[(j * image -> bytes_per_line) + - ((i * image -> bits_per_pixel) >> 3)]; - - char *dstPixel = (char *) &val; + char * srcPixel = &image -> data[(j * image -> bytes_per_line) + + ((i * image -> bits_per_pixel) >> 3)]; + char * dstPixel = (char *) &val; val = 0; @@ -1691,15 +1684,12 @@ int nxagentScaleImage(int x, int y, unsigned xRatio, unsigned yRatio, char *nxagentAllocateImageData(int width, int height, int depth, int *length, int *format) { - int leftPad = 0; - *format = (depth == 1) ? XYPixmap : ZPixmap; - *length = nxagentImageLength(width, height, *format, leftPad, depth); + *length = nxagentImageLength(width, height, *format, 0, depth); - char *data = NULL; - - if ((data = malloc(*length)) == NULL) + char *data = malloc(*length); + if (data == NULL) { #ifdef WARNING fprintf(stderr, "nxagentAllocateImageData: WARNING! Failed to allocate [%d] bytes of memory.\n", *length); |