removing libimg

This commit is contained in:
pavlov%netscape.com 2001-06-19 08:47:13 +00:00
parent cfa0ec9b73
commit c3257cb477
72 changed files with 10 additions and 6995 deletions

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,51 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = nsgif
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
REQUIRES = xpcom string img layout locale util unicharutil
CPPSRCS = \
gif.cpp \
nsGIFModule.cpp \
nsGIFDecoder.cpp \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)
EXTRA_LIBS = $(NSPR_LIBS)
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS)
ifndef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
endif
include $(topsrcdir)/config/rules.mk

File diff suppressed because it is too large Load Diff

View File

@ -1,31 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* gif.h */
extern PRBool il_gif_init(il_container *ic);
extern int il_gif_write(il_container *, const PRUint8 *, int32);
extern void il_gif_complete(il_container *ic);
extern PRUint8 il_gif_write_ready(il_container *ic);
extern void il_gif_abort(il_container *ic);
extern void gif_delay_time_callback(void *closure);

View File

@ -1,98 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#------------------------------------------------------------------------
#
# Makefile to build the IMGLIB LIB
#
#------------------------------------------------------------------------
!ifdef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
!endif
LIBRARY_NAME = nsgif
#
# Make sure we have MOZILLA_CLIENT defined so we get the
# proper JS includes
#
LCFLAGS = $(LCFLAGS) -DMOZILLA_CLIENT
!ifdef BUILD_DEBUG_GC
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
!endif
LCFLAGS = $(LCFLAGS) /TP
LLIBS= $(LIBNSPR) \
$(DIST)\lib\util.lib \
$(DIST)\lib\xpcom.lib \
!ifdef NU_CACHE
$(DIST)\lib\cache.lib \
!endif
$(NULL)
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
MAKE_OBJ_TYPE=DLL
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=nsgif
DLL1NAME=nsgif
PDBFILE=$(DLLNAME).pdb
MAPFILE=$(DLLNAME).map
DEFFILE=nsgif.def
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MAPFILE= $(DLLNAME).map
MODULE=img
DEPTH=..\..\..
LINCS=-I$(DEPTH)/dist/public/xpcom -I. -I$(DEPTH)/dist/public/raptor
CPPSRCS= nsGIFModule.cpp nsGIFDecoder.cpp gif.cpp
CPP_OBJS= .\$(OBJDIR)\nsGIFModule.obj .\$(OBJDIR)\nsGIFDecoder.obj \
.\$(OBJDIR)\gif.obj
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib

View File

@ -1,128 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* nsGIFDecoder.cpp --- interface to gif decoder
*/
#include "nsGIFDecoder.h"
#include "nsCOMPtr.h"
//////////////////////////////////////////////////////////////////////
// GIF Decoder Implementation
NS_IMPL_ISUPPORTS1(GIFDecoder, nsIImgDecoder);
GIFDecoder::GIFDecoder(il_container* aContainer)
{
NS_INIT_REFCNT();
ilContainer = aContainer;
}
GIFDecoder::~GIFDecoder(void)
{
}
NS_METHOD
GIFDecoder::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
if (aOuter) return NS_ERROR_NO_AGGREGATION;
il_container *ic = new il_container();
if (!ic) return NS_ERROR_OUT_OF_MEMORY;
GIFDecoder *decoder = new GIFDecoder(ic);
if (!decoder) {
delete ic;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(decoder);
rv = decoder->QueryInterface(aIID, aResult);
NS_RELEASE(decoder);
/* why are we creating and destroying this object for no reason? */
delete ic; /* is a place holder */
return rv;
}
NS_IMETHODIMP
GIFDecoder::ImgDInit()
{
PRBool ret=PR_FALSE;
if(ilContainer != NULL) {
ret=il_gif_init(ilContainer);
}
if(ret)
return NS_OK;
else
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
GIFDecoder::ImgDWriteReady(PRUint32 *max_read)
{
if(ilContainer != NULL) {
*max_read = il_gif_write_ready(ilContainer);
}
return NS_OK;
}
NS_IMETHODIMP
GIFDecoder::ImgDWrite(const unsigned char *buf, int32 len)
{
int ret = 0;
if( ilContainer != NULL ) {
ret = il_gif_write(ilContainer, buf,len);
if(ret != 0)
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
GIFDecoder::ImgDComplete()
{
if( ilContainer != NULL ) {
il_gif_complete(ilContainer);
}
return NS_OK;
}
NS_IMETHODIMP
GIFDecoder::ImgDAbort()
{
if( ilContainer != NULL ) {
il_gif_abort(ilContainer);
}
return NS_OK;
}

View File

@ -1,66 +0,0 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* -*- Mode: C; tab-width: 4 -*-
* nsGIFDecoder.cpp --- interface to gif decoder
*/
#ifndef _nsGIFDec_h
#define _nsGIFDec_h
#include "nsISupports.h"
#include "nsIImgDecoder.h"
#include "gif.h"
#define NS_GIFDECODER_CID \
{ 0x0d471b70, 0xbaf5, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
//////////////////////////////////////////////////////////////////////
// GIF Decoder Definition
class GIFDecoder : public nsIImgDecoder
{
public:
GIFDecoder(il_container* aContainer);
virtual ~GIFDecoder();
NS_DECL_ISUPPORTS
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
/* stream */
NS_IMETHOD ImgDInit();
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read);
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len);
NS_IMETHOD ImgDComplete();
NS_IMETHOD ImgDAbort();
NS_IMETHOD_(il_container *) SetContainer(il_container *ic){ilContainer = ic; return ic;}
NS_IMETHOD_(il_container *) GetContainer() {return ilContainer;}
private:
il_container* ilContainer;
};
#endif

View File

@ -1,40 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsGIFDecoder.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
static NS_DEFINE_CID(kGIFDecoderCID, NS_GIFDECODER_CID);
static nsModuleComponentInfo components[] =
{
{ "GIF Decoder",
NS_GIFDECODER_CID,
"@mozilla.org/image/decoder;1?type=image/gif",
GIFDecoder::Create }
};
NS_IMPL_NSGETMODULE(nsGIFModule, components)

View File

@ -1,14 +0,0 @@
;
; temp def file for nsgif dll
;
LIBRARY nsgif.dll
DESCRIPTION 'test dll'
EXPORTS
ImgDInit @1002 PRIVATE
ImgDWrite @1003 PRIVATE
ImgDWriteReady @1004 PRIVATE
ImgDComplete @1005 PRIVATE
ImgDAbort @1006 PRIVATE

View File

@ -1,21 +0,0 @@
?il_gif_write@@YAHPAUil_container_struct@@PBEJ@Z ; 43937
?il_BACat@@YAPADPAPADIPBDI@Z ; 42718
?gif_delay_time_callback@@YAXPAX@Z ; 41012
?ImgDWrite@GIFDecoder@@UAGIPBEJ@Z ; 2925
?il_gif_write_ready@@YAEPAUil_container_struct@@@Z ; 2820
?ImgDWriteReady@GIFDecoder@@UAGIPAI@Z ; 2820
?AddRef@GIFDecoder@@UAGKXZ ; 2814
?Release@GIFDecoder@@UAGKXZ ; 2776
?il_gif_abort@@YAXPAUil_container_struct@@@Z ; 1486
?SetContainer@GIFDecoder@@UAGPAUil_container_struct@@PAU2@@Z ; 1474
?QueryInterface@GIFDecoder@@UAGIABUnsID@@PAPAX@Z ; 1407
??0GIFDecoder@@QAE@PAUil_container_struct@@@Z ; 1407
?ImgDComplete@GIFDecoder@@UAGIXZ ; 1407
?ImgDInit@GIFDecoder@@UAGIXZ ; 1407
?il_gif_init@@YAHPAUil_container_struct@@@Z ; 1407
?Create@GIFDecoder@@SGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1407
?il_gif_complete@@YAXPAUil_container_struct@@@Z ; 1407
??1GIFDecoder@@UAE@XZ ; 1369
??_GGIFDecoder@@UAEPAXI@Z ; 1369
?ImgDAbort@GIFDecoder@@UAGIXZ ; 136
_NSGetModule ; 1

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,61 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = nsjpg
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
REQUIRES = xpcom string img util layout locale jpeg unicharutil
CPPSRCS = \
jpeg.cpp \
nsJPGDecoder.cpp \
nsJPGModule.cpp \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)
EXTRA_DSO_LDOPTS = $(JPEG_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
EXTRA_LIBS = $(NSPR_LIBS)
ifndef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
endif
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH)$(OS_RELEASE),SunOS5)
ifeq ($(shell uname -r),5.3)
# In this special case (jpeg.cpp), the compiler has to know
# the OS version to a finer granularity than normal.
DEFINES += -DOSMINOR=3
endif
endif

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* jpeg.h */
extern int il_jpeg_init(il_container *ic);
extern int il_jpeg_write(il_container *, const PRUint8 *, int32);
extern void il_jpeg_complete(il_container *ic);
//extern unsigned int il_jpeg_write_ready(il_container *ic);
extern void il_jpeg_abort(il_container *ic);

View File

@ -1,102 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#------------------------------------------------------------------------
#
# Makefile to build the IMGLIB LIB
#
#------------------------------------------------------------------------
!ifdef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
!endif
LIBRARY_NAME = nsjpg
#
# Make sure we have MOZILLA_CLIENT defined so we get the
# proper JS includes
#
LCFLAGS = $(LCFLAGS) -DMOZILLA_CLIENT
!ifdef BUILD_DEBUG_GC
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
!endif
LCFLAGS = $(LCFLAGS) /TP
LLIBS= $(LIBNSPR) \
$(DIST)\lib\util.lib \
$(DIST)\lib\jpeg3250.lib \
$(DIST)\lib\xpcom.lib \
!ifdef NU_CACHE
$(DIST)\lib\cache.lib \
!endif
$(NULL)
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
MAKE_OBJ_TYPE=DLL
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=nsjpg
DLL1NAME=nsjpg
PDBFILE=$(DLLNAME).pdb
MAPFILE=$(DLLNAME).map
DEFFILE=nsjpg.def
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MAPFILE= $(DLLNAME).map
MODULE=img
DEPTH=..\..\..
LINCS=-I$(DEPTH)/dist/public/xpcom -I. -I$(DEPTH)/dist/public/raptor -I$(DEPTH)/dist/public/jpeg
CPPSRCS= nsJPGDecoder.cpp nsJPGModule.cpp jpeg.cpp
CPP_OBJS= \
.\$(OBJDIR)\nsJPGDecoder.obj \
.\$(OBJDIR)\nsJPGModule.obj \
.\$(OBJDIR)\jpeg.obj \
$(NULL)
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib

View File

