зеркало из https://github.com/mozilla/gecko-dev.git
bug#13505. Replacing str functions with nsCRT functions, nspr functions.
pnunn@netscape.com r:jfrancis@netscape.com
This commit is contained in:
Родитель
23ceab24e7
Коммит
ba5f434f1b
|
@ -33,30 +33,30 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
virtual void NewPixmap(void* aDisplayContext,
|
||||
NS_IMETHOD NewPixmap(void* aDisplayContext,
|
||||
PRInt32 aWidth, PRInt32 aHeight,
|
||||
IL_Pixmap* aImage, IL_Pixmap* aMask);
|
||||
|
||||
virtual void UpdatePixmap(void* aDisplayContext,
|
||||
NS_IMETHOD UpdatePixmap(void* aDisplayContext,
|
||||
IL_Pixmap* aImage,
|
||||
PRInt32 aXOffset, PRInt32 aYOffset,
|
||||
PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
virtual void ControlPixmapBits(void* aDisplayContext,
|
||||
NS_IMETHOD ControlPixmapBits(void* aDisplayContext,
|
||||
IL_Pixmap* aImage, PRUint32 aControlMsg);
|
||||
|
||||
virtual void DestroyPixmap(void* aDisplayContext, IL_Pixmap* aImage);
|
||||
NS_IMETHOD DestroyPixmap(void* aDisplayContext, IL_Pixmap* aImage);
|
||||
|
||||
virtual void DisplayPixmap(void* aDisplayContext,
|
||||
NS_IMETHOD DisplayPixmap(void* aDisplayContext,
|
||||
IL_Pixmap* aImage, IL_Pixmap* aMask,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aXOffset, PRInt32 aYOffset,
|
||||
PRInt32 aWidth, PRInt32 aHeight);
|
||||
|
||||
virtual void DisplayIcon(void* aDisplayContext,
|
||||
NS_IMETHOD DisplayIcon(void* aDisplayContext,
|
||||
PRInt32 aX, PRInt32 aY, PRUint32 aIconNumber);
|
||||
|
||||
virtual void GetIconDimensions(void* aDisplayContext,
|
||||
NS_IMETHOD GetIconDimensions(void* aDisplayContext,
|
||||
PRInt32 *aWidthPtr, PRInt32 *aHeightPtr,
|
||||
PRUint32 aIconNumber);
|
||||
};
|
||||
|
@ -68,7 +68,8 @@ ImageRendererImpl::ImageRendererImpl()
|
|||
|
||||
NS_IMPL_ISUPPORTS(ImageRendererImpl, kIImageRendererIID)
|
||||
|
||||
void
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::NewPixmap(void* aDisplayContext,
|
||||
PRInt32 aWidth, PRInt32 aHeight,
|
||||
IL_Pixmap* aImage, IL_Pixmap* aMask)
|
||||
|
@ -85,7 +86,7 @@ ImageRendererImpl::NewPixmap(void* aDisplayContext,
|
|||
rv = nsComponentManager::CreateInstance(kImageCID, nsnull, kImageIID, (void **)&img);
|
||||
if (NS_OK != rv) {
|
||||
// XXX What about error handling?
|
||||
return;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Have the image match the depth and color space associated with the
|
||||
|
@ -108,14 +109,17 @@ ImageRendererImpl::NewPixmap(void* aDisplayContext,
|
|||
if(aImage->header.alpha_bits == 8)
|
||||
maskflag = nsMaskRequirements_kNeeds8Bit;
|
||||
|
||||
img->Init(aWidth, aHeight, depth, maskflag);
|
||||
rv = img->Init(aWidth, aHeight, depth, maskflag);
|
||||
if(NS_FAILED(rv)){
|
||||
//ptn dont forget cleanup of colorsp.
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Update the pixmap image and mask information
|
||||
aImage->bits = img->GetBits();
|
||||
aImage->client_data = img; // we don't need to add a ref here, because there's
|
||||
// already one from the call to create the image object
|
||||
|
||||
|
||||
aImage->header.width = aWidth;
|
||||
aImage->header.height = aHeight;
|
||||
aImage->header.widthBytes = img->GetLineStride();
|
||||
|
@ -162,9 +166,11 @@ ImageRendererImpl::NewPixmap(void* aDisplayContext,
|
|||
(blue >> 3)];
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::UpdatePixmap(void* aDisplayContext,
|
||||
IL_Pixmap* aImage,
|
||||
PRInt32 aXOffset, PRInt32 aYOffset,
|
||||
|
@ -175,9 +181,11 @@ ImageRendererImpl::UpdatePixmap(void* aDisplayContext,
|
|||
nsRect drect(aXOffset, aYOffset, aWidth, aHeight);
|
||||
|
||||
img->ImageUpdated(dc, nsImageUpdateFlags_kBitsChanged, &drect);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::ControlPixmapBits(void* aDisplayContext,
|
||||
IL_Pixmap* aImage, PRUint32 aControlMsg)
|
||||
{
|
||||
|
@ -187,9 +195,11 @@ ImageRendererImpl::ControlPixmapBits(void* aDisplayContext,
|
|||
if (aControlMsg == IL_RELEASE_BITS) {
|
||||
img->Optimize(dc);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::DestroyPixmap(void* aDisplayContext, IL_Pixmap* aImage)
|
||||
{
|
||||
nsIImage *img = (nsIImage *)aImage->client_data;
|
||||
|
@ -198,9 +208,11 @@ ImageRendererImpl::DestroyPixmap(void* aDisplayContext, IL_Pixmap* aImage)
|
|||
if (img) {
|
||||
NS_RELEASE(img);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::DisplayPixmap(void* aDisplayContext,
|
||||
IL_Pixmap* aImage, IL_Pixmap* aMask,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
|
@ -209,21 +221,26 @@ ImageRendererImpl::DisplayPixmap(void* aDisplayContext,
|
|||
{
|
||||
// Image library doesn't drive the display process.
|
||||
// XXX Why is this part of the API?
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::DisplayIcon(void* aDisplayContext,
|
||||
PRInt32 aX, PRInt32 aY, PRUint32 aIconNumber)
|
||||
{
|
||||
// XXX Why is this part of the API?
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageRendererImpl::GetIconDimensions(void* aDisplayContext,
|
||||
PRInt32 *aWidthPtr, PRInt32 *aHeightPtr,
|
||||
PRUint32 aIconNumber)
|
||||
{
|
||||
// XXX Why is this part of the API?
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
extern "C" NS_GFX_(nsresult)
|
||||
|
|
|
@ -35,6 +35,9 @@ the local dll. So far,
|
|||
#include "prmem.h"
|
||||
#include "xp_mcom.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
int MK_UNABLE_TO_LOCATE_FILE = -1;
|
||||
int MK_OUT_OF_MEMORY = -2;
|
||||
|
@ -82,7 +85,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMMOVE (*destination + destination_length, source, source_length);
|
||||
nsCRT::memmove(*destination + destination_length, source, source_length);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -91,7 +94,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMCPY(*destination, source, source_length);
|
||||
nsCRT::memcpy(*destination, source, source_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ the local dll. So far,
|
|||
#include "prmem.h"
|
||||
#include "xp_mcom.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
int MK_UNABLE_TO_LOCATE_FILE = -1;
|
||||
int MK_OUT_OF_MEMORY = -2;
|
||||
|
@ -82,7 +84,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMMOVE (*destination + destination_length, source, source_length);
|
||||
nsCRT::memmove(*destination + destination_length, source, source_length);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -91,7 +93,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMCPY(*destination, source, source_length);
|
||||
nsCRT::memcpy(*destination, source, source_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,15 @@
|
|||
|
||||
/*
|
||||
* jpeg.c --- Glue code to Independent JPEG Group decoder library
|
||||
* $Id: jpeg.cpp,v 1.6 1999/09/30 21:17:40 kipp%netscape.com Exp $
|
||||
* $Id: jpeg.cpp,v 1.7 1999/10/21 22:22:27 pnunn%netscape.com Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "nsIImgDecoder.h" // include if_struct.h Needs to be first
|
||||
#include "nsIImgDCallbk.h"
|
||||
#include "dllcompat.h"
|
||||
//#include "dllcompat.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsJPGDecoder.h"
|
||||
#include "jpeg.h"
|
||||
#include "merrors.h"
|
||||
|
@ -286,8 +287,8 @@ fill_input_buffer (j_decompress_ptr jd)
|
|||
}
|
||||
|
||||
/* Copy remainder of netlib buffer into backtrack buffer. */
|
||||
XP_BCOPY (src->pub.next_input_byte,
|
||||
src->backtrack_buffer + src->backtrack_buflen,
|
||||
nsCRT::memmove(src->backtrack_buffer + src->backtrack_buflen,
|
||||
src->pub.next_input_byte,
|
||||
src->pub.bytes_in_buffer);
|
||||
|
||||
/* Point to start of data to be rescanned. */
|
||||
|
|
|
@ -35,6 +35,8 @@ the local dll. So far,
|
|||
#include "prmem.h"
|
||||
#include "xp_mcom.h"
|
||||
|
||||
#include "nsCRT.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
int MK_UNABLE_TO_LOCATE_FILE = -1;
|
||||
int MK_OUT_OF_MEMORY = -2;
|
||||
|
@ -82,7 +84,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMMOVE (*destination + destination_length, source, source_length);
|
||||
nsCRT::memmove(*destination + destination_length, source, source_length);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -91,7 +93,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMCPY(*destination, source, source_length);
|
||||
nsCRT::memcpy(*destination, source, source_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
* should be allocated. (The bits pointers, initially NULL-valued,
|
||||
* should not be altered.)
|
||||
*/
|
||||
virtual void NewPixmap(void* aDisplayContext,
|
||||
NS_IMETHOD NewPixmap(void* aDisplayContext,
|
||||
PRInt32 aWidth, PRInt32 aHeight,
|
||||
IL_Pixmap* aImage, IL_Pixmap* aMask)=0;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
* upper-left-hand corner of the pixmap as the origin, increasing
|
||||
* left-to-right, top-to-bottom.
|
||||
*/
|
||||
virtual void UpdatePixmap(void* aDisplayContext,
|
||||
NS_IMETHOD UpdatePixmap(void* aDisplayContext,
|
||||
IL_Pixmap* aImage,
|
||||
PRInt32 aXOffset, PRInt32 aYOffset,
|
||||
PRInt32 aWidth, PRInt32 aHeight)=0;
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
* could be used, for example, by an X11 front-end to free the client-side
|
||||
* image data, preserving only the server pixmap.
|
||||
*/
|
||||
virtual void ControlPixmapBits(void* aDisplayContext,
|
||||
NS_IMETHOD ControlPixmapBits(void* aDisplayContext,
|
||||
IL_Pixmap* aImage, PRUint32 aControlMsg)=0;
|
||||
|
||||
/**
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
* information and the IL_Pixmap structure itself will be freed by the Image
|
||||
* Library.
|
||||
*/
|
||||
virtual void DestroyPixmap(void* aDisplayContext, IL_Pixmap* aImage)=0;
|
||||
NS_IMETHOD DestroyPixmap(void* aDisplayContext, IL_Pixmap* aImage)=0;
|
||||
|
||||
/**
|
||||
* Render a rectangular portion of the given pixmap.
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
* may differ from those of the pixmap storage if the callee
|
||||
* supports scaling.
|
||||
*/
|
||||
virtual void DisplayPixmap(void* aDisplayContext,
|
||||
NS_IMETHOD DisplayPixmap(void* aDisplayContext,
|
||||
IL_Pixmap* aImage, IL_Pixmap* aMask,
|
||||
PRInt32 aX, PRInt32 aY,
|
||||
PRInt32 aXOffset, PRInt32 aYOffset,
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
* <bold>(Probably temporary and subject to change).</bold>
|
||||
* Display an icon. x and y are in document coordinates.
|
||||
*/
|
||||
virtual void DisplayIcon(void* aDisplayContext,
|
||||
NS_IMETHOD DisplayIcon(void* aDisplayContext,
|
||||
PRInt32 aX, PRInt32 aY, PRUint32 aIconNumber)=0;
|
||||
|
||||
/**
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
* This method should fill in the targets of the width and
|
||||
* height pointers to indicate icon dimensions
|
||||
*/
|
||||
virtual void GetIconDimensions(void* aDisplayContext,
|
||||
NS_IMETHOD GetIconDimensions(void* aDisplayContext,
|
||||
PRInt32 *aWidthPtr, PRInt32 *aHeightPtr,
|
||||
PRUint32 aIconNumber)=0;
|
||||
};
|
||||
|
|
|
@ -21,12 +21,13 @@
|
|||
Includes dithering for B&W displays, but not dithering
|
||||
for PseudoColor displays which can be found in dither.c.
|
||||
|
||||
$Id: color.cpp,v 3.11 1999/06/09 12:12:03 Jerry.Kirk%Nexwarecorp.com Exp $
|
||||
$Id: color.cpp,v 3.12 1999/10/21 22:16:03 pnunn%netscape.com Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include "if.h"
|
||||
#include "nsQuickSort.h"
|
||||
#include "xp_mcom.h" //for XP_RANDOM
|
||||
|
||||
#ifdef PROFILE
|
||||
#pragma profile on
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "jpeglib.h"
|
||||
#include "jerror.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
/* cope with brain-damaged compilers that don't make sizeof return a size_t */
|
||||
#ifdef SIZEOF
|
||||
|
@ -80,7 +81,7 @@ il_setup_quantize(void)
|
|||
the_sample_range_limit = table;
|
||||
|
||||
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
|
||||
XP_BZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||
nsCRT::zero(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE));
|
||||
|
||||
/* Main part of "simple" table: limit[x] = x */
|
||||
for (i = 0; i <= MAXJSAMPLE; i++)
|
||||
|
@ -93,9 +94,9 @@ il_setup_quantize(void)
|
|||
table[i] = MAXJSAMPLE;
|
||||
|
||||
/* Second half of post-IDCT table */
|
||||
XP_BZERO(table + (2 * (MAXJSAMPLE+1)),
|
||||
nsCRT::zero(table + (2 * (MAXJSAMPLE+1)),
|
||||
(2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE));
|
||||
XP_MEMCPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
|
||||
nsCRT::memcpy(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
|
||||
the_sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE));
|
||||
|
||||
return TRUE;
|
||||
|
@ -230,7 +231,7 @@ il_quantize_fs_dither(il_container *ic, const uint8 *mask,
|
|||
for (col = width; col > 0; col--)
|
||||
*output_ptr++ &= ~*maskp++;
|
||||
} else {
|
||||
XP_BZERO((void XP_HUGE *) output_buf,
|
||||
nsCRT::zero((void XP_HUGE *) output_buf,
|
||||
(size_t) (width * SIZEOF(JSAMPLE)));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,11 @@
|
|||
#include "nsIImgDecoder.h"
|
||||
#include "nsImgDCallbk.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "xpcompat.h"
|
||||
#include "xpcompat.h" //temporary, for timers
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "prprf.h"
|
||||
|
||||
//#include "il_strm.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
@ -203,9 +202,9 @@ il_description_notify(il_container *ic)
|
|||
IL_ImageReq *image_req;
|
||||
NI_PixmapHeader *img_header = &ic->image->header;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
XP_SPRINTF(buf, XP_GetString(XP_MSG_IMAGE_PIXELS), ic->type,
|
||||
PR_snprintf(buf, sizeof(buf), XP_GetString(XP_MSG_IMAGE_PIXELS), ic->type,
|
||||
img_header->width, img_header->height);
|
||||
|
||||
PR_ASSERT(ic->clients);
|
||||
|
@ -226,7 +225,7 @@ il_dimensions_notify(il_container *ic, int dest_width, int dest_height)
|
|||
IL_MessageData message_data;
|
||||
IL_ImageReq *image_req;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
PR_ASSERT(ic->clients);
|
||||
for (image_req = ic->clients; image_req; image_req = image_req->next) {
|
||||
|
@ -244,7 +243,7 @@ il_transparent_notify(il_container *ic)
|
|||
IL_MessageData message_data;
|
||||
IL_ImageReq *image_req;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
PR_ASSERT(ic->clients);
|
||||
for (image_req = ic->clients; image_req; image_req = image_req->next) {
|
||||
|
@ -262,7 +261,7 @@ il_pixmap_update_notify(il_container *ic)
|
|||
IL_Rect *update_rect = &message_data.update_rect;
|
||||
IL_ImageReq *image_req;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
update_rect->x_origin = 0;
|
||||
update_rect->y_origin = (uint16)ic->update_start_row;
|
||||
|
@ -289,7 +288,7 @@ il_image_complete_notify(il_container *ic)
|
|||
IL_MessageData message_data;
|
||||
IL_ImageReq *image_req;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
for (image_req = ic->clients; image_req; image_req = image_req->next) {
|
||||
message_data.image_instance = image_req;
|
||||
|
@ -306,7 +305,7 @@ il_frame_complete_notify(il_container *ic)
|
|||
IL_MessageData message_data;
|
||||
IL_ImageReq *image_req;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
for (image_req = ic->clients; image_req; image_req = image_req->next) {
|
||||
message_data.image_instance = image_req;
|
||||
|
@ -352,7 +351,7 @@ il_progress_notify(il_container *ic)
|
|||
IL_ImageReq *image_req;
|
||||
NI_PixmapHeader *img_header = &ic->image->header;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
/* No more progress bars for GIF animations after initial load. */
|
||||
if (ic->is_looping)
|
||||
|
@ -411,7 +410,7 @@ il_cache_return_notify(IL_ImageReq *image_req)
|
|||
IL_MessageData message_data;
|
||||
il_container *ic = image_req->ic;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
message_data.image_instance = image_req;
|
||||
|
||||
/* This function should only be called if the dimensions are known. */
|
||||
|
@ -435,10 +434,10 @@ il_cache_return_notify(IL_ImageReq *image_req)
|
|||
|
||||
/* Now send observers a pixmap update notification for the displayable
|
||||
area of the image. */
|
||||
XP_BCOPY(&ic->displayable_rect, &message_data.update_rect,
|
||||
nsCRT::memmove(&message_data.update_rect, &ic->displayable_rect,
|
||||
sizeof(IL_Rect));
|
||||
XP_NotifyObservers(image_req->obs_list, IL_PIXMAP_UPDATE, &message_data);
|
||||
XP_BZERO(&message_data.update_rect, sizeof(IL_Rect));
|
||||
nsCRT::zero(&message_data.update_rect, sizeof(IL_Rect));
|
||||
|
||||
if (ic->state == IC_COMPLETE) {
|
||||
/* Send the observers a frame complete message. */
|
||||
|
@ -460,7 +459,7 @@ il_image_destroyed_notify(IL_ImageReq *image_req)
|
|||
{
|
||||
IL_MessageData message_data;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
message_data.image_instance = image_req;
|
||||
XP_NotifyObservers(image_req->obs_list, IL_IMAGE_DESTROYED, &message_data);
|
||||
|
||||
|
@ -480,7 +479,7 @@ il_icon_notify(IL_ImageReq *image_req, int icon_number,
|
|||
int icon_width, icon_height;
|
||||
IL_MessageData message_data;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_MessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_MessageData));
|
||||
|
||||
/* Obtain the dimensions of the icon. */
|
||||
img_cx->img_cb->GetIconDimensions(img_cx->dpy_cx, &icon_width,
|
||||
|
@ -508,7 +507,7 @@ il_group_notify(IL_GroupContext *img_cx, XP_ObservableMsg message)
|
|||
{
|
||||
IL_GroupMessageData message_data;
|
||||
|
||||
XP_BZERO(&message_data, sizeof(IL_GroupMessageData));
|
||||
nsCRT::zero(&message_data, sizeof(IL_GroupMessageData));
|
||||
|
||||
/* Fill in the message data and notify observers. */
|
||||
message_data.display_context = img_cx->dpy_cx;
|
||||
|
@ -548,10 +547,10 @@ il_init_image_transparent_pixel(il_container *ic)
|
|||
if (!img_trans_pixel) {
|
||||
img_trans_pixel = PR_NEWZAP(IL_IRGB);
|
||||
if (!img_trans_pixel)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
if (ic->background_color) {
|
||||
XP_MEMCPY(img_trans_pixel, ic->background_color, sizeof(IL_IRGB));
|
||||
nsCRT::memcpy(img_trans_pixel, ic->background_color, sizeof(IL_IRGB));
|
||||
}
|
||||
else {
|
||||
/* A mask will always be used if no background color was
|
||||
|
@ -561,7 +560,7 @@ il_init_image_transparent_pixel(il_container *ic)
|
|||
ic->image->header.transparent_pixel = img_trans_pixel;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* Destroy the destination image's transparent pixel. */
|
||||
|
@ -729,7 +728,7 @@ il_size(il_container *ic)
|
|||
src_header->transparent_pixel = ic->background_color;
|
||||
img_header->transparent_pixel = ic->background_color;
|
||||
|
||||
XP_MEMCPY(img_trans_pixel, ic->background_color, sizeof(IL_IRGB));
|
||||
nsCRT::memcpy(img_trans_pixel, ic->background_color, sizeof(IL_IRGB));
|
||||
*/
|
||||
}else{
|
||||
/*
|
||||
|
@ -1376,7 +1375,7 @@ il_container_complete(il_container *ic)
|
|||
/* This is a looping image whose loop count has reached zero, so
|
||||
set the container's state to indicate that it is no longer
|
||||
looping. */
|
||||
ic->is_looping = FALSE;
|
||||
ic->is_looping = PR_FALSE;
|
||||
|
||||
/* Inform the client contexts that the container has stopped
|
||||
looping. */
|
||||
|
@ -1489,7 +1488,7 @@ il_image_complete(il_container *ic)
|
|||
/* If this is the end of the first pass of the
|
||||
animation, then set the state of the container
|
||||
to indicate that we have started looping. */
|
||||
ic->is_looping = TRUE;
|
||||
ic->is_looping = PR_TRUE;
|
||||
|
||||
/* At this point the animation is considered to have
|
||||
loaded, so we need to tell the client contexts that
|
||||
|
@ -1629,7 +1628,7 @@ IL_StreamCreated(il_container *ic,
|
|||
|
||||
#ifndef M12N /* XXXM12N Fix me. */
|
||||
#ifdef XP_MAC
|
||||
ic->image->hasUniqueColormap = FALSE;
|
||||
ic->image->hasUniqueColormap = PR_FALSE;
|
||||
#endif
|
||||
#endif /* M12N */
|
||||
|
||||
|
@ -1927,7 +1926,7 @@ IL_GetImage(const char* image_url,
|
|||
/* Give the client a handle into the imagelib world. */
|
||||
image_req->ic = ic;
|
||||
|
||||
is_view_image = FALSE;
|
||||
is_view_image = PR_FALSE;
|
||||
|
||||
if (!il_add_client(img_cx, ic, image_req, is_view_image))
|
||||
{
|
||||
|
@ -2028,7 +2027,7 @@ IL_GetImage(const char* image_url,
|
|||
ic->net_cx->AddReferer(url);
|
||||
#endif
|
||||
|
||||
ic->is_looping = FALSE;
|
||||
ic->is_looping = PR_FALSE;
|
||||
ic->url = url;
|
||||
/* Record the fact that we are calling NetLib to load a URL. */
|
||||
ic->is_url_loading = PR_TRUE;
|
||||
|
@ -2108,7 +2107,7 @@ IL_InterruptContext(IL_GroupContext *img_cx)
|
|||
ic = ic_list->ic;
|
||||
for (image_req = ic->clients; image_req; image_req = image_req->next) {
|
||||
if (image_req->img_cx == img_cx) {
|
||||
image_req->stopped = TRUE;
|
||||
image_req->stopped = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2119,7 +2118,7 @@ IL_IMPLEMENT(void)
|
|||
IL_InterruptRequest(IL_ImageReq *image_req)
|
||||
{
|
||||
if (image_req != NULL) {
|
||||
image_req->stopped = TRUE;
|
||||
image_req->stopped = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2162,7 +2161,7 @@ IL_NewGroupContext(void *dpy_cx,
|
|||
img_cx->dpy_cx = dpy_cx;
|
||||
img_cx->img_cb = img_cb;
|
||||
|
||||
img_cx->progressive_display = TRUE;
|
||||
img_cx->progressive_display = PR_TRUE;
|
||||
|
||||
/* Create an observer list for the image context. */
|
||||
if (XP_NewObserverList((void *)img_cx, &img_cx->obs_list)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
/* if.h --- Top-level image library internal routines
|
||||
*
|
||||
* $Id: if.h,v 3.11 1999/10/19 21:48:03 pnunn%netscape.com Exp $
|
||||
* $Id: if.h,v 3.12 1999/10/21 22:16:45 pnunn%netscape.com Exp $
|
||||
*/
|
||||
|
||||
#ifndef _if_h
|
||||
|
@ -36,13 +36,9 @@
|
|||
#include "prtime.h"
|
||||
#include "prlong.h"
|
||||
|
||||
#include "xpcompat.h"
|
||||
|
||||
#include "ntypes.h" /* typedefs for commonly used Netscape data
|
||||
structures */
|
||||
|
||||
//#include "nsIImgDecoder.h"
|
||||
|
||||
typedef struct _IL_GroupContext IL_GroupContext;
|
||||
typedef struct _IL_ImageReq IL_ImageReq;
|
||||
typedef struct il_context_list il_context_list;
|
||||
|
@ -57,7 +53,6 @@ typedef struct il_container_struct il_container;
|
|||
#include "ilIURL.h"
|
||||
#include "ilINetReader.h"
|
||||
#include "ilIImageRenderer.h"
|
||||
//#include "nsIImgDecCB.h"
|
||||
|
||||
|
||||
#include "il.h"
|
||||
|
@ -373,13 +368,6 @@ extern void IL_StreamComplete(il_container *ic, PRBool is_multipart);
|
|||
extern void IL_NetRequestDone(il_container *ic, ilIURL *urls, int status);
|
||||
extern PRBool IL_StreamCreated(il_container *ic, ilIURL *urls, char* type);
|
||||
|
||||
#if 0
|
||||
extern int il_xbm_init(il_container *ic);
|
||||
extern int il_xbm_write(il_container *, const uint8 *, int32);
|
||||
extern void il_xbm_complete(il_container *ic);
|
||||
extern void il_xbm_abort(il_container *ic);
|
||||
#endif
|
||||
|
||||
/* Allocate and initialize the destination image's transparent_pixel with
|
||||
the Image Library's preferred transparency color i.e. the background color
|
||||
passed into IL_GetImage. The image decoder is encouraged to use this
|
||||
|
|
|
@ -19,23 +19,17 @@
|
|||
/* -*- Mode: C; tab-width: 4 -*-
|
||||
* il_util.c Colormap and colorspace utilities.
|
||||
*
|
||||
* $Id: il_util.cpp,v 3.2 1999/05/27 22:33:55 pnunn%netscape.com Exp $
|
||||
* $Id: il_util.cpp,v 3.3 1999/10/21 22:16:59 pnunn%netscape.com Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include "xpcompat.h"
|
||||
//#include "xpcompat.h"
|
||||
#include "nsCRT.h"
|
||||
#include "ntypes.h" /* typedefs for commonly used Netscape data
|
||||
structures. */
|
||||
#include "prtypes.h"
|
||||
#include "prmem.h"
|
||||
|
||||
/* mwh this is for Win 16 comipler. */
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#include "il_util.h" /* Public API. */
|
||||
#include "il_utilp.h" /* Private header file. */
|
||||
|
@ -64,7 +58,7 @@ il_NewColorCube(uint32 red_size, uint32 green_size, uint32 blue_size,
|
|||
/* Colormap size and offsets for computing the colormap indices. */
|
||||
size = base_offset + red_size * green_size * blue_size;
|
||||
if (size > CUBE_MAX_SIZE)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
red_offset = green_size * blue_size;
|
||||
green_offset = blue_size;
|
||||
|
||||
|
@ -85,15 +79,15 @@ il_NewColorCube(uint32 red_size, uint32 green_size, uint32 blue_size,
|
|||
allocate space for a full palette. */
|
||||
map = (IL_RGB *)PR_Calloc(256, sizeof(IL_RGB));
|
||||
if (!map)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
lookup_table = (uint8 *)PR_Calloc(LOOKUP_TABLE_SIZE, 1);
|
||||
if (!lookup_table)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
done = (uint8 *)PR_Calloc(size, 1);
|
||||
if (!done)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
ptr = lookup_table;
|
||||
for (i = 0; i < LOOKUP_TABLE_RED; i++)
|
||||
|
@ -296,7 +290,7 @@ IL_AddColorToColorMap(IL_ColorMap *cmap, IL_IRGB *new_color)
|
|||
IL_RGB *map_entry;
|
||||
|
||||
if (num_colors > max_colors)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
map_entry = map + num_colors;
|
||||
map_entry->red = new_color->red;
|
||||
|
@ -307,7 +301,7 @@ IL_AddColorToColorMap(IL_ColorMap *cmap, IL_IRGB *new_color)
|
|||
|
||||
cmap->num_colors++;
|
||||
|
||||
return TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* Free all memory associated with a given colormap.
|
||||
|
@ -352,7 +346,7 @@ IL_CreateTrueColorSpace(IL_RGBBits *rgb, uint8 pixmap_depth)
|
|||
color_space->type = NI_TrueColor;
|
||||
|
||||
/* RGB bit allocation and offsets. */
|
||||
XP_MEMCPY(&color_space->bit_alloc.rgb, rgb, sizeof(IL_RGBBits));
|
||||
nsCRT::memcpy(&color_space->bit_alloc.rgb, rgb, sizeof(IL_RGBBits));
|
||||
|
||||
color_space->pixmap_depth = pixmap_depth; /* Destination image depth. */
|
||||
|
||||
|
@ -394,7 +388,7 @@ IL_CreatePseudoColorSpace(IL_ColorMap *cmap, uint8 index_depth,
|
|||
|
||||
/* Copy the contents of the IL_ColorMap structure. This copies the map
|
||||
and table pointers, not the arrays themselves. */
|
||||
XP_MEMCPY(&color_space->cmap, cmap, sizeof(IL_ColorMap));
|
||||
nsCRT::memcpy(&color_space->cmap, cmap, sizeof(IL_ColorMap));
|
||||
PR_FREEIF(cmap);
|
||||
|
||||
/* Create the private part of the color_space */
|
||||
|
|
|
@ -20,50 +20,19 @@
|
|||
* ilclient.c --- Management of imagelib client data structures,
|
||||
* including image cache.
|
||||
*
|
||||
* $Id: ilclient.cpp,v 3.13 1999/10/13 00:41:43 beard%netscape.com Exp $
|
||||
* $Id: ilclient.cpp,v 3.14 1999/10/21 22:17:16 pnunn%netscape.com Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include "if.h"
|
||||
#include "il_strm.h" /* For OPAQUE_CONTEXT. */
|
||||
#include "nsIImgDecoder.h"
|
||||
#include "nsImgDCallbk.h"
|
||||
#include "ilISystemServices.h"
|
||||
#include "nsIFactory.h"
|
||||
|
||||
/* for XP_GetString() */
|
||||
#include "xpgetstr.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
extern int MK_OUT_OF_MEMORY;
|
||||
extern int XP_MSG_IMAGE_NOT_FOUND;
|
||||
extern int XP_MSG_XBIT_COLOR;
|
||||
extern int XP_MSG_1BIT_MONO;
|
||||
extern int XP_MSG_XBIT_GREYSCALE;
|
||||
extern int XP_MSG_XBIT_RGB;
|
||||
extern int XP_MSG_DECODED_SIZE;
|
||||
extern int XP_MSG_WIDTH_HEIGHT;
|
||||
extern int XP_MSG_SCALED_FROM;
|
||||
extern int XP_MSG_IMAGE_DIM;
|
||||
extern int XP_MSG_COLOR;
|
||||
extern int XP_MSG_NB_COLORS;
|
||||
extern int XP_MSG_NONE;
|
||||
extern int XP_MSG_COLORMAP;
|
||||
extern int XP_MSG_BCKDRP_VISIBLE;
|
||||
extern int XP_MSG_SOLID_BKGND;
|
||||
extern int XP_MSG_JUST_NO;
|
||||
extern int XP_MSG_TRANSPARENCY;
|
||||
extern int XP_MSG_COMMENT;
|
||||
extern int XP_MSG_UNKNOWN;
|
||||
extern int XP_MSG_COMPRESS_REMOVE;
|
||||
PR_END_EXTERN_C
|
||||
#include "nsCRT.h"
|
||||
|
||||
static uint32 image_cache_size;
|
||||
|
||||
#ifndef M12N /* XXXM12N Cache trace: cleanup/eliminate. */
|
||||
static int il_cache_trace = FALSE; /* XXXM12N Clean up/eliminate */
|
||||
#endif
|
||||
|
||||
PRLogModuleInfo *il_log_module = NULL;
|
||||
ilISystemServices *il_ss = NULL;
|
||||
|
||||
|
@ -328,7 +297,7 @@ il_image_match(il_container *ic, /* Candidate for match. */
|
|||
/* Request dimensions zero, cache entry has natural dimensions. */
|
||||
(!req_width && !req_height && ic->natural_size)
|
||||
))
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
/* We allow any depth image through as the FE may have asked us to
|
||||
decode to a colorspace other than the display colorspace. */
|
||||
|
@ -342,16 +311,16 @@ il_image_match(il_container *ic, /* Candidate for match. */
|
|||
/* Both request and candidate have a background color; check
|
||||
whether they match. */
|
||||
if (background_color->red != ic->background_color->red)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
if (background_color->green != ic->background_color->green)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
if (background_color->blue != ic->background_color->blue)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
/* A background color was requested, but the candidate does
|
||||
not have one. */
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
else { /* No background color was requested. */
|
||||
|
@ -359,7 +328,7 @@ il_image_match(il_container *ic, /* Candidate for match. */
|
|||
/* A background color was not requested, but the candidate
|
||||
has one. This means that while the current request may
|
||||
need a mask, the candidate definitely does not have one. */
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
}
|
||||
else {
|
||||
/* Neither the request nor the candidate have a background
|
||||
|
@ -370,27 +339,27 @@ il_image_match(il_container *ic, /* Candidate for match. */
|
|||
|
||||
/* Check the url (we have already checked the hash value which is based
|
||||
on the url.) */
|
||||
if (strcmp(image_url, ic->url_address))
|
||||
return FALSE;
|
||||
if (nsCRT::strcmp(image_url, ic->url_address))
|
||||
return PR_FALSE;
|
||||
|
||||
/* Printer contexts and window contexts may have different
|
||||
native image formats, so don't reuse an image cache entry
|
||||
created for an onscreen context in a printer context or
|
||||
vice-versa. */
|
||||
if (display_type != ic->display_type)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
|
||||
if((ic->display_type==IL_Printer) &&
|
||||
(ic->dest_width != ic->image->header.width) &&
|
||||
(ic->dest_height != ic->image->header.height ))
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
/* XXX - temporary */
|
||||
if (ic->rendered_with_custom_palette)
|
||||
return FALSE;
|
||||
return PR_FALSE;
|
||||
|
||||
return TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -541,7 +510,7 @@ il_get_container(IL_GroupContext *img_cx,
|
|||
PR_FREEIF(ic);
|
||||
return NULL;
|
||||
}
|
||||
XP_MEMCPY(ic->background_color, background_color, sizeof(IL_IRGB));
|
||||
nsCRT::memcpy(ic->background_color, background_color, sizeof(IL_IRGB));
|
||||
}
|
||||
else {
|
||||
ic->background_color = NULL;
|
||||
|
@ -551,7 +520,7 @@ il_get_container(IL_GroupContext *img_cx,
|
|||
|
||||
ic->hash = hash;
|
||||
ic->urlhash = urlhash;
|
||||
ic->url_address = PL_strdup(image_url);
|
||||
ic->url_address = nsCRT::strdup(image_url);
|
||||
ic->is_url_loading = PR_FALSE;
|
||||
ic->dest_width = req_width;
|
||||
ic->dest_height = req_height;
|
||||
|
@ -573,15 +542,23 @@ il_get_container(IL_GroupContext *img_cx,
|
|||
/* callbacks for the image decoders */
|
||||
ImgDCallbk* imgdcb = new ImgDCallbk(ic);
|
||||
if (!imgdcb) {
|
||||
// XXX this leaks the ic and various parts
|
||||
// XXX factor out cleanup logic
|
||||
|
||||
PR_FREEIF(ic->image);
|
||||
IL_ReleaseColorSpace(ic->src_header->color_space);
|
||||
IL_ReleaseColorSpace(ic->image->header.color_space);
|
||||
PR_FREEIF(ic->src_header);
|
||||
PR_FREEIF(ic);
|
||||
return NULL;
|
||||
}
|
||||
nsresult res = imgdcb->QueryInterface(kIImgDCallbkIID, (void**)&imgdcb);
|
||||
if (NS_FAILED(res)) {
|
||||
delete imgdcb;
|
||||
// XXX this leaks the ic!!!
|
||||
// XXX factor out cleanup logic
|
||||
|
||||
PR_FREEIF(ic->image);
|
||||
IL_ReleaseColorSpace(ic->src_header->color_space);
|
||||
IL_ReleaseColorSpace(ic->image->header.color_space);
|
||||
PR_FREEIF(ic->src_header);
|
||||
PR_FREEIF(ic);
|
||||
return NULL;
|
||||
}
|
||||
imgdcb->SetContainer(ic);
|
||||
|
@ -589,7 +566,7 @@ il_get_container(IL_GroupContext *img_cx,
|
|||
}
|
||||
|
||||
il_addtocache(ic);
|
||||
ic->is_in_use = TRUE;
|
||||
ic->is_in_use = PR_TRUE;
|
||||
|
||||
return ic;
|
||||
}
|
||||
|
@ -608,9 +585,9 @@ il_scour_container(il_container *ic)
|
|||
NS_RELEASE(ic->net_cx);
|
||||
ic->net_cx = NULL;
|
||||
|
||||
ic->forced = FALSE;
|
||||
ic->forced = PR_FALSE;
|
||||
|
||||
ic->is_alone = FALSE;
|
||||
ic->is_alone = PR_FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -646,7 +623,7 @@ il_delete_container(il_container *ic)
|
|||
PR_FREEIF(ic->src_header->transparent_pixel);
|
||||
IL_ReleaseColorSpace(ic->src_header->color_space);
|
||||
PR_FREEIF(ic->src_header);
|
||||
|
||||
|
||||
/* delete the image */
|
||||
if (!(ic->image || ic->mask)) {
|
||||
#ifdef DEBUG_kipp
|
||||
|
@ -671,7 +648,7 @@ il_delete_container(il_container *ic)
|
|||
}
|
||||
|
||||
FREE_IF_NOT_NULL(ic->comment);
|
||||
FREE_IF_NOT_NULL(ic->url_address);
|
||||
nsCRT::free(ic->url_address);
|
||||
FREE_IF_NOT_NULL(ic->fetch_url);
|
||||
|
||||
PR_FREEIF(ic);
|
||||
|
@ -697,179 +674,6 @@ il_destroy_pixmap(ilIImageRenderer *img_cb, IL_Pixmap *pixmap)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static char *
|
||||
il_visual_info(il_container *ic)
|
||||
{
|
||||
char *msg = (char *)PR_Calloc(1, 50);
|
||||
NI_PixmapHeader *img_header = &ic->image->header;
|
||||
|
||||
if (!msg)
|
||||
return NULL;
|
||||
|
||||
switch (img_header->color_space->type)
|
||||
{
|
||||
case NI_PseudoColor:
|
||||
XP_SPRINTF(msg, XP_GetString(XP_MSG_XBIT_COLOR),
|
||||
img_header->color_space->pixmap_depth); /* #### i18n */
|
||||
break;
|
||||
|
||||
case NI_GreyScale:
|
||||
if (img_header->color_space->pixmap_depth == 1)
|
||||
XP_SPRINTF(msg, XP_GetString(XP_MSG_1BIT_MONO)); /* #### i18n */
|
||||
else
|
||||
XP_SPRINTF(msg, XP_GetString(XP_MSG_XBIT_GREYSCALE),
|
||||
img_header->color_space->pixmap_depth);
|
||||
/* #### i18n */
|
||||
break;
|
||||
|
||||
case NI_TrueColor:
|
||||
XP_SPRINTF(msg, XP_GetString(XP_MSG_XBIT_RGB),
|
||||
img_header->color_space->pixmap_depth); /* #### i18n */
|
||||
break;
|
||||
|
||||
default:
|
||||
PR_ASSERT(0);
|
||||
*msg=0;
|
||||
break;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
/* Define some macros to help us output HTML */
|
||||
#define CELL_TOP \
|
||||
StrAllocCat(output, \
|
||||
"<TR><TD VALIGN=BASELINE ALIGN=RIGHT><B>");
|
||||
#define CELL_TITLE(title) \
|
||||
StrAllocCat(output, title);
|
||||
#define CELL_MIDDLE \
|
||||
StrAllocCat(output, \
|
||||
"</B></TD>" \
|
||||
"<TD>");
|
||||
#define CELL_BODY(body) \
|
||||
StrAllocCat(output, body);
|
||||
#define CELL_END \
|
||||
StrAllocCat(output, \
|
||||
"</TD></TR>");
|
||||
#define ADD_CELL(c_title, c_body) \
|
||||
CELL_TOP; \
|
||||
CELL_TITLE(c_title); \
|
||||
CELL_MIDDLE; \
|
||||
CELL_BODY(c_body); \
|
||||
CELL_END;
|
||||
|
||||
static char *
|
||||
il_HTML_image_info(il_container *ic, int long_form, int show_comment)
|
||||
{
|
||||
char tmpbuf[512]; /* Temporary consing area */
|
||||
char *output = NULL;
|
||||
NI_PixmapHeader *src_header = ic->src_header; /* Source image header. */
|
||||
NI_PixmapHeader *img_header = &ic->image->header; /* Destination image
|
||||
header. */
|
||||
NI_IRGB *img_trans_pixel = img_header->transparent_pixel;
|
||||
|
||||
XP_SPRINTF(tmpbuf, "%lu", (long)img_header->widthBytes *
|
||||
img_header->height + sizeof(il_container));
|
||||
ADD_CELL(XP_GetString(XP_MSG_DECODED_SIZE), tmpbuf); /* #### i18n */
|
||||
|
||||
/* #### i18n */
|
||||
#ifdef XP_WIN16
|
||||
XP_SPRINTF(tmpbuf, XP_GetString(XP_MSG_WIDTH_HEIGHT), (short)img_header->width,
|
||||
(short)img_header->height);
|
||||
#else
|
||||
XP_SPRINTF(tmpbuf, XP_GetString(XP_MSG_WIDTH_HEIGHT), img_header->width,
|
||||
img_header->height);
|
||||
#endif
|
||||
if ((img_header->width != src_header->width) ||
|
||||
(img_header->height != src_header->height))
|
||||
{
|
||||
/* #### i18n */
|
||||
XP_SPRINTF(tmpbuf + strlen(tmpbuf), XP_GetString(XP_MSG_SCALED_FROM),
|
||||
src_header->width, src_header->height);
|
||||
}
|
||||
/* #### i18n */
|
||||
ADD_CELL(XP_GetString(XP_MSG_IMAGE_DIM), tmpbuf);
|
||||
|
||||
if (long_form) {
|
||||
|
||||
char *visual_info = il_visual_info(ic);
|
||||
if (visual_info) {
|
||||
ADD_CELL(XP_GetString(XP_MSG_COLOR), visual_info);
|
||||
/* #### i18n */
|
||||
PR_FREEIF(visual_info);
|
||||
}
|
||||
|
||||
if (img_header->color_space->cmap.map)
|
||||
XP_SPRINTF(tmpbuf, XP_GetString(XP_MSG_NB_COLORS),
|
||||
img_header->color_space->cmap.num_colors);
|
||||
/* #### i18n */
|
||||
else
|
||||
XP_SPRINTF(tmpbuf, XP_GetString(XP_MSG_NONE)); /* #### i18n */
|
||||
ADD_CELL(XP_GetString(XP_MSG_COLORMAP), tmpbuf);
|
||||
|
||||
if (img_trans_pixel) {
|
||||
if (ic->mask)
|
||||
XP_SPRINTF(tmpbuf,
|
||||
/* #### i18n */
|
||||
XP_GetString(XP_MSG_BCKDRP_VISIBLE));
|
||||
else
|
||||
XP_SPRINTF(tmpbuf,
|
||||
/* #### i18n */
|
||||
XP_GetString(XP_MSG_SOLID_BKGND),
|
||||
img_trans_pixel->red,
|
||||
img_trans_pixel->green,
|
||||
img_trans_pixel->blue);
|
||||
} else {
|
||||
XP_SPRINTF(tmpbuf, XP_GetString(XP_MSG_JUST_NO)); /* #### i18n */
|
||||
}
|
||||
ADD_CELL(XP_GetString(XP_MSG_TRANSPARENCY), tmpbuf); /* #### i18n */
|
||||
}
|
||||
|
||||
if (show_comment && ic->comment) {
|
||||
XP_SPRINTF(tmpbuf, "%.500s", ic->comment);
|
||||
ADD_CELL(XP_GetString(XP_MSG_COMMENT), tmpbuf); /* #### i18n */
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
IL_IMPLEMENT(char *)
|
||||
IL_HTMLImageInfo(char *url_address)
|
||||
{
|
||||
il_container *ic;
|
||||
char *output = NULL;
|
||||
char *il_msg;
|
||||
|
||||
for (ic=il_cache.head; ic; ic=ic->next)
|
||||
{
|
||||
if (!strcmp(ic->url_address, url_address))
|
||||
break;
|
||||
}
|
||||
|
||||
if ((ic == NULL) || (ic->state != IC_COMPLETE))
|
||||
return NULL;
|
||||
|
||||
il_msg = il_HTML_image_info(ic, TRUE, TRUE);
|
||||
if (il_msg == NULL)
|
||||
return NULL;
|
||||
|
||||
StrAllocCat(output,
|
||||
"<TABLE CELLSPACING=0 CELLPADDING=1 "
|
||||
"BORDER=0 ALIGN=LEFT WIDTH=66%>");
|
||||
StrAllocCat(output, il_msg);
|
||||
StrAllocCat(output, "</TABLE> <A HREF=\"");
|
||||
StrAllocCat(output, url_address);
|
||||
StrAllocCat(output, "\"> <IMG WIDTH=90% ALIGN=CENTER SRC=\"");
|
||||
StrAllocCat(output, url_address);
|
||||
StrAllocCat(output, "\"></A>\n");
|
||||
|
||||
PR_FREEIF(il_msg);
|
||||
|
||||
return output;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
il_container *
|
||||
il_removefromcache(il_container *ic)
|
||||
|
@ -1081,16 +885,16 @@ il_add_client(IL_GroupContext *img_cx, il_container *ic,
|
|||
|
||||
/* Now add the client context to the container's client context list,
|
||||
(if necessary,) and also add the container to the context's list of
|
||||
containers. Note: a FALSE return value could mean that the context
|
||||
containers. Note: a PR_FALSE return value could mean that the context
|
||||
did not need to be added. */
|
||||
added_context = il_add_client_context(img_cx, ic);
|
||||
|
||||
/* Always return TRUE. */
|
||||
/* Always return PR_TRUE. */
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* Delete an IL_ImageReq from the list of clients for an image container.
|
||||
Return TRUE if successful, FALSE otherwise. */
|
||||
Return PR_TRUE if successful, PR_FALSE otherwise. */
|
||||
PRBool
|
||||
il_delete_client(il_container *ic, IL_ImageReq *image_req)
|
||||
{
|
||||
|
@ -1108,7 +912,7 @@ il_delete_client(il_container *ic, IL_ImageReq *image_req)
|
|||
current_req = current_req->next;
|
||||
}
|
||||
|
||||
/* If the image request wasn't found in the client list, return FALSE. */
|
||||
/* If the image request wasn't found in the client list, return PR_FALSE. */
|
||||
if (!current_req)
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -1195,7 +999,7 @@ IL_Init(ilISystemServices *ss)
|
|||
il_ss = ss;
|
||||
|
||||
/* XXXM12N - finish me. */
|
||||
return TRUE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1310,7 +1114,7 @@ IL_DestroyImage(IL_ImageReq *image_req)
|
|||
}
|
||||
}
|
||||
|
||||
ic->is_in_use = FALSE;
|
||||
ic->is_in_use = PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "il.h" /* Image library external API */
|
||||
|
||||
#include "nsCRT.h"
|
||||
#include "xpcompat.h" //temporary, for timers
|
||||
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -943,7 +944,7 @@ il_emit_row(
|
|||
return ;
|
||||
}
|
||||
il_scale_alpha8( alphabitstart, len, scalemask, column_count);
|
||||
XP_MEMCPY(alphabitstart, scalemask, column_count);
|
||||
nsCRT::memcpy(alphabitstart, scalemask, column_count);
|
||||
PR_Free(scalemask);
|
||||
}
|
||||
|
||||
|
@ -972,7 +973,7 @@ il_emit_row(
|
|||
if (nsCRT::strncasecmp(ic->type, "image/art",9)==0){
|
||||
/* No scaling needed*/
|
||||
if (len == column_count)
|
||||
XP_MEMCPY(maskp, cbuf, mask_header->widthBytes);
|
||||
nsCRT::memcpy(maskp, cbuf, mask_header->widthBytes);
|
||||
else /* Scale */
|
||||
il_scale_mask(cbuf, (int)len,
|
||||
dcolumn_start,
|
||||
|
@ -1224,13 +1225,13 @@ il_emit_row(
|
|||
il_overlay(out + offset, dp + offset, byte_mask, column_count,
|
||||
(img_color_space->pixmap_depth/8));
|
||||
else
|
||||
XP_MEMCPY(dp + offset, out + offset,
|
||||
nsCRT::memcpy(dp + offset, out + offset,
|
||||
(img_color_space->pixmap_depth/8) * column_count);
|
||||
}
|
||||
|
||||
/* Duplicate the mask also. */
|
||||
if (maskp) {
|
||||
XP_MEMCPY(mp, maskp, mask_header->widthBytes);
|
||||
nsCRT::memcpy(mp, maskp, mask_header->widthBytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
#include "ilISystemServices.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
extern ilISystemServices *il_ss;
|
||||
|
||||
|
@ -166,7 +167,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMMOVE (*destination + destination_length, source, source_length);
|
||||
nsCRT::memmove(*destination + destination_length, source, source_length);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -175,7 +176,7 @@ NET_BACat (char **destination,
|
|||
if (*destination == NULL)
|
||||
return(NULL);
|
||||
|
||||
XP_MEMCPY(*destination, source, source_length);
|
||||
nsCRT::memcpy(*destination, source, source_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,51 +50,6 @@
|
|||
|
||||
#define XP_HUGE_CHAR_PTR char XP_HUGE *
|
||||
|
||||
/*
|
||||
* These will be replaced with their PL_ equivalents.
|
||||
*/
|
||||
#define XP_MEMCPY(d, s, n) memcpy((d), (s), (n))
|
||||
|
||||
/* NOTE: XP_MEMMOVE gurantees that overlaps will be properly handled */
|
||||
#ifdef SUNOS4
|
||||
#define XP_MEMMOVE(Dest,Src,Len) bcopy((Src),(Dest),(Len))
|
||||
#else
|
||||
#define XP_MEMMOVE(Dest,Src,Len) memmove((Dest),(Src),(Len))
|
||||
#endif /* SUNOS4 */
|
||||
|
||||
#define XP_MEMSET memset
|
||||
#define XP_BZERO(a,b) memset(a,0,b)
|
||||
|
||||
/* NOTE: XP_BCOPY gurantees that overlaps will be properly handled */
|
||||
#ifdef XP_WIN16
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
extern void WIN16_bcopy(char *, char *, unsigned long);
|
||||
XP_END_PROTOS
|
||||
|
||||
#define XP_BCOPY(PTR_FROM, PTR_TO, LEN) \
|
||||
(WIN16_bcopy((char *) (PTR_FROM), (char *)(PTR_TO), (LEN)))
|
||||
|
||||
#else
|
||||
|
||||
#define XP_BCOPY(Src,Dest,Len) XP_MEMMOVE((Dest),(Src),(Len))
|
||||
|
||||
#endif /* XP_WIN16 */
|
||||
|
||||
#define XP_SPRINTF sprintf
|
||||
#define XP_SAFE_SPRINTF PR_snprintf
|
||||
#define XP_MEMCMP memcmp
|
||||
#define XP_VSPRINTF vsprintf
|
||||
|
||||
#if !defined(XP_RANDOM) || !defined(XP_SRANDOM) /* defined in both xp_mcom.h and xp_str.h */
|
||||
#if defined(HAVE_RANDOM) && !defined(__QNX__) /* QNX 4.24 _has_ random, but no prototype */
|
||||
#define XP_RANDOM random
|
||||
#define XP_SRANDOM(seed) srandom((seed))
|
||||
#else
|
||||
#define XP_RANDOM rand
|
||||
#define XP_SRANDOM(seed) srand((seed))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef void
|
||||
(*TimeoutCallbackFunction) (void * closure);
|
||||
|
@ -123,13 +78,8 @@ extern void XP_QSORT(void *, size_t, size_t,
|
|||
extern char * NET_BACopy (char **dest, const char *src, size_t src_length);
|
||||
extern char * NET_BACat (char **dest, size_t dest_length, const char *src, size_t src_length);
|
||||
|
||||
/*
|
||||
* Malloc'd string manipulation
|
||||
*
|
||||
* notice that they are dereferenced by the define!
|
||||
*/
|
||||
#define StrAllocCopy(dest, src) NET_SACopy (&(dest), src)
|
||||
#define StrAllocCat(dest, src) NET_SACat (&(dest), src)
|
||||
|
||||
|
||||
extern char * NET_SACopy (char **dest, const char *src);
|
||||
extern char * NET_SACat (char **dest, const char *src);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче