mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=424333; BadAlloc under X when viewing extremely large images; r=joe
This commit is contained in:
parent
29072360fb
commit
6450cdc188
@ -59,6 +59,8 @@
|
||||
#define CAIRO_GDK_DRAWING_NOTE(m) do {} while (0)
|
||||
#endif
|
||||
|
||||
#define GDK_PIXMAP_SIZE_MAX 32767
|
||||
|
||||
static cairo_user_data_key_t pixmap_free_key;
|
||||
static void pixmap_free_func (void *data)
|
||||
{
|
||||
@ -318,6 +320,10 @@ _create_temp_xlib_surface (cairo_t *cr, Display *dpy, int width, int height,
|
||||
{
|
||||
cairo_surface_t *result = NULL;
|
||||
|
||||
if (width >= GDK_PIXMAP_SIZE_MAX ||
|
||||
height >= GDK_PIXMAP_SIZE_MAX)
|
||||
return NULL;
|
||||
|
||||
/* base the temp surface on the *screen* surface, not any intermediate
|
||||
* group surface, because the screen surface is more likely to have
|
||||
* characteristics that the xlib-using code is likely to be happy with */
|
||||
|
@ -78,6 +78,8 @@
|
||||
|
||||
#include "lcms.h"
|
||||
|
||||
#define GDK_PIXMAP_SIZE_MAX 32767
|
||||
|
||||
#ifndef MOZ_PANGO
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
@ -149,6 +151,11 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
|
||||
gfxASurface::gfxImageFormat imageFormat)
|
||||
{
|
||||
nsRefPtr<gfxASurface> newSurface = nsnull;
|
||||
PRBool sizeOk = PR_TRUE;
|
||||
|
||||
if (size.width >= GDK_PIXMAP_SIZE_MAX ||
|
||||
size.height >= GDK_PIXMAP_SIZE_MAX)
|
||||
sizeOk = PR_FALSE;
|
||||
|
||||
#ifdef MOZ_X11
|
||||
int glitzf;
|
||||
@ -185,7 +192,7 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
|
||||
XRenderPictFormat* xrenderFormat =
|
||||
XRenderFindStandardFormat(display, xrenderFormatID);
|
||||
|
||||
if (xrenderFormat) {
|
||||
if (xrenderFormat && sizeOk) {
|
||||
pixmap = gdk_pixmap_new(nsnull, size.width, size.height,
|
||||
xrenderFormat->depth);
|
||||
|
||||
@ -211,18 +218,21 @@ gfxPlatformGtk::CreateOffscreenSurface(const gfxIntSize& size,
|
||||
if (pixmap)
|
||||
g_object_unref(pixmap);
|
||||
}
|
||||
|
||||
if (!newSurface) {
|
||||
// We don't have Render or we couldn't create an xlib surface for
|
||||
// whatever reason; fall back to image surface for the data.
|
||||
newSurface = new gfxImageSurface(gfxIntSize(size.width, size.height), imageFormat);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_DFB
|
||||
newSurface = new gfxDirectFBSurface(size, imageFormat);
|
||||
if (sizeOk)
|
||||
newSurface = new gfxDirectFBSurface(size, imageFormat);
|
||||
#endif
|
||||
|
||||
|
||||
if (!newSurface) {
|
||||
// We couldn't create a native surface for whatever reason;
|
||||
// e.g., no RENDER, bad size, etc.
|
||||
// Fall back to image surface for the data.
|
||||
newSurface = new gfxImageSurface(gfxIntSize(size.width, size.height), imageFormat);
|
||||
}
|
||||
|
||||
if (newSurface) {
|
||||
gfxContext tmpCtx(newSurface);
|
||||
tmpCtx.SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||
|
Loading…
Reference in New Issue
Block a user