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;
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->numSamples = width;
pRect->stride = stride * jump;

View File

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

View File

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

View File

@ -2523,7 +2523,7 @@ static gboolean gtk2_get_drawable_data(JNIEnv *env, jintArray pixelArray, jint x
int index;
for (_y = 0; _y < height; _y++) {
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);
ary[index] = 0xff000000

View File

@ -2943,7 +2943,7 @@ static gboolean gtk3_get_drawable_data(JNIEnv *env, jintArray pixelArray,
int index;
for (_y = 0; _y < height; _y++) {
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);
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;
if (format == ZPixmap)
ximage->data = malloc(height*bytes_per_line);
ximage->data = malloc((size_t) height * bytes_per_line);
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 ***/

View File

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