@ -1,131 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* -*- Mode: C; tab-width: 4 -*-
* nsJPGDecoder.cpp --- interface to JPG decoder
*/
#include "nsCOMPtr.h"
#include "nsJPGDecoder.h"
#include "jpeg.h"
//////////////////////////////////////////////////////////////////////
// JPG Decoder Implementation
NS_IMPL_ISUPPORTS1(JPGDecoder, nsIImgDecoder);
JPGDecoder::JPGDecoder(il_container* aContainer)
{
NS_INIT_REFCNT();
ilContainer = aContainer;
}
JPGDecoder::~JPGDecoder(void)
{
}
NS_METHOD
JPGDecoder::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
if (aOuter) return NS_ERROR_NO_AGGREGATION;
il_container *ic = new il_container();
if (!ic) return NS_ERROR_OUT_OF_MEMORY;
JPGDecoder *decoder = new JPGDecoder(ic);
if (!decoder) {
delete ic;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(decoder);
rv = decoder->QueryInterface(aIID, aResult);
NS_RELEASE(decoder);
/* why are we creating and destroying this object for no reason? */
delete ic; /* is a place holder */
return rv;
}
/*------------------------------------------------------*/
/* api functions
*/
/*------------------------------------------------------*/
NS_IMETHODIMP
JPGDecoder::ImgDInit()
{
int ret;
if( ilContainer != NULL ) {
ret = il_jpeg_init(ilContainer);
if(ret != 1)
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
JPGDecoder::ImgDWriteReady(PRUint32 *max_read)
{
/* dummy return needed */
*max_read = 2048;
return NS_OK;
}
NS_IMETHODIMP
JPGDecoder::ImgDWrite(const unsigned char *buf, int32 len)
{
int ret;
if( ilContainer != NULL ) {
ret = il_jpeg_write(ilContainer, buf,len);
if(ret != 0)
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
JPGDecoder::ImgDComplete()
{
if( ilContainer != NULL ) {
il_jpeg_complete(ilContainer);
}
return NS_OK;
}
NS_IMETHODIMP
JPGDecoder::ImgDAbort()
{
if( ilContainer != NULL ) {
il_jpeg_abort(ilContainer);
}
return NS_OK;
}

View File

@ -1,58 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsJPGDecoder_h___
#define nsJPGDecoder_h___
#include "nsIImgDecoder.h"
/* 1b0e6b90-d68a-11d2-802e-0060088f91a3 */
#define NS_JPGDECODER_CID \
{ 0x1b0e6b90, 0xd68a, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
class JPGDecoder : public nsIImgDecoder
{
public:
JPGDecoder(il_container* aContainer);
virtual ~JPGDecoder();
NS_DECL_ISUPPORTS
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
/* stream */
NS_IMETHOD ImgDInit();
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read);
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len);
NS_IMETHOD ImgDComplete();
NS_IMETHOD ImgDAbort();
NS_IMETHOD_(il_container *) SetContainer(il_container *ic){ilContainer = ic; return ic;}
NS_IMETHOD_(il_container *) GetContainer() {return ilContainer;}
private:
il_container* ilContainer;
};
#endif /* nsJPGDecoder_h___ */

View File

@ -1,40 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
#include "nsJPGDecoder.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
static NS_DEFINE_CID(kJPGDecoderCID, NS_JPGDECODER_CID);
static nsModuleComponentInfo components[] =
{
{ "JPEG Decoder",
NS_JPGDECODER_CID,
"@mozilla.org/image/decoder;1?type=image/jpeg",
JPGDecoder::Create }
};
NS_IMPL_NSGETMODULE(nsJPGModule, components)

View File

@ -1,49 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsJPGModule_h___
#define nsJPGModule_h___
#include "nsIModule.h"
class nsJPGModule : public nsIModule
{
public:
NS_DECL_ISUPPORTS
// Construction, Init and desstruction
nsJPGModule();
virtual ~nsJPGModule();
// nsIModule Interfaces
NS_DECL_NSIMODULE
// Facility for counting object instances
int IncrementObjCount() { if (mObjCount == -1) mObjCount = 0; return ++mObjCount; }
int DecrementObjCount() { if (mObjCount == -1) mObjCount = 0; return --mObjCount; }
int GetObjCount() { return mObjCount; }
private:
int mObjCount;
nsISupports* mClassObject;
};
#endif /* nsJPGModule_h___ */

View File

@ -1,14 +0,0 @@
;
; temp def file for nsjpg dll
;
LIBRARY nsjpg.dll
DESCRIPTION 'test dll'
EXPORTS
ImgDInit @1002 PRIVATE
ImgDWrite @1003 PRIVATE
ImgDWriteReady @1004 PRIVATE
ImgDComplete @1005 PRIVATE
ImgDAbort @1006 PRIVATE

View File

@ -1,24 +0,0 @@
?fill_input_buffer@@YAEPAUjpeg_decompress_struct@@@Z ; 53
?ImgDWrite@JPGDecoder@@UAGIPBEJ@Z ; 45
?il_jpeg_write@@YAHPAUil_container_struct@@PBEJ@Z ; 45
?ImgDWriteReady@JPGDecoder@@UAGIPAI@Z ; 44
?output_jpeg_scanlines@@YAHPAUil_container_struct@@H@Z ; 4
?init_source@@YAXPAUjpeg_decompress_struct@@@Z ; 2
?AddRef@JPGDecoder@@UAGKXZ ; 2
?Release@JPGDecoder@@UAGKXZ ; 2
?skip_input_data@@YAXPAUjpeg_decompress_struct@@J@Z ; 2
?SetContainer@JPGDecoder@@UAGPAUil_container_struct@@PAU2@@Z ; 2
?il_jpeg_abort@@YAXPAUil_container_struct@@@Z ; 2
_NSGetModule ; 1
?il_jpeg_COM_handler@@YAEPAUjpeg_decompress_struct@@@Z ; 1
?il_jpeg_init@@YAHPAUil_container_struct@@@Z ; 1
?setup_jpeg_src@@YAHPAUjpeg_decompress_struct@@PAUjpeg_struct@@@Z ; 1
?ImgDInit@JPGDecoder@@UAGIXZ ; 1
?QueryInterface@JPGDecoder@@UAGIABUnsID@@PAPAX@Z ; 1
??_GJPGDecoder@@UAEPAXI@Z ; 1
??0JPGDecoder@@QAE@PAUil_container_struct@@@Z ; 1
?Create@JPGDecoder@@SGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
??1JPGDecoder@@UAE@XZ ; 1
?ImgDAbort@JPGDecoder@@UAGIXZ ; 1
?ImgDComplete@JPGDecoder@@UAGIXZ ; 1
?il_jpeg_complete@@YAXPAUil_container_struct@@@Z ; 1

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,52 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = nsmng
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
REQUIRES = xpcom string img layout util locale mng jpeg unicharutil
CPPSRCS = \
nsMNGDecoder.cpp \
nsMNGModule.cpp \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)
EXTRA_DSO_LDOPTS = $(MNG_LIBS) $(JPEG_LIBS) $(ZLIB_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
EXTRA_LIBS = $(NSPR_LIBS)
ifndef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,105 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#------------------------------------------------------------------------
#
# Makefile to build the IMGLIB LIB
#
#------------------------------------------------------------------------
!ifdef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
!endif
LIBRARY_NAME = nsmng
#
# Make sure we have MOZILLA_CLIENT defined so we get the
# proper JS includes
#
LCFLAGS = $(LCFLAGS) -DMOZILLA_CLIENT
!ifdef BUILD_DEBUG_GC
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
!endif
LCFLAGS = $(LCFLAGS) /TP
LLIBS= $(LIBNSPR) \
$(DIST)\lib\util.lib \
$(DIST)\lib\mng.lib \
$(DIST)\lib\jpeg3250.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\zlib.lib \
!ifdef NU_CACHE
$(DIST)\lib\cache.lib \
!endif
$(NULL)
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
MAKE_OBJ_TYPE=DLL
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=nsmng
DLL1NAME=nsmng
PDBFILE=$(DLLNAME).pdb
MAPFILE=$(DLLNAME).map
DEFFILE=nsmng.def
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MAPFILE= $(DLLNAME).map
MODULE=img
DEPTH=..\..\..
LINCS=-I$(DEPTH)/dist/public/xpcom -I. -I$(DEPTH)/dist/public/raptor \
-I$(DEPTH)/dist/public/jpeg -I$(DEPTH)/dist/public/zlib -I$(DEPTH)/dist/public/img
CPPSRCS= nsMNGDecoder.cpp nsMNGCallback.cpp
CPP_OBJS= \
.\$(OBJDIR)\nsMNGDecoder.obj \
.\$(OBJDIR)\nsMNGModule.obj
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib

View File

@ -1,456 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Tim Rowley, tor@cs.brown.edu, original author
*/
#include "nsMNGDecoder.h"
#include "nsIImgDCallbk.h"
#include "nsMemory.h"
#include "libmng.h"
#include "prinrval.h"
typedef struct imng_str {
mng_handle handle;
PRUint32 width;
PRUint32 height;
PRUint8 *image; /* full image buffer */
PRUint8 *rowbuf; /* ImgDCBHaveRow is destructive. Grrr... */
PRUint32 channels; /* How many channels (3 or 4) */
void *timer_id;
PRUint8 *writeBuffer; /* Bugzilla 41831 */
PRUint32 bufferSize;
PRUint32 bufferEnd;
PRUint32 bufferPtr;
PRBool resumeNeeded; /* need to call display_resume? */
il_container *ic;
} imng_struct, *imng_structp;
#define EXTRACT_STRUCTS \
il_container *ic = (il_container *)mng_get_userdata(handle); \
imng_structp imng_p = (imng_structp)ic->ds
#ifdef DEBUG_tor
#define dprintf(x) fprintf x
#else
#define dprintf(x)
#endif
// Callbacks for libmng
//===========================================================
static mng_bool
il_mng_openstream(mng_handle handle)
{
return MNG_TRUE;
}
static mng_bool
il_mng_closestream(mng_handle handle)
{
return MNG_TRUE;
}
static mng_bool
il_mng_readdata(mng_handle handle, mng_ptr buf,
mng_uint32 size, mng_uint32 *stored)
{
EXTRACT_STRUCTS;
dprintf((stderr, "MNG::readdata size=%d buffered=%d\n",
size, imng_p->bufferEnd - imng_p->bufferPtr));
size = PR_MIN(size, imng_p->bufferEnd - imng_p->bufferPtr);
memcpy(buf, imng_p->writeBuffer+imng_p->bufferPtr, size);
imng_p->bufferPtr += size;
*stored = size;
return MNG_TRUE;
}
static mng_bool
il_mng_processheader(mng_handle handle, mng_uint32 width, mng_uint32 height)
{
EXTRACT_STRUCTS;
imng_p->width = width;
imng_p->height = height;
ic->src_header->width = width;
ic->src_header->height = height;
switch (mng_get_alphadepth(handle)) {
case 0:
dprintf((stderr, "--- MNG ALPHA NONE\n"));
ic->image->header.alpha_bits = 0;
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGB8);
imng_p->channels = 3;
break;
case 1:
dprintf((stderr, "--- MNG ALPHA THRESHHOLD\n"));
ic->image->header.alpha_bits = 1;
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGBA8);
imng_p->channels = 4;
break;
default:
dprintf((stderr, "--- MNG ALPHA 8-BIT\n"));
ic->image->header.alpha_bits = 8;
mng_set_canvasstyle(imng_p->handle, MNG_CANVAS_RGBA8);
imng_p->channels = 4;
break;
}
ic->image->header.alpha_shift = 0;
ic->image->header.is_interleaved_alpha = TRUE;
imng_p->image =
(unsigned char*)nsMemory::Alloc(imng_p->channels*width*height);
memset(imng_p->image, 0, imng_p->channels*width*height);
imng_p->rowbuf = (unsigned char*)nsMemory::Alloc(imng_p->channels*width);
ic->imgdcb->ImgDCBImageSize();
ic->imgdcb->ImgDCBSetupColorspaceConverter();
return MNG_TRUE;
}
static mng_ptr
il_mng_getcanvasline(mng_handle handle, mng_uint32 iLinenr)
{
EXTRACT_STRUCTS;
return imng_p->image+imng_p->channels*imng_p->width*iLinenr;
}
static mng_bool
il_mng_refresh(mng_handle handle,
mng_uint32 left, mng_uint32 top,
mng_uint32 width, mng_uint32 height)
{
// dprintf((stderr, "=== refresh(top=%d left=%d width=%d height=%d)\n",
// top, left, width, height));
EXTRACT_STRUCTS;
for (mng_uint32 y=top; y<top+height; y++) {
memcpy(imng_p->rowbuf,
imng_p->image+y*imng_p->channels*imng_p->width,
imng_p->channels*imng_p->width);
ic->imgdcb->ImgDCBHaveRow(0 /* color index data */,
imng_p->rowbuf /* rgb[a] */,
0 /* x-offset */,
imng_p->width /* width in pixels */,
y /* start row */,
1 /* row duplication count */,
ilErase /* draw mode */,
mng_get_refreshpass(handle) /* pass */);
}
if (mng_get_imagetype(handle) == mng_it_mng) {
ic->imgdcb->ImgDCBFlushImage();
ic->imgdcb->ImgDCBHaveImageFrame();
}
return MNG_TRUE;
}
static mng_uint32
il_mng_gettickcount(mng_handle handle)
{
// dprintf((stderr, "=== gettickcount()\n"));
return PR_IntervalToMilliseconds(PR_IntervalNow());
}
static void
il_mng_timeout_func(void *data)
{
mng_handle handle = (mng_handle)data;
EXTRACT_STRUCTS;
// dprintf((stderr, "il_mng_timeout_func\n"));
imng_p->timer_id = 0;
int ret = mng_display_resume(handle);
if (ret == MNG_NEEDMOREDATA)
imng_p->resumeNeeded = PR_TRUE;
// dprintf((stderr, "il_mng_timeout_func display_resume returned %d\n", ret));
}
static mng_bool
il_mng_settimer(mng_handle handle, mng_uint32 msec)
{
dprintf((stderr, "=== settimer(%d)\n", msec));
EXTRACT_STRUCTS;
imng_p->timer_id =
ic->imgdcb->ImgDCBSetTimeout(il_mng_timeout_func,
(void *)handle,
msec);
return MNG_TRUE;
}
static mng_ptr
il_mng_alloc(mng_size_t size)
{
void *ptr = nsMemory::Alloc(size);
memset(ptr, 0, size);
return ptr;
}
static void
il_mng_free(mng_ptr ptr, mng_size_t size)
{
nsMemory::Free(ptr);
}
#ifdef DEBUG_tor
static mng_bool
il_mng_trace(mng_handle handle, mng_int32 iFuncnr, mng_int32 iFuncseq,
mng_pchar zFuncname)
{
dprintf((stderr, "== trace == %s %d %d\n", zFuncname, iFuncnr, iFuncseq));
return MNG_TRUE;
}
static mng_bool
il_mng_error(mng_handle hHandle, mng_int32 iErrorcode, mng_int8 iSeverity,
mng_chunkid iChunkname, mng_uint32 iChunkseq, mng_int32 iExtra1,
mng_int32 iExtra2, mng_pchar zErrortext)
{
dprintf((stderr, "== error == %s\n", zErrortext));
return MNG_TRUE;
}
#endif
// Boilerplate methods... *yawn*
//===========================================================
MNGDecoder::MNGDecoder(il_container* aContainer)
{
NS_INIT_REFCNT();
ilContainer = aContainer;
}
MNGDecoder::~MNGDecoder(void)
{
}
NS_IMPL_ISUPPORTS1(MNGDecoder, nsIImgDecoder)
NS_METHOD
MNGDecoder::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
if (aOuter) return NS_ERROR_NO_AGGREGATION;
il_container *ic = new il_container();
if (!ic) return NS_ERROR_OUT_OF_MEMORY;
MNGDecoder *decoder = new MNGDecoder(ic);
if (!decoder) {
delete ic;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(decoder);
rv = decoder->QueryInterface(aIID, aResult);
NS_RELEASE(decoder);
/* why are we creating and destroying this object for no reason? */
delete ic; /* is a place holder */
return rv;
}
// Hooking mozilla and libmng together...
//===========================================================
NS_IMETHODIMP
MNGDecoder::ImgDInit()
{
if( ilContainer != NULL ) {
imng_structp imng_p;
imng_p = (imng_structp) nsMemory::Alloc(sizeof(imng_struct));
if (!imng_p)
return PR_FALSE;
memset(imng_p, 0, sizeof(imng_struct));
imng_p->writeBuffer = (PRUint8 *)nsMemory::Alloc(4096);
imng_p->bufferSize = 4096;
ilContainer->image->header.width = ilContainer->dest_width;
ilContainer->image->header.height = ilContainer->dest_height;
ilContainer->ds = imng_p;
imng_p->ic = ilContainer;
/* Initialize the container's source image header. */
/* Always decode to 24 bit pixdepth */
NI_ColorSpace *src_color_space = ilContainer->src_header->color_space;
src_color_space->type = NI_TrueColor;
src_color_space->pixmap_depth = 24;
src_color_space->bit_alloc.index_depth = 0;
/* pass ic as user data */
imng_p->handle =
mng_initialize(ilContainer, il_mng_alloc, il_mng_free, NULL);
////////////
// Gamma correction - gross hack, but it's what mozilla's PNG
// decoder does and nobody has complained yet...
double LUT_exponent, CRT_exponent = 2.2, display_exponent;
/* set up gamma correction for Mac, Unix and (Win32 and everything else)
* using educated guesses for display-system exponents; do preferences
* later */
#if defined(XP_MAC)
LUT_exponent = 1.8 / 2.61;
#elif defined(XP_UNIX)
# if defined(__sgi)
LUT_exponent = 1.0 / 1.7; /* typical default for SGI console */
# elif defined(NeXT)
LUT_exponent = 1.0 / 2.2; /* typical default for NeXT cube */
# else
LUT_exponent = 1.0; /* default for most other Unix workstations */
# endif
#else
LUT_exponent = 1.0; /* virtually all PCs and most other systems */
#endif
/* (alternatively, could check for SCREEN_GAMMA environment variable) */
display_exponent = LUT_exponent * CRT_exponent;
mng_set_dfltimggamma(imng_p->handle, 0.45455);
mng_set_displaygamma(imng_p->handle, display_exponent);
////////////
mng_setcb_openstream(imng_p->handle, il_mng_openstream);
mng_setcb_closestream(imng_p->handle, il_mng_closestream);
mng_setcb_readdata(imng_p->handle, il_mng_readdata);
mng_setcb_processheader(imng_p->handle, il_mng_processheader);
mng_setcb_getcanvasline(imng_p->handle, il_mng_getcanvasline);
mng_setcb_refresh(imng_p->handle, il_mng_refresh);
mng_setcb_gettickcount(imng_p->handle, il_mng_gettickcount);
mng_setcb_settimer(imng_p->handle, il_mng_settimer);
mng_setcb_memalloc(imng_p->handle, il_mng_alloc);
mng_setcb_memfree(imng_p->handle, il_mng_free);
mng_set_suspensionmode(imng_p->handle, MNG_TRUE);
if (mng_readdisplay(imng_p->handle) == MNG_NEEDMOREDATA)
imng_p->resumeNeeded = PR_TRUE;
}
return NS_OK;
}
NS_IMETHODIMP
MNGDecoder::ImgDWriteReady(PRUint32 *max_read)
{
dprintf((stderr, "MNG::ImgDWriteReady() = "));
imng_structp imng_p = (imng_structp)ilContainer->ds;
/* add a bit, because libimg actually believes us if max_read==0 */
*max_read = imng_p->bufferSize - imng_p->bufferEnd + 1024;
dprintf((stderr, "%d\n", *max_read));
return NS_OK;
}
NS_IMETHODIMP
MNGDecoder::ImgDWrite(const unsigned char *buf, int32 len)
{
dprintf((stderr, "MNG::ImgDWrite(%d)\n", len));
if (ilContainer != NULL) {
imng_structp imng_p = (imng_structp)ilContainer->ds;
if (imng_p->bufferEnd+len > imng_p->bufferSize) {
imng_p->bufferSize *= 2;
imng_p->writeBuffer = (PRUint8 *)
nsMemory::Realloc(imng_p->writeBuffer, imng_p->bufferSize);
}
memcpy(imng_p->writeBuffer+imng_p->bufferEnd, buf, len);
imng_p->bufferEnd += len;
if (imng_p->resumeNeeded) {
// dprintf((stderr, "MNG::ImgDWrite display_resume\n"));
imng_p->resumeNeeded = PR_FALSE;
int ret = mng_display_resume(imng_p->handle);
if (ret == MNG_NEEDMOREDATA)
imng_p->resumeNeeded = PR_TRUE;
// dprintf((stderr, "MNG::ImgDWrite display_resume returned %d\n", ret));
}
}
return NS_OK;
}
NS_IMETHODIMP
MNGDecoder::ImgDComplete()
{
return NS_OK;
}
NS_IMETHODIMP
MNGDecoder::ImgDAbort()
{
if( ilContainer != NULL ) {
imng_structp imng_p = (imng_structp)ilContainer->ds;
if (!imng_p)
return NS_OK;
if (imng_p->timer_id) {
ilContainer->imgdcb->ImgDCBClearTimeout(imng_p->timer_id);
imng_p->timer_id = 0;
}
mng_display_freeze(imng_p->handle);
mng_cleanup(&imng_p->handle);
nsMemory::Free(imng_p->writeBuffer);
nsMemory::Free(imng_p->image);
nsMemory::Free(imng_p->rowbuf);
nsMemory::Free(imng_p);
imng_p = NULL;
}
return NS_OK;
}

View File

@ -1,61 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Tim Rowley, tor@cs.brown.edu, original author
*/
#ifndef nsMNGDecoder_h___
#define nsMNGDecoder_h___
#include "nsIImgDecoder.h"
/* d73f1676-1dd1-11b2-ba33-aabc09e02d10 */
#define NS_MNGDECODER_CID \
{ 0xd73f1676, 0x1dd1, 0x11b2, \
{ 0xba, 0x33, 0xaa, 0xbc, 0x09, 0xe0, 0x2d, 0x10 } }
class MNGDecoder : public nsIImgDecoder
{
public:
MNGDecoder(il_container* aContainer);
virtual ~MNGDecoder();
NS_DECL_ISUPPORTS
static NS_METHOD Create(nsISupports *aOuter, const nsIID &aIID, void **aResult);
/* stream */
NS_IMETHOD ImgDInit();
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read);
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len);
NS_IMETHOD ImgDComplete();
NS_IMETHOD ImgDAbort();
NS_IMETHOD_(il_container *) SetContainer(il_container *ic){ilContainer = ic; return ic;}
NS_IMETHOD_(il_container *) GetContainer() {return ilContainer;}
private:
il_container* ilContainer;
};
#endif /* nsMNGDecoder_h___ */

