8233250: Better X11 rendering

Reviewed-by: prr, rhalade, mschoene, serb
This commit is contained in:
Anton Litvinov 2020-01-16 15:08:19 +00:00
parent f711ce40ba
commit e4f4e8eda1
7 changed files with 10 additions and 10 deletions

View file

@ -206,7 +206,7 @@ initRect(ImageRect * pRect, int x, int y, int width, int height, int jump,
int depthBytes = format->depthBytes; int depthBytes = format->depthBytes;
pRect->pBits = pBits; pRect->pBits = pBits;
INCPN(byte_t, pRect->pBits, y * stride + x * depthBytes); INCPN(byte_t, pRect->pBits, (intptr_t) y * stride + x * depthBytes);
pRect->numLines = height; pRect->numLines = height;
pRect->numSamples = width; pRect->numSamples = width;
pRect->stride = stride * jump; pRect->stride = stride * jump;

View file

@ -263,7 +263,7 @@ Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask
return; return;
} }
dstScan = image->bytes_per_line; dstScan = image->bytes_per_line;
image->data = malloc(dstScan * height); image->data = malloc((size_t) dstScan * height);
if (image->data == NULL) { if (image->data == NULL) {
XFree(image); XFree(image);
AWT_UNLOCK(); AWT_UNLOCK();

View file

@ -154,7 +154,7 @@ static void FillBitmap(XImage *theImage,
height = bottom - top; height = bottom - top;
top -= clipTop; top -= clipTop;
left -= clipLeft; left -= clipLeft;
pPix = ((jubyte *) theImage->data) + (left >> 3) + top * scan; pPix = ((jubyte *) theImage->data) + (left >> 3) + (intptr_t) top * scan;
left &= 0x07; left &= 0x07;
if (theImage->bitmap_bit_order == MSBFirst) { if (theImage->bitmap_bit_order == MSBFirst) {
left = 0x80 >> left; left = 0x80 >> left;

View file

@ -2523,7 +2523,7 @@ static gboolean gtk2_get_drawable_data(JNIEnv *env, jintArray pixelArray, jint x
int index; int index;
for (_y = 0; _y < height; _y++) { for (_y = 0; _y < height; _y++) {
for (_x = 0; _x < width; _x++) { for (_x = 0; _x < width; _x++) {
p = pix + _y * stride + _x * nchan; p = pix + (intptr_t) _y * stride + _x * nchan;
index = (_y + dy) * jwidth + (_x + dx); index = (_y + dy) * jwidth + (_x + dx);
ary[index] = 0xff000000 ary[index] = 0xff000000

View file

@ -2943,7 +2943,7 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
int index; int index;
for (_y = 0; _y < height; _y++) { for (_y = 0; _y < height; _y++) {
for (_x = 0; _x < width; _x++) { for (_x = 0; _x < width; _x++) {
p = pix + _y * stride + _x * nchan; p = pix + (intptr_t) _y * stride + _x * nchan;
index = (_y + dy) * jwidth + (_x + dx); index = (_y + dy) * jwidth + (_x + dx);
ary[index] = 0xff000000 ary[index] = 0xff000000

View file

@ -437,9 +437,9 @@ ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format,
bytes_per_line = ximage->bytes_per_line; bytes_per_line = ximage->bytes_per_line;
if (format == ZPixmap) if (format == ZPixmap)
ximage->data = malloc(height*bytes_per_line); ximage->data = malloc((size_t) height * bytes_per_line);
else else
ximage->data = malloc(height*bytes_per_line*depth); ximage->data = malloc((size_t) height * bytes_per_line * depth);
ximage->bits_per_pixel = depth; /** Valid only if format is ZPixmap ***/ ximage->bits_per_pixel = depth; /** Valid only if format is ZPixmap ***/

View file

@ -771,7 +771,7 @@ Java_sun_java2d_xr_XRBackendNative_putMaskNative
if (ea != 1.0f) { if (ea != 1.0f) {
for (line=0; line < height; line++) { for (line=0; line < height; line++) {
for (pix=0; pix < width; pix++) { for (pix=0; pix < width; pix++) {
int index = maskScan*line + pix + maskOff; size_t index = (size_t) maskScan * line + pix + maskOff;
mask[index] = (((unsigned char) mask[index])*ea); mask[index] = (((unsigned char) mask[index])*ea);
} }
} }
@ -796,8 +796,8 @@ Java_sun_java2d_xr_XRBackendNative_putMaskNative
if (imageFits) { if (imageFits) {
for (line=0; line < height; line++) { for (line=0; line < height; line++) {
for (pix=0; pix < width; pix++) { for (pix=0; pix < width; pix++) {
img->data[line*img->bytes_per_line + pix] = img->data[(size_t) line * img->bytes_per_line + pix] =
(unsigned char) (mask[maskScan*line + pix + maskOff]); (unsigned char) (mask[(size_t) maskScan * line + pix + maskOff]);
} }
} }
} else { } else {