mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 06:38:36 +00:00
readding shit to the trunk since cvs ate it.
This commit is contained in:
parent
d66bcf6453
commit
f7af150202
51
modules/libimg/gifcom/Makefile.in
Normal file
51
modules/libimg/gifcom/Makefile.in
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# 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
|
||||
|
1709
modules/libimg/gifcom/gif.cpp
Normal file
1709
modules/libimg/gifcom/gif.cpp
Normal file
File diff suppressed because it is too large
Load Diff
31
modules/libimg/gifcom/gif.h
Normal file
31
modules/libimg/gifcom/gif.h
Normal file
@ -0,0 +1,31 @@
|
||||
/* -*- 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);
|
98
modules/libimg/gifcom/makefile.win
Normal file
98
modules/libimg/gifcom/makefile.win
Normal file
@ -0,0 +1,98 @@
|
||||
#!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
|
||||
|
128
modules/libimg/gifcom/nsGIFDecoder.cpp
Normal file
128
modules/libimg/gifcom/nsGIFDecoder.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
/* -*- 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;
|
||||
}
|
||||
|
||||
|
66
modules/libimg/gifcom/nsGIFDecoder.h
Normal file
66
modules/libimg/gifcom/nsGIFDecoder.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* -*- 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
|
40
modules/libimg/gifcom/nsGIFModule.cpp
Normal file
40
modules/libimg/gifcom/nsGIFModule.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/* -*- 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)
|
||||
|
14
modules/libimg/gifcom/nsgif.def
Normal file
14
modules/libimg/gifcom/nsgif.def
Normal file
@ -0,0 +1,14 @@
|
||||
;
|
||||
; 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
|
||||
|
21
modules/libimg/gifcom/win32.order
Normal file
21
modules/libimg/gifcom/win32.order
Normal file
@ -0,0 +1,21 @@
|
||||
?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
|
1
modules/libimg/jpgcom/.cvsignore
Normal file
1
modules/libimg/jpgcom/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
61
modules/libimg/jpgcom/Makefile.in
Normal file
61
modules/libimg/jpgcom/Makefile.in
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# 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
|
||||
|
1012
modules/libimg/jpgcom/jpeg.cpp
Normal file
1012
modules/libimg/jpgcom/jpeg.cpp
Normal file
File diff suppressed because it is too large
Load Diff
34
modules/libimg/jpgcom/jpeg.h
Normal file
34
modules/libimg/jpgcom/jpeg.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* -*- 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);
|
||||
|
||||
|
102
modules/libimg/jpgcom/makefile.win
Normal file
102
modules/libimg/jpgcom/makefile.win
Normal file
@ -0,0 +1,102 @@
|
||||
#!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
|
||||
|
131
modules/libimg/jpgcom/nsJPGDecoder.cpp
Normal file
131
modules/libimg/jpgcom/nsJPGDecoder.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
/* -*- 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;
|
||||
|
||||
}
|
||||
|
58
modules/libimg/jpgcom/nsJPGDecoder.h
Normal file
58
modules/libimg/jpgcom/nsJPGDecoder.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* -*- 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___ */
|
40
modules/libimg/jpgcom/nsJPGModule.cpp
Normal file
40
modules/libimg/jpgcom/nsJPGModule.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
/* -*- 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)
|
49
modules/libimg/jpgcom/nsJPGModule.h
Normal file
49
modules/libimg/jpgcom/nsJPGModule.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* -*- 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___ */
|
14
modules/libimg/jpgcom/nsjpg.def
Normal file
14
modules/libimg/jpgcom/nsjpg.def
Normal file
@ -0,0 +1,14 @@
|
||||
;
|
||||
; 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
|
||||
|
24
modules/libimg/jpgcom/win32.order
Normal file
24
modules/libimg/jpgcom/win32.order
Normal file
@ -0,0 +1,24 @@
|
||||
?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
|
1
modules/libimg/public/.cvsignore
Normal file
1
modules/libimg/public/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
18
modules/libimg/public/MANIFEST
Normal file
18
modules/libimg/public/MANIFEST
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# 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
|
55
modules/libimg/public/Makefile.in
Normal file
55
modules/libimg/public/Makefile.in
Normal file
@ -0,0 +1,55 @@
|
||||
#
|
||||
# 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
|
||||
|
103
modules/libimg/public/xpcompat.h
Normal file
103
modules/libimg/public/xpcompat.h
Normal file
@ -0,0 +1,103 @@
|
||||
/* -*- 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
|
1
modules/libimg/public_com/.cvsignore
Normal file
1
modules/libimg/public_com/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
10
modules/libimg/public_com/MANIFEST
Normal file
10
modules/libimg/public_com/MANIFEST
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# 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
|
48
modules/libimg/public_com/Makefile.in
Normal file
48
modules/libimg/public_com/Makefile.in
Normal file
@ -0,0 +1,48 @@
|
||||
#
|
||||
# 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
|
||||
|
344
modules/libimg/public_com/if_struct.h
Normal file
344
modules/libimg/public_com/if_struct.h
Normal file
@ -0,0 +1,344 @@
|
||||
/* -*- 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.19 2001/06/19 11:15:45 pavlov%netscape.com 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
|
58
modules/libimg/public_com/il.h
Normal file
58
modules/libimg/public_com/il.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* -*- 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.6 2001/06/19 11:15:46 pavlov%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 */
|
||||
|
||||
|
82
modules/libimg/public_com/il_utilp.h
Normal file
82
modules/libimg/public_com/il_utilp.h
Normal file
@ -0,0 +1,82 @@
|
||||
/* -*- 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.6 2001/06/19 11:15:49 pavlov%netscape.com 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;
|
||||
|
||||
|
52
modules/libimg/public_com/makefile.win
Normal file
52
modules/libimg/public_com/makefile.win
Normal file
@ -0,0 +1,52 @@
|
||||
#!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
|
61
modules/libimg/public_com/nsIImgDCallbk.h
Normal file
61
modules/libimg/public_com/nsIImgDCallbk.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* -*- 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___ */
|
56
modules/libimg/public_com/nsIImgDecoder.h
Normal file
56
modules/libimg/public_com/nsIImgDecoder.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* -*- 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
|
85
modules/libimg/public_com/nsImgDCallbk.h
Normal file
85
modules/libimg/public_com/nsImgDCallbk.h
Normal file
@ -0,0 +1,85 @@
|
||||
/* -*- 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___ */
|
64
modules/libimg/public_com/nsImgDecCID.h
Normal file
64
modules/libimg/public_com/nsImgDecCID.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* -*- 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 */
|
32
modules/libimg/public_com/nsImgDecoder.h
Normal file
32
modules/libimg/public_com/nsImgDecoder.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* -*- 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 */
|
1
modules/libimg/src/.cvsignore
Normal file
1
modules/libimg/src/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
Makefile
|
4
modules/libimg/src/MANIFEST
Normal file
4
modules/libimg/src/MANIFEST
Normal file
@ -0,0 +1,4 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist directory
|
||||
#
|
||||
|
64
modules/libimg/src/Makefile.in
Normal file
64
modules/libimg/src/Makefile.in
Normal file
@ -0,0 +1,64 @@
|
||||
#
|
||||
# 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
|
166
modules/libimg/src/nsIImgDecoder.cpp
Normal file
166
modules/libimg/src/nsIImgDecoder.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
/* -*- 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;
|
||||
}
|
95
modules/libimg/src/win32.order
Normal file
95
modules/libimg/src/win32.order
Normal file
@ -0,0 +1,95 @@
|
||||
?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
|
Loading…
x
Reference in New Issue
Block a user