View File

@ -1,44 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Tim Rowley, tor@cs.brown.edu, original author
*/
#include "nsMNGDecoder.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
static NS_DEFINE_CID(kMNGDecoderCID, NS_MNGDECODER_CID);
static nsModuleComponentInfo components[] =
{
{ "MNG Decoder",
NS_MNGDECODER_CID,
"@mozilla.org/image/decoder;1?type=video/x-mng",
MNGDecoder::Create },
{ "JNG Decoder",
NS_MNGDECODER_CID,
"@mozilla.org/image/decoder;1?type=image/x-jng",
MNGDecoder::Create }
};
NS_IMPL_NSGETMODULE(nsMNGModule, components)

View File

@ -1,14 +0,0 @@
;
; temp def file for nsmng dll
;
LIBRARY nsmng.dll
DESCRIPTION 'test dll'
EXPORTS
ImgDInit @1002 PRIVATE
ImgDWrite @1003 PRIVATE
ImgDWriteReady @1004 PRIVATE
ImgDComplete @1005 PRIVATE
ImgDAbort @1006 PRIVATE

View File

@ -1 +0,0 @@
_NSGetModule ; 1

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,53 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = nspng
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
REQUIRES = xpcom string img util layout locale png unicharutil
CPPSRCS = \
ipng.cpp \
nsPNGDecoder.cpp \
nsPNGModule.cpp \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)
EXTRA_DSO_LDOPTS = $(PNG_LIBS) $(ZLIB_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
EXTRA_LIBS = $(NSPR_LIBS)
ifndef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,443 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*
*
* This Original Code has been modified by IBM Corporation.
* Modifications made by IBM described herein are
* Copyright (c) International Business Machines
* Corporation, 2000
*
* Modifications to Mozilla code or documentation
* identified per MPL Section 3.3
*
* Date Modified by Description of modification
* 03/27/2000 IBM Corp. Added PR_CALLBACK for Optlink
* use in OS2
*/
#include "png.h"
#include "nsIImgDecoder.h" // include if_struct.h Needs to be first
#include "ipng.h"
#include "pngdec.h"
#include "nsPNGDecoder.h"
#include "nsIImgDCallbk.h"
#include "ilISystemServices.h"
#define MINIMUM_DELAY_TIME 10
static void PR_CALLBACK info_callback(png_structp png_ptr, png_infop info);
static void PR_CALLBACK row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass);
static void PR_CALLBACK end_callback(png_structp png_ptr, png_infop info);
static void PR_CALLBACK il_png_error_handler(png_structp png_ptr, png_const_charp msg);
#ifdef DEBUG
static int il_debug_png = 0;
static PRLogModuleInfo *il_log_module_png = NULL;
#define ILTRACE(l,t) { if(il_debug_png>l) {PR_LOG(il_log_module_png, 1, t);} }
#else
#define ILTRACE(l,t) {}
#endif
#define CAN_SUPPORT_8_BIT_MASK
PRBool
il_png_init(il_container *ic)
{
ipng_struct *ipng_p;
NI_ColorSpace *src_color_space = ic->src_header->color_space;
ic->image->header.width = ic->dest_width;
ic->image->header.height = ic->dest_height;
ipng_p = PR_NEWZAP(ipng_struct);
if (!ipng_p)
return PR_FALSE;
ic->ds = ipng_p;
ipng_p->state = PNG_INIT;
ipng_p->ic = ic;
/* Initialize the container's source image header. */
/* Always decode to 24 bit pixdepth */
src_color_space->type = NI_TrueColor;
src_color_space->pixmap_depth = 24;
src_color_space->bit_alloc.index_depth = 0;
png_structp png_ptr;
png_infop info_ptr;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, ipng_p,
il_png_error_handler, NULL);
if (png_ptr == NULL) {
ipng_p->pngs_p = NULL;
ipng_p->info_p = NULL;
ipng_p->state = PNG_ERROR;
return -1;
}
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) {
png_destroy_read_struct(&png_ptr, NULL, NULL);
ipng_p->pngs_p = NULL;
ipng_p->info_p = NULL;
ipng_p->state = PNG_ERROR;
return -1;
}
ipng_p->pngs_p = png_ptr;
ipng_p->info_p = info_ptr;
/* use ic as libpng "progressive pointer" (retrieve in callbacks) */
png_set_progressive_read_fn(png_ptr, (void *)ic, info_callback,
row_callback, end_callback);
return PR_TRUE;
}
/* Gather n characters from the input stream and then enter state s. */
int
il_png_write(il_container *ic, const unsigned char *buf, int32 len)
{
ipng_structp ipng_p;
PR_ASSERT(ic != NULL);
ipng_p = (ipng_structp)ic->ds;
if (ipng_p->state == PNG_ERROR)
return -1;
if (setjmp(ipng_p->jmpbuf)) {
png_destroy_read_struct(&ipng_p->pngs_p, &ipng_p->info_p, NULL);
ipng_p->state = PNG_ERROR;
return -1;
}
png_process_data(ipng_p->pngs_p, ipng_p->info_p, (unsigned char *)buf, len);
ipng_p->state = PNG_CONTINUE;
return 0;
}
int
il_png_complete(il_container *ic)
{
/* notify observers that the current frame has completed. */
ic->imgdcb->ImgDCBHaveImageAll();
return 0;
}
int
il_png_abort(il_container *ic)
{
if (ic->ds) {
ipng_structp ipng_p = (ipng_structp)ic->ds;
PR_FREEIF(ipng_p->rgbrow);
PR_FREEIF(ipng_p->alpharow);
PR_FREEIF(ipng_p->interlacebuf);
ipng_p->rgbrow = NULL;
ipng_p->alpharow = NULL;
ipng_p->interlacebuf = NULL;
if((ipng_p->pngs_p)&&(ipng_p->info_p))
png_destroy_read_struct(&ipng_p->pngs_p, &ipng_p->info_p, NULL);
PR_FREEIF(ipng_p);
ic->ds = NULL;
}
/* il_abort( ic ); */
return 0;
}
/*---------------------------------------------------------------------------
Former contents of png_png.cpp, a.k.a. libpng's example.c (modified):
---------------------------------------------------------------------------*/
static void
info_callback(png_structp png_ptr, png_infop info_ptr)
{
/* int number_passes; NOT USED */
png_uint_32 width, height;
int bit_depth, color_type, interlace_type, compression_type, filter_type;
int channels;
double LUT_exponent, CRT_exponent = 2.2, display_exponent, aGamma;
il_container *ic;
ipng_structp ipng_p;
NI_PixmapHeader *img_hdr;
NI_PixmapHeader *src_hdr;
png_bytep trans=NULL;
int num_trans =0;
/* always decode to 24-bit RGB or 32-bit RGBA */
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, &compression_type, &filter_type);
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
{
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
png_set_expand(png_ptr);
}
if (bit_depth == 16)
png_set_strip_16(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr);
/* set up gamma correction for Mac, Unix and (Win32 and everything else)
* using educated guesses for display-system exponents; do preferences
* later */
#if defined(XP_MAC)
LUT_exponent = 1.8 / 2.61;
#elif defined(XP_UNIX)
# if defined(__sgi)
LUT_exponent = 1.0 / 1.7; /* typical default for SGI console */
# elif defined(NeXT)
LUT_exponent = 1.0 / 2.2; /* typical default for NeXT cube */
# else
LUT_exponent = 1.0; /* default for most other Unix workstations */
# endif
#else
LUT_exponent = 1.0; /* virtually all PCs and most other systems */
#endif
/* (alternatively, could check for SCREEN_GAMMA environment variable) */
display_exponent = LUT_exponent * CRT_exponent;
if (png_get_gAMA(png_ptr, info_ptr, &aGamma))
png_set_gamma(png_ptr, display_exponent, aGamma);
else
png_set_gamma(png_ptr, display_exponent, 0.45455);
/* let libpng expand interlaced images */
if (interlace_type == PNG_INTERLACE_ADAM7)
/* number_passes = */ png_set_interlace_handling(png_ptr);
/* now all of those things we set above are used to update various struct
* members and whatnot, after which we can get channels, rowbytes, etc. */
png_read_update_info(png_ptr, info_ptr);
channels = png_get_channels(png_ptr, info_ptr);
PR_ASSERT(channels == 3 || channels == 4);
/* set the ic values */
ic = (il_container *)png_get_progressive_ptr(png_ptr);
PR_ASSERT(ic != NULL);
/*---------------------------------------------------------------*/
/* copy PNG info into imagelib structs (formerly png_set_dims()) */
/*---------------------------------------------------------------*/
ipng_p = (ipng_structp)ic->ds;
img_hdr = &ic->image->header;
src_hdr = ic->src_header;
ipng_p->width = src_hdr->width = width;
ipng_p->height = src_hdr->height = height;
ipng_p->channels = channels;
PR_ASSERT(ipng_p->rgbrow == NULL);
PR_ASSERT(ipng_p->alpharow == NULL);
ipng_p->rgbrow = (PRUint8 *)PR_MALLOC(channels*width);
if (!ipng_p->rgbrow) {
ILTRACE(0, ("il:png: MEM row"));
ipng_p->state = PNG_ERROR;
return;
}
if(interlace_type == PNG_INTERLACE_ADAM7) {
ipng_p->interlacebuf = (PRUint8 *)PR_MALLOC(channels*width*height);
if (!ipng_p->interlacebuf) {
ILTRACE(0, ("il:png: MEM interlacebuf"));
ipng_p->state = PNG_ERROR;
return;
}
}
else
ipng_p->interlacebuf = NULL;
if (channels > 3) {
ipng_p->alpharow = NULL;
#if defined(CAN_SUPPORT_8_BIT_MASK)
if (color_type || PNG_COLOR_MASK_ALPHA) {
/* check if alpha is coming from a tRNS chunk and is binary */
if (num_trans) {
ic->image->header.alpha_bits = 1;
/* if it's not a indexed color image, tRNS means binary */
if (color_type == PNG_COLOR_TYPE_PALETTE)
for (int i=0; i<num_trans; i++)
if ((trans[i] != 0) && (trans[i] != 255)) {
ic->image->header.alpha_bits = 8;
break;
}
} else
ic->image->header.alpha_bits = 8/*png_ptr->pixel_depth*/; /* 8 */
} else
#endif
ic->image->header.alpha_bits = 1;
ic->image->header.alpha_shift = 0;
ic->image->header.is_interleaved_alpha = PR_TRUE;
}
ic->imgdcb->ImgDCBImageSize();
/* Note: all PNGs are decoded to RGB or RGBA and
converted by imglib to appropriate pixel depth */
ic->imgdcb->ImgDCBSetupColorspaceConverter();
return;
}
static void
row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass)
{
/* libpng comments:
*
* this function is called for every row in the image. If the
* image is interlacing, and you turned on the interlace handler,
* this function will be called for every row in every pass.
* Some of these rows will not be changed from the previous pass.
* When the row is not changed, the new_row variable will be NULL.
* The rows and passes are called in order, so you don't really
* need the row_num and pass, but I'm supplying them because it
* may make your life easier.
*
* For the non-NULL rows of interlaced images, you must call
* png_progressive_combine_row() passing in the row and the
* old row. You can call this function for NULL rows (it will
* just return) and for non-interlaced images (it just does the
* memcpy for you) if it will make the code easier. Thus, you
* can just do this for all cases:
*
* png_progressive_combine_row(png_ptr, old_row, new_row);
*
* where old_row is what was displayed for previous rows. Note
* that the first pass (pass == 0 really) will completely cover
* the old row, so the rows do not have to be initialized. After
* the first pass (and only for interlaced images), you will have
* to pass the current row, and the function will combine the
* old row and the new row.
*/
il_container *ic = (il_container *)png_get_progressive_ptr(png_ptr);
ipng_structp ipng_p = (ipng_structp)ic->ds;
PR_ASSERT(ipng_p);
int bw = ipng_p->channels * ipng_p->width;
png_bytep line;
if(ipng_p->interlacebuf)
{
line = ipng_p->interlacebuf+row_num*bw;
png_progressive_combine_row(png_ptr, line, new_row);
}
else
line = new_row;
if (new_row) {
/* first we copy the row data to a different buffer so that
* il_emit_row() in scale.cpp doesn't mess up libpng's row buffer
*/
memcpy(ipng_p->rgbrow, line, bw);
ic->imgdcb->ImgDCBHaveRow(0, ipng_p->rgbrow, 0, ipng_p->width,
row_num, 1, ilErase /* ilOverlay */, pass);
}
}
static void
end_callback(png_structp png_ptr, png_infop info_ptr)
{
/* libpng comments:
*
* this function is called when the whole image has been read,
* including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added
* to the comments and time fields.
*
* Most people won't do much here, perhaps setting a flag that
* marks the image as finished.
*/
il_container *ic = (il_container *)png_get_progressive_ptr(png_ptr);
ic->imgdcb->ImgDCBFlushImage();
}
static void
il_png_error_handler(png_structp png_ptr, png_const_charp msg)
{
ipng_structp ipng_p;
/* This function, aside from the extra step of retrieving the "error
* pointer" (below) and the fact that it exists within the application
* rather than within libpng, is essentially identical to libpng's
* default error handler. The second point is critical: since both
* setjmp() and longjmp() are called from the same code, they are
* guaranteed to have compatible notions of how big a jmp_buf is,
* regardless of whether _BSD_SOURCE or anything else has (or has not)
* been defined. Adapted from readpng2_error_handler() in "PNG: The
* Definitive Guide" (O'Reilly, 1999). */
fprintf(stderr, "nspng libpng error: %s\n", msg);
fflush(stderr);
ipng_p = (ipng_structp)png_get_error_ptr(png_ptr);
if (ipng_p == NULL) { /* we are completely hosed now */
fprintf(stderr, "nspng severe error: jmpbuf not recoverable.\n");
fflush(stderr);
PR_ASSERT(ipng_p != NULL); /* instead of exit(99); */
}
longjmp(ipng_p->jmpbuf, 1);
}

