context->is_editor ? 0x000000ED : 0, net_cx);
0, net_cx);
void lo_GetImage(MWContext *context, IL_GroupContext *img_cx,                 LO_ImageStruct *lo_image, XP_ObserverList obs_list,                 NET_ReloadMethod requested_reload_method){    XP_Bool net_request_allowed; /* Are we willing to make a net request? */    NET_ReloadMethod reload_method;    IL_NetContext *net_cx = NULL;    IL_IRGB *trans_pixel;    char *image_url, *lowres_image_url, *url_to_fetch;	IL_ImageReq *dummy_ireq;    /* Safety checks. */    if (!context || !lo_image)        return;    /* Handle the TextFE. */    if (context->type == MWContextText) {        XL_GetTextImage(lo_image);        return;    }    /* More safety checks. */    if (!img_cx || !obs_list)        return;    /* Initialize the autoload images pref, if necessary. */    if (!pref_initialized) {        int status = PREF_GetBoolPref("general.always_load_images",                                      &autoload_images);        if (status == PREF_NOERROR) {            PREF_RegisterCallback("general.always_load_images",                                  lo_AutoloadPrefChangedFunc, NULL);            pref_initialized = TRUE;        }    }    /* Fetch the lowres image first if there is one.  Layout will call us       again to fetch the hires image, at which point the lowres_image_url       will be NULL. */    if (lo_image->lowres_image_url) {        PA_LOCK(lowres_image_url, char *, lo_image->lowres_image_url);    }    PA_LOCK(image_url, char *, lo_image->image_url);    if ((context->type == MWContextPostScript) ||        (context->type == MWContextPrint)) {        url_to_fetch = image_url;    }    else {		if ((lo_image->lowres_image_url)&&(!lo_image->lowres_image_req))            url_to_fetch = lowres_image_url;        else            url_to_fetch = image_url;    }        /* Determine whether we are willing to load the image from the Network. */    if ((context->type == MWContextPostScript) ||        (context->type == MWContextPrint) ||		(context->type == MWContextDialog) ||        autoload_images ||        (force_load_images == FORCE_LOAD_ALL_IMAGES) ||        (force_load_images && image_url && !XP_STRCMP(force_load_images, image_url))) {        net_request_allowed = TRUE;    }    else {        net_request_allowed = FALSE;    }    /* JavaScript-generated images can change if the document is reloaded,       so don't request a cache-only reload, even if layout requested one. */    if (NET_URL_Type(url_to_fetch) == MOCHA_TYPE_URL)        requested_reload_method = NET_DONT_RELOAD;     /* Create a dummy Net Context for the Image Library to use for network       operations.  This will be replaced by a true Net Context when the       Network Library is modularized. */    if(context->type != MWContextPrint){        reload_method = net_request_allowed ? requested_reload_method : NET_CACHE_ONLY_RELOAD;	}else{		reload_method =  NET_NORMAL_RELOAD;	}    net_cx = IL_NewDummyNetContext(context, reload_method);    /* Determine whether to request a mask if this is a transparent image.       In the case of a document backdrop, we ask the image library to fill       in the transparent area with a solid color.  For all other transparent       images, we force the creation of a mask by passing in NULL. */    if (context->type == MWContextPostScript) {        trans_pixel = XP_NEW_ZAP(IL_IRGB);        if (trans_pixel)            trans_pixel->red = trans_pixel->green = trans_pixel->blue = 0xff;    }#ifndef XP_WIN32    else if (context->type == MWContextPrint) {        trans_pixel = context->transparent_pixel;    }#endif    else {        if (lo_image->image_attr &&            (lo_image->image_attr->attrmask & LO_ATTR_BACKDROP) &&			!(lo_image->image_attr->attrmask & LO_ATTR_CELL_BACKDROP) &&			!(lo_image->image_attr->attrmask & LO_ATTR_LAYER_BACKDROP)			) {            trans_pixel = context->transparent_pixel;        }        else {#ifdef XP_WIN32		XP_Bool backgroundPref = FALSE;		PREF_GetBoolPref("browser.print_background",&backgroundPref);		if (context->type == MWContextPrint && !backgroundPref)	        trans_pixel = context->transparent_pixel;		else#endif            trans_pixel = NULL;        }    }    /* Fetch the image.  We ignore the return value and only set the lo_image's       image handle in the observer.  Any context-specific scaling of images,       e.g. for printing, should be handled by the Front End, so we divide the       image dimensions by the context scaling factors. */		dummy_ireq = IL_GetImage(url_to_fetch, img_cx, obs_list,                                      trans_pixel,                                      lo_image->width / context->convertPixX,                                      lo_image->height / context->convertPixY,                                      /* Special flag for Editor so the correct stream                                         converter is used (see IL_ViewStream in libimg/src/external.c */                                      context->is_editor ? 0x000000ED : 0,                                       net_cx);		if(( dummy_ireq != lo_image->lowres_image_req ) && url_to_fetch )			lo_image->image_req = dummy_ireq;    /* Destroy the transparent pixel if this is a PostScript context. */    if ((context->type == MWContextPostScript) && trans_pixel)        XP_FREE(trans_pixel);    /* The Image Library clones the dummy Net Context, so it safe to destroy       it. */    IL_DestroyDummyNetContext(net_cx);    if (lo_image->lowres_image_url)        PA_UNLOCK(lo_image->lowres_image_url);    PA_UNLOCK(lo_image->image_url);}