View File

@ -1,58 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* ipng.h */
typedef enum {
PNG_ERROR,
PNG_INIT,
PNG_CONTINUE,
PNG_DELAY,
PNG_FINISH,
PNG_DONE
} png_state;
typedef struct ipng_str {
png_state state; /* Decoder FSM state */
/* int rows_per_chunk; NOT USED (similar variable in jpeg_struct) */
void *delay_timeout;
PRUint32 delay_time;
png_structp pngs_p;
png_infop info_p;
jmp_buf jmpbuf; /* use ours, not libpng's, for consistency */
PRUint32 width;
PRUint32 height;
int channels; /* color channels (3 or 4) */
PRUint8 *rgbrow; /* RGB row buffer (3*width bytes) */
PRUint8 *alpharow; /* alpha row buffer (width bytes) */
PRUint8 *interlacebuf; /* interlace buffer */
/* One scanline's worth of post-processed sample data */
il_container *ic;
} ipng_struct, *ipng_structp;

View File

@ -1,105 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
#------------------------------------------------------------------------
#
# Makefile to build the IMGLIB LIB
#
#------------------------------------------------------------------------
!ifdef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
!endif
LIBRARY_NAME = nspng
#
# Make sure we have MOZILLA_CLIENT defined so we get the
# proper JS includes
#
LCFLAGS = $(LCFLAGS) -DMOZILLA_CLIENT
!ifdef BUILD_DEBUG_GC
LCFLAGS = $(LCFLAGS) -DDEBUG_GC
!endif
LCFLAGS = $(LCFLAGS) /TP
LLIBS= $(LIBNSPR) \
$(DIST)\lib\util.lib \
$(DIST)\lib\png.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\zlib.lib \
!ifdef NU_CACHE
$(DIST)\lib\cache.lib \
!endif
$(NULL)
LIBRARY= .\$(OBJDIR)\$(LIBNAME).lib
LIBRARY_SUFFIX = $(MOZ_BITS)$(VERSION_NUMBER)
MAKE_OBJ_TYPE=DLL
#//------------------------------------------------------------------------
#//
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
#//
#//------------------------------------------------------------------------
DLLNAME=nspng
DLL1NAME=nspng
PDBFILE=$(DLLNAME).pdb
MAPFILE=$(DLLNAME).map
DEFFILE=nspng.def
#//------------------------------------------------------------------------
#//
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
#// (these must be defined before the common makefiles are included)
#//
#//------------------------------------------------------------------------
DLL=.\$(OBJDIR)\$(DLLNAME).dll
MAPFILE= $(DLLNAME).map
MODULE=img
DEPTH=..\..\..
LINCS=-I$(DEPTH)/dist/public/xpcom -I. -I$(DEPTH)/dist/public/raptor \
-I$(DEPTH)/dist/public/png -I$(DEPTH)/dist/public/zlib -I$(DEPTH)/dist/public/img
CPPSRCS= nsPNGDecoder.cpp nsPNGCallback.cpp ipng.cpp
CPP_OBJS= \
.\$(OBJDIR)\nsPNGDecoder.obj \
.\$(OBJDIR)\nsPNGModule.obj \
.\$(OBJDIR)\ipng.obj
include <$(DEPTH)\config\rules.mak>
install:: $(DLL)
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib

View File

@ -1,139 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* -*- Mode: C; tab-width: 4 -*-
* nsPNGDecoder.cpp --- interface to png decoder
*/
#include "nsPNGDecoder.h"
#include "pngdec.h"
/*-----------class----------------*/
/*-------------------------------------------------*/
PNGDecoder::PNGDecoder(il_container* aContainer)
{
NS_INIT_REFCNT();
ilContainer = aContainer;
};
PNGDecoder::~PNGDecoder(void)
{
};
NS_IMPL_ISUPPORTS1(PNGDecoder, nsIImgDecoder)
NS_METHOD
PNGDecoder::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsresult rv;
if (aOuter) return NS_ERROR_NO_AGGREGATION;
il_container *ic = new il_container();
if (!ic) return NS_ERROR_OUT_OF_MEMORY;
PNGDecoder *decoder = new PNGDecoder(ic);
if (!decoder) {
delete ic;
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ADDREF(decoder);
rv = decoder->QueryInterface(aIID, aResult);
NS_RELEASE(decoder);
/* why are we creating and destroying this object for no reason? */
delete ic; /* is a place holder */
return rv;
}
/*----------------------------------------------------*/
// api functions
/*------------------------------------------------------*/
NS_IMETHODIMP
PNGDecoder::ImgDInit()
{
int ret;
if( ilContainer != NULL ) {
ret = il_png_init(ilContainer);
if(!ret)
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
PNGDecoder::ImgDWriteReady(PRUint32 *max_read)
{
/* dummy return needed */
*max_read = 2048;
return NS_OK;
}
NS_IMETHODIMP
PNGDecoder::ImgDWrite(const unsigned char *buf, int32 len)
{
int ret;
if( ilContainer != NULL ) {
ret = il_png_write(ilContainer, buf,len);
if(ret != 0)
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
PNGDecoder::ImgDComplete()
{
int ret;
if( ilContainer != NULL ) {
ret = il_png_complete(ilContainer);
if(ret != 0)
return NS_ERROR_FAILURE;
}
return NS_OK;
}
NS_IMETHODIMP
PNGDecoder::ImgDAbort()
{
int ret;
if( ilContainer != NULL ) {
ret = il_png_abort(ilContainer);
if(ret != 0)
return NS_ERROR_FAILURE;
}
return NS_OK;
}

View File

@ -1,58 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsPNGDecoder_h___
#define nsPNGDecoder_h___
#include "nsIImgDecoder.h"
/* 573010b0-de61-11d2-802c-0060088f91a3 */
#define NS_PNGDECODER_CID \
{ 0x573010b0, 0xde61, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
class PNGDecoder : public nsIImgDecoder
{
public:
PNGDecoder(il_container* aContainer);
virtual ~PNGDecoder();
NS_DECL_ISUPPORTS
static NS_METHOD Create(nsISupports *aOuter, const nsIID &aIID, void **aResult);
/* stream */
NS_IMETHOD ImgDInit();
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read);
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len);
NS_IMETHOD ImgDComplete();
NS_IMETHOD ImgDAbort();
NS_IMETHOD_(il_container *) SetContainer(il_container *ic){ilContainer = ic; return ic;}
NS_IMETHOD_(il_container *) GetContainer() {return ilContainer;}
private:
il_container* ilContainer;
};
#endif /* nsPNGDecoder_h___ */

View File

@ -1,40 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsPNGDecoder.h"
#include "nsIComponentManager.h"
#include "nsIGenericFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
static NS_DEFINE_CID(kPNGDecoderCID, NS_PNGDECODER_CID);
static nsModuleComponentInfo components[] =
{
{ "PNG Decoder",
NS_PNGDECODER_CID,
"@mozilla.org/image/decoder;1?type=image/png",
PNGDecoder::Create }
};
NS_IMPL_NSGETMODULE(nsPNGModule, components)

View File

@ -1,14 +0,0 @@
;
; temp def file for nspng dll
;
LIBRARY nspng.dll
DESCRIPTION 'test dll'
EXPORTS
ImgDInit @1002 PRIVATE
ImgDWrite @1003 PRIVATE
ImgDWriteReady @1004 PRIVATE
ImgDComplete @1005 PRIVATE
ImgDAbort @1006 PRIVATE

View File

@ -1,140 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* png_png.c - modified from example.c code */
#include "png.h"
#include "nsIImgDecoder.h" // include if_struct.h Needs to be first
#include "ipng.h"
#include "nsPNGDecoder.h"
#include "nsIImgDCallbk.h"
extern void png_set_dims(il_container *, png_structp);
void info_callback(png_structp png_ptr, png_infop info)
{
/* do any setup here, including setting any of the transformations
* mentioned in the Reading PNG files section. For now, you _must_
* call either png_start_read_image() or png_read_update_info()
* after all the transformations are set (even if you don't set
* any). You may start getting rows before png_process_data()
* returns, so this is your last chance to prepare for that.
*/
int number_passes;
double screen_gamma;
/*always decode to 24 bit*/
if(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && png_ptr->bit_depth <= 8)
png_set_expand(png_ptr);
if(png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth <= 8){
png_set_gray_to_rgb(png_ptr);
png_set_expand(png_ptr);
}
if(png_get_valid(png_ptr, info, PNG_INFO_tRNS))
png_set_expand(png_ptr);
/* implement scr gamma for mac & unix. (do preferences later.) */
#ifdef XP_MAC
screen_gamma = 1.7; /*Mac : 1.7 */
#else
screen_gamma = 2.2; /*good for PC.*/
#endif
/*
if (png_get_gAMA(png_ptr, info, (double *)&png_ptr->gamma))
png_set_gamma(png_ptr, screen_gamma, png_ptr->gamma);
else
png_set_gamma(png_ptr, screen_gamma, 0.45);
*/
if(png_ptr->interlaced == PNG_INTERLACE_ADAM7)
number_passes = png_set_interlace_handling(png_ptr);
png_read_update_info(png_ptr, info);
/* Set the ic values */
png_set_dims((il_container *)png_ptr->io_ptr, png_ptr);
}
void row_callback( png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass )
{
/* this function is called for every row in the image. If the
* image is interlacing, and you turned on the interlace handler,
* this function will be called for every row in every pass.
* Some of these rows will not be changed from the previous pass.
* When the row is not changed, the new_row variable will be NULL.
* The rows and passes are called in order, so you don't really
* need the row_num and pass, but I'm supplying them because it
* may make your life easier.
*
* For the non-NULL rows of interlaced images, you must call
* png_progressive_combine_row() passing in the row and the
* old row. You can call this function for NULL rows (it will
* just return) and for non-interlaced images (it just does the
* memcpy for you) if it will make the code easier. Thus, you
* can just do this for all cases:
*/
il_container *ic = (il_container *)png_ptr->io_ptr;
if(new_row){
ic->imgdcb->ImgDCBHaveRow( 0, new_row, 0, png_ptr->width,
row_num, 1, ilErase /* ilOverlay */, png_ptr->pass );
/* il_flush_image_data(png_ptr->io_ptr); */
}
/* where old_row is what was displayed for previous rows. Note
* that the first pass (pass == 0 really) will completely cover
* the old row, so the rows do not have to be initialized. After
* the first pass (and only for interlaced images), you will have
* to pass the current row, and the function will combine the
* old row and the new row.
*/
}
void end_callback(png_structp png_ptr, png_infop info)
{
/* this function is called when the whole image has been read,
* including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added
* to the comments and time fields.
*
* Most people won't do much here, perhaps setting a flag that
* marks the image as finished.
*/
il_container *ic = (il_container *)png_ptr->io_ptr;
ic->imgdcb->ImgDCBFlushImage();
}

View File

@ -1,30 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* pngdec.h */
extern int il_png_init(il_container *ic);
extern int il_png_write(il_container *, const PRUint8 *, int32);
extern int il_png_complete(il_container *ic);
extern int il_png_abort(il_container *ic);
//extern unsigned int il_png_write_ready(il_container *ic);

View File

@ -1,85 +0,0 @@
png_get_progressive_ptr ; 327
png_do_expand_palette ; 325
png_memcpy_check ; 325
png_read_push_finish_row ; 325
png_push_process_row ; 325
png_read_filter_row ; 325
png_do_read_transformations ; 325
png_push_have_row ; 325
png_push_fill_buffer ; 39
png_read_data ; 32
png_calculate_crc ; 28
png_crc_read ; 26
png_free ; 21
png_get_uint_32 ; 15
png_malloc ; 14
png_process_some_data ; 11
png_zalloc ; 10
png_zfree ; 10
png_push_read_chunk ; 7
png_crc_error ; 6
png_crc_finish ; 6
png_reset_crc ; 6
?ImgDWrite@PNGDecoder@@UAGIPBEJ@Z ; 3
?il_png_write@@YAHPAUil_container_struct@@PBEJ@Z ; 3
png_push_read_IDAT ; 3
png_free_data ; 3
png_process_data ; 3
png_push_restore_buffer ; 3
?Release@PNGDecoder@@UAGKXZ ; 2
png_create_struct ; 2
png_process_IDAT_data ; 2
png_destroy_struct ; 2
?SetContainer@PNGDecoder@@UAGPAUil_container_struct@@PAU2@@Z ; 2
png_set_gAMA_fixed ; 2
png_set_read_fn ; 2
?ImgDWriteReady@PNGDecoder@@UAGIPAI@Z ; 2
png_set_gAMA ; 2
?AddRef@PNGDecoder@@UAGKXZ ; 2
png_info_init ; 2
png_set_cHRM_fixed ; 1
png_handle_PLTE ; 1
png_create_read_struct ; 1
png_handle_sRGB ; 1
?Create@PNGDecoder@@SGIPAVnsISupports@@ABUnsID@@PAPAX@Z ; 1
png_create_info_struct ; 1
png_get_IHDR ; 1
png_set_PLTE ; 1
?il_png_init@@YAHPAUil_container_struct@@@Z ; 1
png_info_destroy ; 1
png_get_gAMA ; 1
png_read_start_row ; 1
?QueryInterface@PNGDecoder@@UAGIABUnsID@@PAPAX@Z ; 1
png_set_error_fn ; 1
png_read_transform_info ; 1
png_get_valid ; 1
png_push_have_end ; 1
png_set_cHRM ; 1
??_GPNGDecoder@@UAEPAXI@Z ; 1
png_push_have_info ; 1
NSGetModule ; 1
png_set_gamma ; 1
png_set_progressive_read_fn ; 1
png_memset_check ; 1
?il_png_abort@@YAHPAUil_container_struct@@@Z ; 1
png_destroy_read_struct ; 1
png_read_destroy ; 1
?ImgDComplete@PNGDecoder@@UAGIXZ ; 1
?ImgDInit@PNGDecoder@@UAGIXZ ; 1
png_handle_IHDR ; 1
?ImgDAbort@PNGDecoder@@UAGIXZ ; 1
png_handle_IEND ; 1
?il_png_complete@@YAHPAUil_container_struct@@@Z ; 1
png_init_read_transformations ; 1
png_push_save_buffer ; 1
png_read_update_info ; 1
png_handle_gAMA ; 1
png_set_sRGB_gAMA_and_cHRM ; 1
png_set_sRGB ; 1
png_set_IHDR ; 1
png_set_expand ; 1
png_get_channels ; 1
png_sig_cmp ; 1
??1PNGDecoder@@UAE@XZ ; 1
png_push_read_sig ; 1
??0PNGDecoder@@QAE@PAUil_container_struct@@@Z ; 1

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,18 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist:libimg directory
#
dummy_nc.h
ilErrors.h
ilIImageRenderer.h
ilINetContext.h
ilINetReader.h
ilISystemServices.h
ilIURL.h
il_icons.h
il_strm.h
il_types.h
il_util.h
libimg.h
ni_pixmp.h
xpcompat.h

View File

@ -1,55 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = img
EXPORTS = \
il_types.h \
ni_pixmp.h \
libimg.h \
il_icons.h \
il_strm.h \
il_util.h \
ilINetContext.h \
ilIURL.h \
ilINetReader.h \
ilIImageRenderer.h \
ilISystemServices.h \
dummy_nc.h \
xpcompat.h \
ilErrors.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
ifndef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
endif
include $(topsrcdir)/config/rules.mk

View File

@ -22,7 +22,7 @@
/* -*- Mode: C; tab-width: 4 -*-
* il_icons.h --- Image icon enumeration.
* $Id: il_icons.h,v 3.3 1999/11/06 03:31:19 dmose%mozilla.org Exp $
* $Id: il_icons.h,v 3.4 2001/06/19 08:46:23 pavlov%netscape.com Exp $
*/

View File

@ -22,7 +22,7 @@
/* -*- Mode: C; tab-width: 4 -*-
* il_strm.h --- Stream converters for the image library.
* $Id: il_strm.h,v 3.5 1999/11/06 03:31:20 dmose%mozilla.org Exp $
* $Id: il_strm.h,v 3.6 2001/06/19 08:46:24 pavlov%netscape.com Exp $
*/

View File

@ -22,7 +22,7 @@
/* -*- Mode: C; tab-width: 4 -*-
* il_types.h --- Image library data types and structures.
* $Id: il_types.h,v 3.6 2000/07/20 01:49:58 pnunn%netscape.com Exp $
* $Id: il_types.h,v 3.7 2001/06/19 08:46:25 pavlov%netscape.com Exp $
*/

View File

@ -23,7 +23,7 @@
/* -*- Mode: C; tab-width: 4 -*-
* il_util.h Colormap and colorspace utilities.
*
* $Id: il_util.h,v 3.5 1999/11/13 22:37:34 cls%seawood.org Exp $
* $Id: il_util.h,v 3.6 2001/06/19 08:46:27 pavlov%netscape.com Exp $
*/

View File

@ -22,7 +22,7 @@
/* -*- Mode: C; tab-width: 4 -*-
* libimg.h --- API calls to the Image Library.
* $Id: libimg.h,v 3.9 2000/09/14 23:09:18 pnunn%netscape.com Exp $
* $Id: libimg.h,v 3.10 2001/06/19 08:46:28 pavlov%netscape.com Exp $
*/

View File

@ -21,7 +21,7 @@
*/
/*
* ni_pixmp.h --- Cross platform pixmap data structure.
* $Id: ni_pixmp.h,v 3.5 1999/11/13 22:37:35 cls%seawood.org Exp $
* $Id: ni_pixmp.h,v 3.6 2001/06/19 08:46:30 pavlov%netscape.com Exp $
*/

View File

@ -1,103 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* The purpose of this file is to help phase out XP_ library
* from the image library. In general, XP_ data structures and
* functions will be replaced with the PR_ or PL_ equivalents.
* In cases where the PR_ or PL_ equivalents don't yet exist,
* this file (and its source equivalent) will play the role
* of the XP_ library.
*/
#ifndef xpcompat_h___
#define xpcompat_h___
#include "xp_core.h"
#include "prtypes.h"
#include "nsCom.h"
#define XP_HUGE
#define XP_HUGE_ALLOC(SIZE) malloc(SIZE)
#define XP_HUGE_FREE(SIZE) free(SIZE)
#define XP_HUGE_MEMCPY(DEST, SOURCE, LEN) memcpy(DEST, SOURCE, LEN)
#define XP_HUGE_CHAR_PTR char XP_HUGE *
typedef void
(*TimeoutCallbackFunction) (void * closure);
PR_BEGIN_EXTERN_C
/*
* XP_GetString is a mechanism for getting localized strings from a
* resource file. It needs to be replaced with a PR_ equivalent.
*/
extern char *XP_GetString(int i);
/*
* I don't know if qsort will ever be in NSPR, so this might have
* to stay here indefinitely. Mac is completely broken and should use
* mozilla/include/xp_qsort.h, mozilla/lib/xp/xp_qsort.c.
*/
#if defined(XP_MAC_NEVER)
extern void XP_QSORT(void *, size_t, size_t,
int (*)(const void *, const void *));
#endif /* XP_MAC */
NS_EXPORT void* IL_SetTimeout(TimeoutCallbackFunction func, void * closure, PRUint32 msecs);
NS_EXPORT void IL_ClearTimeout(void *timer_id);
#define MK_UNABLE_TO_LOCATE_FILE -1
#define MK_OUT_OF_MEMORY -2
#define XP_MSG_IMAGE_PIXELS -7
#define XP_MSG_IMAGE_NOT_FOUND -8
#define XP_MSG_XBIT_COLOR -9
#define XP_MSG_1BIT_MONO -10
#define XP_MSG_XBIT_GREYSCALE -11
#define XP_MSG_XBIT_RGB -12
#define XP_MSG_DECODED_SIZE -13
#define XP_MSG_WIDTH_HEIGHT -14
#define XP_MSG_SCALED_FROM -15
#define XP_MSG_IMAGE_DIM -16
#define XP_MSG_COLOR -17
#define XP_MSG_NB_COLORS -18
#define XP_MSG_NONE -19
#define XP_MSG_COLORMAP -20
#define XP_MSG_BCKDRP_VISIBLE -21
#define XP_MSG_SOLID_BKGND -22
#define XP_MSG_JUST_NO -23
#define XP_MSG_TRANSPARENCY -24
#define XP_MSG_COMMENT -25
#define XP_MSG_UNKNOWN -26
#define XP_MSG_COMPRESS_REMOVE -27
PR_END_EXTERN_C
#endif

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,10 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist:libimg directory
#
if_struct.h
il.h
il_utilp.h
nsIImgDecoder.h
nsImgDCallbk.h
nsIImgDCallbk.h

View File

@ -1,48 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = img
# XXX nsImgDCallbk.h should go into libimg/src instead of being here
EXPORTS = \
il.h \
if_struct.h \
il_utilp.h \
nsIImgDecoder.h \
nsIImgDCallbk.h \
nsImgDCallbk.h \
$(NULL)
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
ifndef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
endif
include $(topsrcdir)/config/rules.mk

View File

@ -1,344 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* if.h --- Top-level image library internal routines
*
* $Id: if_struct.h,v 1.17 2001/03/20 05:30:56 cls%seawood.org Exp $
*/
#ifndef _if_h
#ifndef _ifstruct_h
#define _ifstruct_h
#define M12N
#define IL_INTERNAL
#include "prtypes.h"
#include "prlog.h"
#include "prmem.h"
#include "plstr.h"
#include "prtime.h"
#include "prlong.h"
#include "nsIPresContext.h"
#include "nsIImgDecoder.h"
typedef struct _IL_GroupContext IL_GroupContext;
typedef struct _IL_ImageReq IL_ImageReq;
typedef struct il_context_list il_context_list;
typedef struct il_container_list il_container_list;
typedef struct il_container_struct il_container;
#include "il_icons.h" /* Image icons. */
#include "libimg.h" /* Public API to Image Library. */
#include "il_utilp.h" /* Private header for colormap/colorspaces. */
#include "il_util.h" /* Public API for colormaps/colorspaces. */
#include "ilINetContext.h"
#include "ilIURL.h"
#include "ilINetReader.h"
#include "ilIImageRenderer.h"
#include "il.h"
#ifdef XP_WIN
#define _USD 1 /* scanlines upside-down */
#endif
/* For debugging counts of loading, looping and aborted images, needed for
group observer notification. */
/* #define DEBUG_GROUP_OBSERVER */
#define FREE_IF_NOT_NULL(x) do {if (x) {PR_FREEIF(x); (x) = NULL;}} while (0)
#include "prtypes.h" /* for IS_LITTLE_ENDIAN / IS_BIG_ENDIAN */
/* The imagelib labels bits in a 32-bit word from 31 on the left to 0 on the right.
This macro performs the necessary conversion to make that definition work on
little-endian platforms */
#if defined(IS_LITTLE_ENDIAN)
# define M32(bit) ((bit) ^ 0x18)
#elif defined(IS_BIG_ENDIAN)
# define M32(bit) (bit)
#else
ENDIANNESS UNKNOWN!
#endif
/* Don't change these unless you know what you're doing or you will
break 16-bit binaries. */
#define MAX_IMAGE_WIDTH 8000
#define MAX_IMAGE_HEIGHT 8000
/* MAX and MIN are almost universal, but be paranoid and use our
definitions. */
#ifdef MAX
#undef MAX
#endif
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#ifdef MIN
#undef MIN
#endif
#define MIN(x, y) ((x) < (y) ? (x) : (y))
/* Last output pass of an image */
#define IL_FINAL_PASS -1
/* Nature of the conversion from source image colorspace to target image
colorspace. */
typedef enum _IL_ConversionType {
IL_TrueToTrue = 0x09,
IL_TrueToPseudo = 0x0a,
IL_TrueToGrey = 0x0c,
IL_PseudoToTrue = 0x11,
IL_PseudoToPseudo = 0x12,
IL_PseudoToGrey = 0x14,
IL_GreyToTrue = 0x21,
IL_GreyToPseudo = 0x22,
IL_GreyToGrey = 0x24
} IL_ConversionType;
typedef void (*il_converter)(il_container *ic, const PRUint8 *mask,
const PRUint8 *sp, int x_offset,
int num, void XP_HUGE *out);
enum icstate {
IC_VIRGIN = 0x00, /* Newly-created container */
IC_START = 0x01, /* Requested stream from netlib, but no data yet */
IC_STREAM = 0x02, /* Stream opened, but insufficient data
received to determine image size */
IC_SIZED = 0x04, /* Image size determined - still loading */
IC_MULTI = 0x06, /* Same as IC_SIZED, but for second or
subsequent images in multipart MIME */
IC_NOCACHE = 0x11, /* Image deferred for loading later */
IC_COMPLETE = 0x20, /* Image loaded - no errors */
IC_BAD = 0x21, /* Corrupt or illegal image data */
IC_INCOMPLETE = 0x22, /* Partially loaded image data */
IC_MISSING = 0x23, /* No such file on server */
IC_ABORT_PENDING= 0x24 /* Image download abort in progress */
};
/* Still receiving data from the netlib ? */
#define IMAGE_CONTAINER_ACTIVE(ic) ((ic)->state <= IC_MULTI)
/* Force memory cache to be flushed ? */
#define FORCE_RELOAD(reload_method) \
(reload_method = DONT_USE_IMG_CACHE)
/* Simple list of image contexts. */
struct il_context_list {
IL_GroupContext *img_cx;
struct il_context_list *next;
};
/* Simple list of image containers. */
struct il_container_list {
il_container *ic;
struct il_container_list *next;
};
/* There is one il_container per real image */
struct il_container_struct {
il_container *next; /* Cache bidirectional linked list */
il_container *prev;
ilIURL *url;
char *url_address; /* Same as url->address if there is no redirection*/
PRUint32 hash;
PRUint32 urlhash;
enum icstate state;
int sized;
int moz_type; /* TYPE_CHROME, etc. */
int is_alone; /* only image on a page */
int is_in_use; /* Used by some context */
int32 loop_count; /* Remaining number of times to repeat image,
-1 means loop infinitely */
int is_looping; /* TRUE if this is the second or subsequent
pass of an animation. */
nsImageAnimation animate_request; /* Set in nsPresContext.
normal = 0; one frame = 1; one loop = 2 */
int is_aborted; /* True if aborted by NetLib. */
PRPackedBool is_url_loading;/* TRUE if NetLib is currently loading the URL. */
int is_multipart; /* TRUE if stream is known to be multipart. */
int multi; /* Known to be either multipart-MIME
or multi-image format */
int new_data_for_fe; /* Any Scanlines that FE doesn't know about ? */
int update_start_row; /* Scanline range to send to FE */
int update_end_row;
PRUint32 bytes_consumed; /* Bytes read from the stream so far */
NI_PixmapHeader *src_header; /* Source image header information. */
IL_Pixmap *image; /* Destination image pixmap structure. */
IL_Pixmap *mask; /* Destination mask pixmap structure. */
char* type;
void *ds; /* decoder's private data */
il_converter converter;
void *quantize; /* quantizer's private data */
class nsIImgDecoder *imgdec;
class nsIImgDCallbk *imgdcb;
void *row_output_timeout;
PRUint8 *scalerow;
int pass; /* pass (scan #) of a multi-pass image.
Used for interlaced GIFs & p-JPEGs */
int forced;
PRUint32 content_length;
int dest_width, dest_height; /* Target dimensions of the image */
PRPackedBool natural_size; /* True if the image is decoded to its natural
size. */
PRPackedBool aspect_distorted; /* True if the image undergoes aspect ratio
distortion during decoding. */
IL_IRGB *background_color; /* The requested background color for this
image (only applies if the image is
determined to be transparent.) A mask will
be created for a transparent image only if
no background color was requested. */
char *comment; /* Human-readable text stored in image */
int comment_length;
int colormap_serial_num; /* serial number of last installed colormap */
int dont_use_custom_palette;
int rendered_with_custom_palette;
IL_DitherMode dither_mode; /* ilDither or ilClosestColor */
IL_GroupContext *img_cx; /* The context in which this image was created.
Used during image decoding only. */
IL_DisplayType display_type; /* Type of display for which the container
is created. */
ilIImageRenderer *img_cb;
ilINetContext *net_cx; /* Context which initiated this transfer. */
IL_ImageReq *clients; /* List of clients of this container. */
IL_ImageReq *lclient; /* Last client in the client list. */
il_context_list *img_cx_list; /* List of contexts which have clients of
this container. */
IL_Rect displayable_rect; /* The area of the image pixmap which is in a
displayable state. Used as a filter
between client calls to IL_DisplaySubImage
and Image Library calls to DisplayPixmap, in
the event that the client requests us to
draw a part of the pixmap that has yet to
be decoded. */
time_t expires; /* Expiration date for the corresponding URL */
#ifdef DEBUG
PRTime start_time;
#endif
char *fetch_url; /* actual url address used */
};
typedef enum { ilUndefined, ilCI, ilGrey, ilRGB } il_mode;
typedef enum il_draw_mode
{
ilErase, /* Transparent areas are reset to background */
ilOverlay /* Transparent areas overlay existing data */
} il_draw_mode;
/* A context for a group of images. */
struct _IL_GroupContext {
ilIImageRenderer *img_cb;
void *dpy_cx; /* An opaque pointer passed back to all
callbacks in the interface vtable. */
IL_DisplayType display_type; /* IL_Console, IL_Printer or IL_PostScript. */
IL_ColorSpace *color_space; /* Display colorspace. */
/* Preferences */
PRPackedBool progressive_display; /* If TRUE, images are displayed while
loading */
IL_DitherMode dither_mode; /* IL_ClosestColor, IL_Dither or IL_Auto. */
int dontscale; /* Used for Macs, which do their own scaling */
int nolowsrc; /* If TRUE, never display LOSRC images */
/* Per-context state */
il_container_list *container_list;/* List of containers in this context. */
int32 num_containers; /* Number of containers in this context. */
int32 num_loading; /* Number of containers which are currently
loading. */
int32 num_looping; /* Number of containers which are currently
looping i.e. on second or subsequent
iteration of an animation. */
int32 num_aborted; /* Number of containers which have aborted
so far. */
XP_ObserverList obs_list; /* List of observers for this image group. */
struct _IL_GroupContext *next; /* Next entry in a list of image group
contexts. */
};
/* Tag to indicate whether a request represents an image or an icon. */
typedef enum
{
IL_IMAGE,
IL_ICON
} IL_ImageType;
/* This is Image Library's internal representation of a client's image request.
It represents a handle on a specific instance of an image container. */
struct _IL_ImageReq {
il_container *ic; /* The image container for this request (may
be shared with other requests.) */
IL_ImageType image_type; /* Image or icon. */
IL_GroupContext *img_cx; /* The group context to which this request
belongs. */
ilINetContext *net_cx; /* A clone of the net context which the image
library was given when this image handle was
created. This serves as a backup in case
the image container's net_cx becomes invalid,
(for example, when the client for which the
container was initially created is destroyed.) */
PRPackedBool stopped; /* TRUE - if user hit "Stop" button */
int is_view_image; /* non-zero if client is
internal-external-reconnect */
XP_ObserverList obs_list; /* List of observers for this request. */
struct _IL_ImageReq *next; /* Next entry in a list of image requests. */
};
#endif
#endif

View File

@ -1,58 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* -*- Mode: C; tab-width: 4 -*-
* il.h --- Exported image library interface
*
* $Id: il.h,v 1.4 2000/07/20 01:51:20 pnunn%netscape.com Exp $
*/
/*
* global defines for image lib users
*/
#ifndef _IL_H
#define _IL_H
/* attr values */
#define IL_ATTR_RDONLY 0
#define IL_ATTR_RW 1
#define IL_ATTR_TRANSPARENT 2
#define IL_ATTR_HONOR_INDEX 4
#undef ABS
#define ABS(x) (((x) < 0) ? -(x) : (x))
/* A fast but limited, perceptually-weighted color distance function */
#define IL_COLOR_DISTANCE(r1, r2, g1, g2, b1, b2) \
((ABS((g1) - (g2)) << 2) + (ABS((r1) - (r2)) << 1) + (ABS((b1) - (b2))))
/* We don't distinguish between colors that are "closer" together
than this. The appropriate setting is a subjective matter. */
#define IL_CLOSE_COLOR_THRESHOLD 6
#endif /* _IL_H */

View File

@ -1,82 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* -*- Mode: C; tab-width: 4 -*-
* il_utilp.h Colormap and colorspace utilities - types and definitions
* private to Image Library.
*
* $Id: il_utilp.h,v 1.4 1999/11/13 22:37:37 cls%seawood.org Exp $
*/
/************************* Colormap utilities ********************************/
/* Parameters for building a color cube and its associated lookup table. */
#define LOOKUP_TABLE_SIZE 32768
#define LOOKUP_TABLE_RED 32
#define LOOKUP_TABLE_GREEN 32
#define LOOKUP_TABLE_BLUE 32
#define CUBE_MAX_SIZE 256
/* Macro to convert 8-bit/channel RGB data into an 8-bit colormap index. */
#define COLORMAP_INDEX(lookup_table, red, green, blue) \
lookup_table[LOOKUP_TABLE_INDEX(red, green, blue)]
/* Macro to convert 8-bit/channel RGB data into a 16-bit lookup table index.
The lookup table value is the index to the colormap. */
#define LOOKUP_TABLE_INDEX(red, green, blue) \
((USE_5_BITS(red) << 10) | \
(USE_5_BITS(green) << 5) | \
USE_5_BITS(blue))
/* Take the 5 most significant bits of an 8-bit value. */
#define USE_5_BITS(x) ((x) >> 3)
/* Scaling macro for creating color cubes. */
#define CUBE_SCALE(val, double_new_size_minus1, old_size_minus1, \
double_old_size_minus1) \
((val) * (double_new_size_minus1) + (old_size_minus1)) / \
(double_old_size_minus1)
/************************** Colorspace utilities *****************************/
/* Image Library private part of an IL_ColorSpace structure. */
typedef struct il_ColorSpaceData {
/* RGB24 to RGBN depth conversion maps. Each of these maps take an
8-bit input for a color channel and converts it into that channel's
contribution to a depth N pixmap e.g. for a 24 to 16-bit color
conversion, the output pixel is given by
PRUint8 red, green, blue;
PRUint16 output_pixel;
output_pixel = r8torgbn[red] + g8torgbn[green] + b8torgbn[blue];
Depth conversion maps are created for the following destination image
pixmap depths: N = 8, 16 and 32. The type of the array elements is a
PRUintn. */
void *r8torgbn;
void *g8torgbn;
void *b8torgbn;
} il_ColorSpaceData;

View File

@ -1,52 +0,0 @@
#!gmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ..\..\..
#//------------------------------------------------------------------------
#//
#// Specify any "command" targets. (ie. DIRS, INSTALL_FILES, ...)
#// (these must come before the common makefiles are included)
#//
#// DIRS - There is a subdirectory to process
#// INSTALL_FILES - Files to be installed in the distribution area
#//
#//------------------------------------------------------------------------
INSTALL_FILE_LIST=*.h
INSTALL_DIR=$(XPDIST)\include
LCFLAGS = $(LCFLAGS) /TP
MODULE=img
DEPTH=..\..\..
EXPORTS= if_struct.h il.h il_utilp.h \
nsIImgDecoder.h nsIImgDCallbk.h nsImgDCallbk.h
include <$(DEPTH)/config/rules.mak>
export:: INSTALL_FILES

View File

@ -1,61 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsIImgDCallbk_h___
#define nsIImgDCallbk_h___
#include "xpcompat.h" // for TimeoutCallbackFunction
#include "nsISupports.h"
/* d34a2f20-cd9f-11d2-802c-0060088f91a3 */
#define NS_IIMGDCALLBK_IID \
{ 0xd34a2f20, 0xcd9f, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
class nsIImgDCallbk : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IIMGDCALLBK_IID)
NS_IMETHOD ImgDCBFlushImage()=0;
NS_IMETHOD ImgDCBImageSize()=0;
NS_IMETHOD ImgDCBResetPalette()=0;
NS_IMETHOD ImgDCBInitTransparentPixel()=0;
NS_IMETHOD ImgDCBDestroyTransparentPixel()=0;
NS_IMETHOD ImgDCBSetupColorspaceConverter()=0;
NS_IMETHOD ImgDCBCreateGreyScaleColorSpace()=0;
NS_IMETHOD_(void*) ImgDCBSetTimeout(TimeoutCallbackFunction func, void* closure, PRUint32 msecs)=0;
NS_IMETHOD ImgDCBClearTimeout(void *timer_id)=0;
NS_IMETHOD ImgDCBHaveHdr(int destwidth, int destheight )=0;
NS_IMETHOD ImgDCBHaveRow(PRUint8 *rowbuf, PRUint8* rgbrow, int x_offset, int len,
int row, int dup_rowcnt, PRUint8 draw_mode,
int pass )=0;
NS_IMETHOD ImgDCBHaveImageFrame()=0;
NS_IMETHOD ImgDCBHaveImageAll()=0;
NS_IMETHOD ImgDCBError()=0;
};
#endif /* nsIImgDCallbk_h___ */

View File

@ -1,56 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef _nsIImgDecoder_h
#define _nsIImgDecoder_h
#include "if_struct.h" // for il_container
#include "ni_pixmp.h"
#include "nsISupports.h"
/* f00c22b0-bbd2-11d2-802c-0060088f91a3 */
#define NS_IIMGDECODER_IID \
{ 0xf00c22b0, 0xbbd2, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
#define NS_IIMGDECODER_BASE_CONTRACTID "@mozilla.org/image/decoder;1?type="
class nsIImgDecoder : public nsISupports
{
public:
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IIMGDECODER_IID)
NS_IMETHOD ImgDInit()=0;
NS_IMETHOD ImgDWriteReady(PRUint32 *max_read)=0;
NS_IMETHOD ImgDWrite(const unsigned char *buf, int32 len)=0;
NS_IMETHOD ImgDComplete()=0;
NS_IMETHOD ImgDAbort()=0;
// XXX Need to fix this to make sure return type is nsresult
NS_IMETHOD_(il_container *) SetContainer(il_container *ic) = 0;
NS_IMETHOD_(il_container *) GetContainer() = 0;
};
#endif

View File

@ -1,85 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsImgDCallbk_h___
#define nsImgDCallbk_h___
// XXX This file needs to move to libimg/src - dp
#include "nsIImgDCallbk.h"
/*---------------------------------------------*/
/*-----------------class-----------------------*/
class ImgDCallbk : public nsIImgDCallbk
{
public:
ImgDCallbk(il_container *aContainer) {
NS_INIT_ISUPPORTS();
ilContainer = aContainer;
};
virtual ~ImgDCallbk();
NS_DECL_ISUPPORTS
NS_IMETHOD ImgDCBFlushImage();
NS_IMETHOD ImgDCBImageSize();
NS_IMETHOD ImgDCBResetPalette();
NS_IMETHOD ImgDCBInitTransparentPixel();
NS_IMETHOD ImgDCBDestroyTransparentPixel();
NS_IMETHOD ImgDCBSetupColorspaceConverter();
NS_IMETHOD ImgDCBCreateGreyScaleColorSpace();
NS_IMETHOD_(void*) ImgDCBSetTimeout(TimeoutCallbackFunction func,
void* closure, PRUint32 msecs);
NS_IMETHOD ImgDCBClearTimeout(void *timer_id);
/* callbacks from the decoder */
NS_IMETHOD ImgDCBHaveHdr(int destwidth, int destheight);
NS_IMETHOD ImgDCBHaveRow(PRUint8*, PRUint8*,
int, int, int, int,
PRUint8 , int);
NS_IMETHOD ImgDCBHaveImageFrame();
NS_IMETHOD ImgDCBHaveImageAll();
NS_IMETHOD ImgDCBError();
NS_IMETHODIMP CreateInstance(const nsCID &aClass,
il_container* ic,
const nsIID &aIID,
void **ppv) ;
il_container *GetContainer() {
return ilContainer;
};
il_container *SetContainer(il_container *ic) {
ilContainer=ic;
return ic;
};
private:
il_container* ilContainer;
};
#endif /* nsImgDCallbk_h___ */

View File

@ -1,64 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#if 0 // OBSOLETE
#ifndef nsImgDecCIID_h__
#define nsImgDecCIID_h__
#include "nsRepository.h"
/* f00c22b0-bbd2-11d2-802c-0060088f91a3 */
#define NS_IIMGDECODER_IID \
{ 0xf00c22b0, 0xbbd2, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
/***************************************************/
#define NS_IMGDECODER_CID \
{ 0xc9089cc0, 0xbaf4, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
/* bc60b730-bbcf-11d2-802c-0060088f91a3 */
#define NS_IMGDECODER_IID \
{ 0xbc60730, 0xbbcf, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
NS_DEFINE_IID(kImgDecoderIID, NS_IMGDECODER_IID);
NS_DEFINE_IID(kImgDecoderCID, NS_IMGDECODER_CID);
/***************************************************/
/* e41ac650-cd9f-11d2-802c-0060088f91a3 */
#define NS_IMGDCALLBK_CID \
{ 0xe41ac650, 0xcd9f, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
/* d34a2f20-cd9f-11d2-802c-0060088f91a3 */
#define NS_IMGDCALLBK_IID \
{ 0xd34a2f20, 0xcd9f, 0x11d2, \
{ 0x80, 0x2c, 0x00, 0x60, 0x08, 0x8f, 0x91, 0xa3 } }
#endif
#endif /* 0 */

View File

@ -1,32 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#if 0 // OBSOLETE
#ifndef nsImgDec_h___
#define nsImgDec_h___
#include "nsIFactory.h"
#endif
#endif /* 0 */

View File

@ -1 +0,0 @@
Makefile

View File

@ -1,4 +0,0 @@
#
# This is a list of local files which get copied to the mozilla:dist directory
#

View File

@ -1,64 +0,0 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = img
LIBRARY_NAME = img_s
REQUIRES = xpcom string layout util locale cookie necko timer jpeg unicharutil
CPPSRCS = \
ilNetReader.cpp \
color.cpp \
colormap.cpp \
dither.cpp \
if.cpp \
ilclient.cpp \
il_util.cpp \
scale.cpp \
xpcompat.cpp \
$(NULL)
LOCAL_INCLUDES = -I$(srcdir)
ifndef MOZ_JAVA
LOCAL_JMC_SUBDIR = .
endif
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
ifeq ($(OS_ARCH),Linux)
DEFINES += -D_BSD_SOURCE -D_XOPEN_SOURCE=500
endif
ifeq ($(OS_ARCH)$(OS_RELEASE),SunOS5)
ifeq ($(shell uname -r),5.3)
# In this special case (dither.cpp), the compiler has to know
# the OS version to a finer granularity than normal.
DEFINES += -DOSMINOR=3
endif
endif

View File

@ -38,7 +38,7 @@
Includes dithering for B&W displays, but not dithering
for PseudoColor displays which can be found in dither.c.
$Id: color.cpp,v 3.18 2001/06/13 01:13:35 pavlov%netscape.com Exp $
$Id: color.cpp,v 3.19 2001/06/19 08:46:54 pavlov%netscape.com Exp $
*/

View File

@ -23,7 +23,7 @@
/* -*- Mode: C; tab-width: 4 -*-
* colormap.c
*
* $Id: colormap.cpp,v 3.4 2001/01/10 06:12:10 jgmyers%netscape.com Exp $
* $Id: colormap.cpp,v 3.5 2001/06/19 08:46:56 pavlov%netscape.com Exp $
*/

View File

@ -22,7 +22,7 @@
/* if.h --- Top-level image library internal routines
*
* $Id: if.h,v 3.27 2001/03/20 05:30:59 cls%seawood.org Exp $
* $Id: if.h,v 3.28 2001/06/19 08:47:00 pavlov%netscape.com Exp $
*/
#ifndef _if_h

View File

@ -23,7 +23,7 @@
/* -*- Mode: C; tab-width: 4 -*-
* il_util.c Colormap and colorspace utilities.
*
* $Id: il_util.cpp,v 3.8 2000/07/20 01:52:02 pnunn%netscape.com Exp $
* $Id: il_util.cpp,v 3.9 2001/06/19 08:47:03 pavlov%netscape.com Exp $
*/

View File

@ -1,166 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsISupports.h"
#include "nsImgDecCID.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
NS_DEFINE_CID(kGIFDecoderCID, NS_IMGDECODER_CID);
NS_DEFINE_CID(kJPGDecoderCID, NS_IMGDECODER_CID);
class ImgFactoryImpl : public nsIFactory
{
public:
ImgFactoryImpl(const nsCID &aClass, const char* className, const char* contractID);
NS_DECL_ISUPPORTS
NS_IMETHOD CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult);
NS_IMETHOD LockFactory(PRBool aLock);
protected:
virtual ~ImgFactoryImpl();
protected:
nsCID mClassID;
const char* mClassName;
const char* mContractID;
};
/*---------------------*/
ImgFactoryImpl::ImgFactoryImpl(const nsCID &aClass,
const char* className,
const char* contractID)
: mClassID(aClass), mClassName(className), mContractID(contractID)
{
NS_INIT_REFCNT();
}
ImgFactoryImpl::~ImgFactoryImpl()
{
}
NS_IMETHODIMP
ImgFactoryImpl::QueryInterface(const nsIID &aIID, void **aResult)
{
if (! aResult)
return NS_ERROR_NULL_POINTER;
// Always NULL result, in case of failure
*aResult = nsnull;
if (aIID.Equals(kISupportsIID)) {
*aResult = NS_STATIC_CAST(nsISupports*, this);
AddRef();
return NS_OK;
} else if (aIID.Equals(kIFactoryIID)) {
*aResult = NS_STATIC_CAST(nsIFactory*, this);
AddRef();
return NS_OK;
}
return NS_NOINTERFACE;
}
NS_IMPL_ADDREF(ImgFactoryImpl);
NS_IMPL_RELEASE(ImgFactoryImpl);
extern nsresult
NS_NewDefaultResource(nsIRDFResource** aResult);
NS_IMETHODIMP
ImgFactoryImpl::CreateInstance(nsISupports *aOuter,
const nsIID &aIID,
void **aResult)
{
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aOuter)
return NS_ERROR_NO_AGGREGATION;
*aResult = nsnull;
nsresult rv;
PRBool wasRefCounted = PR_TRUE;
nsISupports *inst = nsnull;
if (mClassID.Equals(kGIFDecoderCID)) {
if (NS_FAILED(rv = NS_NewGIFDecoder((nsIGIFDecoder**) &inst)))
return rv;
}
if (mClassID.Equals(kJPEGDecoderCID)) {
if (NS_FAILED(rv = NS_NewJPGDecoder((nsIJPGDecoder**) &inst)))
return rv;
}
else {
return NS_ERROR_NO_INTERFACE;
}
if (! inst)
return NS_ERROR_OUT_OF_MEMORY;
if (NS_FAILED(rv = inst->QueryInterface(aIID, aResult)))
delete inst;
if (wasRefCounted)
NS_IF_RELEASE(inst);
return rv;
}
nsresult ImgFactoryImpl::LockFactory(PRBool aLock)
{
return NS_OK;
}
/*---------------------*/
/* return the proper factory to the caller */
extern "C" PR_IMPLEMENT(nsresult)
NSGetFactory(nsISupports* serviceMgr,
const nsCID &aClass,
const char *aClassName,
const char *aContractID,
nsIFactory **aFactory)
{
if (! aFactory)
return NS_ERROR_NULL_POINTER;
ImgFactoryImpl* factory = new ImgFactoryImpl(aClass, aClassName, aContractID);
if (factory == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(factory);
*aFactory = factory;
return NS_OK;
}

View File

@ -1,95 +0,0 @@
?il_partial@@YAXPAUil_container_struct@@HHH@Z ; 1357286
?il_emit_row@@YAHPAUil_container_struct@@PAE1HHHHW4il_draw_mode@@H@Z ; 1357286
?ImgDCBHaveRow@ImgDCallbk@@UAGIPAE0HHHHEH@Z ; 1357286
IL_AddRefToColorSpace ; 138105
IL_ReleaseColorSpace ; 138094
XP_NotifyObservers ; 97013
IL_GetImagePixmap ; 96561
?il_progress_notify@@YAXPAUil_container_struct@@@Z ; 44047
?il_flush_image_data@@YAXPAUil_container_struct@@@Z ; 43843
?ImgDCBInitTransparentPixel@ImgDCallbk@@UAGIXZ ; 42416
?il_init_image_transparent_pixel@@YAHPAUil_container_struct@@@Z ; 42416
?il_destroy_image_transparent_pixel@@YAXPAUil_container_struct@@@Z ; 42341
IL_SetTimeout ; 41179
?il_pixmap_update_notify@@YAXPAUil_container_struct@@@Z ; 41074
?ImgDCBFlushImage@ImgDCallbk@@UAGIXZ ; 41070
?il_frame_complete_notify@@YAXPAUil_container_struct@@@Z ; 41069
?ImgDCBHaveImageFrame@ImgDCallbk@@UAGIXZ ; 41069
?ImgDCBSetTimeout@ImgDCallbk@@UAGPAXP6AXPAX@Z0I@Z ; 41069
?ImgDCBDestroyTransparentPixel@ImgDCallbk@@UAGIXZ ; 41039
?compare_PRUint32@@YAHPBX0PAX@Z ; 13734
?AddRef@NetReaderImpl@@UAGKXZ ; 7119
?Release@NetReaderImpl@@UAGKXZ ; 7119
?il_image_stopped@@YAHPAUil_container_struct@@@Z ; 4275
?IL_StreamWrite@@YAHPAUil_container_struct@@PBEJ@Z ; 2973
?IL_StreamWriteReady@@YAHPAUil_container_struct@@@Z ; 2973
?Write@NetReaderImpl@@UAGIPBEJ@Z ; 2973
?WriteReady@NetReaderImpl@@UAGIPAI@Z ; 2973
?il_reset_palette@@YAHPAUil_container_struct@@@Z ; 2709
?il_compute_percentage_complete@@YAHHPAUil_container_struct@@@Z ; 1455
??0NetReaderImpl@@QAE@PAUil_container_struct@@@Z ; 1418
?StreamCreated@NetReaderImpl@@UAEHPAVilIURL@@PAD@Z ; 1418
?IL_NewNetReader@@YAPAVilINetReader@@PAUil_container_struct@@@Z ; 1418
?FlushImgBuffer@NetReaderImpl@@UAGIXZ ; 1418
??1NetReaderImpl@@UAE@XZ ; 1418
?NetRequestDone@NetReaderImpl@@UAGIPAVilIURL@@H@Z ; 1418
?IL_StreamCreated@@YAHPAUil_container_struct@@PAVilIURL@@PAD@Z ; 1418
?IL_NetRequestDone@@YAXPAUil_container_struct@@PAVilIURL@@H@Z ; 1418
??_GNetReaderImpl@@UAEPAXI@Z ; 1418
?StreamComplete@NetReaderImpl@@UAGIH@Z ; 1409
?sniffout_mimetype@@YAHPBDJPAD@Z ; 1409
?il_setup_color_space_converter@@YAHPAUil_container_struct@@@Z ; 1409
?IL_StreamComplete@@YAXPAUil_container_struct@@H@Z ; 1409
?il_size@@YAHPAUil_container_struct@@@Z ; 1409
?FirstWrite@NetReaderImpl@@UAGIPBEJPAD@Z ; 1409
?ImgDCBSetupColorspaceConverter@ImgDCallbk@@UAGIXZ ; 1409
?ImgDCBImageSize@ImgDCallbk@@UAGIXZ ; 1409
?IL_StreamFirstWrite@@YAHPAUil_container_struct@@PBEJ@Z ; 1409
?ImgDCBResetPalette@ImgDCallbk@@UAGIXZ ; 1407
?il_image_complete_notify@@YAXPAUil_container_struct@@@Z ; 1352
?il_image_complete@@YAXPAUil_container_struct@@@Z ; 1352
?ImgDCBHaveImageAll@ImgDCallbk@@UAGIXZ ; 1352
XP_DisposeObserverList ; 271
?il_group_notify@@YAXPAU_IL_GroupContext@@J@Z ; 232
?il_image_destroyed_notify@@YAXPAU_IL_ImageReq@@@Z ; 220
?il_add_client@@YAHPAU_IL_GroupContext@@PAUil_container_struct@@PAU_IL_ImageReq@@H@Z ; 220
IL_GetImage ; 220
?il_hash@@YAIPBD@Z ; 220
IL_DestroyImage ; 220
?il_PermitLoad@@YAHPBDPAVnsIImageRequestObserver@@@Z ; 220
?il_get_container@@YAPAUil_container_struct@@PAU_IL_GroupContext@@W4ImgCachePolicy@@PBDPAU_NI_IRGB@@W4IL_DitherMode@@HHH@Z ; 220
?il_delete_client@@YAHPAUil_container_struct@@PAU_IL_ImageReq@@@Z ; 220
?il_check_requested_animation@@YA?AW4nsImageAnimation@@PAVnsIImageRequestObserver@@@Z ; 220
XP_SetObserverListObservable ; 220
XP_GetString ; 211
?il_removefromcache@@YAPAUil_container_struct@@PAU1@@Z ; 182
?il_image_abort@@YAXPAUil_container_struct@@@Z ; 174
?il_destroy_pixmap@@YAXPAVilIImageRenderer@@PAU_NI_Pixmap@@@Z ; 127
?QueryInterface@ImgDCallbk@@UAGIABUnsID@@PAPAX@Z ; 116
?AddRef@ImgDCallbk@@UAGKXZ ; 116
IL_ClearTimeout ; 114
?il_reduce_image_cache_size_to@@YAXI@Z ; 108
?il_dimensions_notify@@YAXPAUil_container_struct@@HH@Z ; 107
?il_adjust_cache_fullness@@YAXJ@Z ; 107
?ImgDCBHaveHdr@ImgDCallbk@@UAGIHH@Z ; 107
?il_cache_return_notify@@YAXPAU_IL_ImageReq@@@Z ; 104
IL_DestroyGroupContext ; 90
?il_delete_container@@YAXPAUil_container_struct@@@Z ; 87
IL_CreateGreyScaleColorSpace ; 70
?il_scour_container@@YAXPAUil_container_struct@@@Z ; 69
??1ImgDCallbk@@UAE@XZ ; 69
?Release@ImgDCallbk@@UAGKXZ ; 69
??_GImgDCallbk@@UAEPAXI@Z ; 69
?assign_assuming_AddRef@nsCOMPtr_base@@IAEXPAVnsISupports@@@Z ; 68
IL_SetDisplayMode ; 64
XP_NewObserverList ; 64
IL_NewGroupContext ; 64
?ImgDCBClearTimeout@ImgDCallbk@@UAGIPAX@Z ; 57
IL_InterruptContext ; 51
IL_CreateTrueColorSpace ; 50
?IL_StreamAbort@@YAXPAUil_container_struct@@H@Z ; 27
?StreamAbort@NetReaderImpl@@UAGIH@Z ; 27
IL_ShrinkCache ; 11
IL_SetCacheSize ; 1
IL_FlushCache ; 1
IL_Init ; 1