b=338407, uplift image encoder support to 1.8, r+a=stuart
git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@198086 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -90,6 +90,7 @@ MOZ_DEBUG_LDFLAGS=@MOZ_DEBUG_LDFLAGS@
|
||||
MOZ_DBGRINFO_MODULES = @MOZ_DBGRINFO_MODULES@
|
||||
MOZ_EXTENSIONS = @MOZ_EXTENSIONS@
|
||||
MOZ_IMG_DECODERS= @MOZ_IMG_DECODERS@
|
||||
MOZ_IMG_ENCODERS= @MOZ_IMG_ENCODERS@
|
||||
MOZ_JSDEBUGGER = @MOZ_JSDEBUGGER@
|
||||
MOZ_PERF_METRICS = @MOZ_PERF_METRICS@
|
||||
MOZ_LEAKY = @MOZ_LEAKY@
|
||||
|
||||
1491
mozilla/configure
vendored
1491
mozilla/configure
vendored
File diff suppressed because it is too large
Load Diff
@@ -4143,6 +4143,7 @@ MOZ_ENABLE_LIBXUL=
|
||||
MOZ_EXTENSIONS_ALL=" cookie wallet content-packs xml-rpc xmlextras help p3p pref transformiix venkman inspector irc universalchardet typeaheadfind webservices spellcheck gnomevfs auth sroaming xmlterm datetime finger cview layout-debug tasks sql xforms permissions schema-validation reporter"
|
||||
MOZ_FEEDS=1
|
||||
MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm"
|
||||
MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
|
||||
MOZ_IPCD=
|
||||
MOZ_JAVAXPCOM=
|
||||
MOZ_JSDEBUGGER=1
|
||||
@@ -5131,8 +5132,35 @@ MOZ_ARG_ENABLE_STRING(image-decoders,
|
||||
done],
|
||||
MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
|
||||
|
||||
dnl Dupes are removed in the encoder section because it will also add decoders
|
||||
|
||||
dnl ========================================================
|
||||
dnl Image encoders
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_STRING(image-encoders,
|
||||
[ --enable-image-encoders[={mod1,mod2,default,all,none}]
|
||||
Enable specific image encoders],
|
||||
[ for option in `echo $enableval | sed 's/,/ /g'`; do
|
||||
if test "$option" = "yes" || test "$option" = "all"; then
|
||||
addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
|
||||
elif test "$option" = "no" || test "$option" = "none"; then
|
||||
MOZ_IMG_ENCODERS=""
|
||||
addencoder=""
|
||||
elif test "$option" = "default"; then
|
||||
addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
|
||||
elif test `echo "$option" | grep -c \^-` != 0; then
|
||||
option=`echo $option | sed 's/^-//'`
|
||||
addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
|
||||
else
|
||||
addencoder="$option"
|
||||
fi
|
||||
MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
|
||||
done],
|
||||
MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
|
||||
|
||||
dnl Remove dupes
|
||||
MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
|
||||
MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
|
||||
|
||||
dnl ========================================================
|
||||
dnl experimental ldap features
|
||||
@@ -6908,6 +6936,7 @@ AC_SUBST(MOZ_DEBUG_LDFLAGS)
|
||||
AC_SUBST(MOZ_DBGRINFO_MODULES)
|
||||
AC_SUBST(MOZ_EXTENSIONS)
|
||||
AC_SUBST(MOZ_IMG_DECODERS)
|
||||
AC_SUBST(MOZ_IMG_ENCODERS)
|
||||
AC_SUBST(MOZ_JSDEBUGGER)
|
||||
AC_SUBST(MOZ_OJI)
|
||||
AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
|
||||
|
||||
@@ -97,8 +97,9 @@
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "cairo.h"
|
||||
#ifndef MOZILLA_1_8_BRANCH
|
||||
#include "imgIEncoder.h"
|
||||
#ifdef MOZILLA_1_8_BRANCH
|
||||
#define imgIEncoder imgIEncoder_MOZILLA_1_8_BRANCH
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CAIRO_GFX
|
||||
@@ -979,7 +980,6 @@ nsCanvasRenderingContext2D::GetInputStream(const nsACString& aMimeType,
|
||||
const nsAString& aEncoderOptions,
|
||||
nsIInputStream **aStream)
|
||||
{
|
||||
#ifndef MOZILLA_1_8_BRANCH
|
||||
nsCString conid(NS_LITERAL_CSTRING("@mozilla.org/image/encoder;2?type="));
|
||||
conid += aMimeType;
|
||||
|
||||
@@ -1018,9 +1018,6 @@ nsCanvasRenderingContext2D::GetInputStream(const nsACString& aMimeType,
|
||||
}
|
||||
|
||||
return CallQueryInterface(encoder, aStream);
|
||||
#else
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -368,18 +368,15 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// We get an input stream from the context. If more than one context type
|
||||
// is supported in the future, this will have to be changed to do the right
|
||||
// thing. For now, just assume that the 2D context has all the goods.
|
||||
nsCOMPtr<nsICanvasRenderingContextInternal> context;
|
||||
rv = GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(context));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// if there's no context, it's an error to call toDataURL.
|
||||
if (!mCurrentContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// get image bytes
|
||||
nsCOMPtr<nsIInputStream> imgStream;
|
||||
NS_ConvertUTF16toUTF8 aMimeType8(aMimeType);
|
||||
rv = context->GetInputStream(aMimeType8, aEncoderOptions,
|
||||
getter_AddRefs(imgStream));
|
||||
rv = mCurrentContext->GetInputStream(aMimeType8, aEncoderOptions,
|
||||
getter_AddRefs(imgStream));
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
@@ -1,23 +1,39 @@
|
||||
#
|
||||
# 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/
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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 contents of this file are subject to the Mozilla 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/MPL/
|
||||
#
|
||||
# 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.
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
@@ -78,7 +94,9 @@ EXPORTS = \
|
||||
jos2fig.h \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(filter os2 windows,$(MOZ_WIDGET_TOOLKIT)))
|
||||
# These files enable support for writing JPEGs
|
||||
# (on certain platforms, or if JPEG image encoder support is required)
|
||||
ifneq (,$(filter os2 windows,$(MOZ_WIDGET_TOOLKIT))$(filter jpeg,$(MOZ_IMG_ENCODERS)))
|
||||
CSRCS += \
|
||||
jcapimin.c \
|
||||
jcparam.c \
|
||||
|
||||
@@ -1,23 +1,39 @@
|
||||
#
|
||||
# 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/
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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 contents of this file are subject to the Mozilla 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/MPL/
|
||||
#
|
||||
# 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.
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
@@ -64,6 +80,11 @@ FORCE_USE_PIC = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
#ifeq (png,$(filter png,$(MOZ_IMG_ENCODERS)))
|
||||
ifdef MOZ_IMG_ENCODERS
|
||||
DEFINES += -DMOZ_PNG_WRITE
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
DEFINES += -DZLIB_DLL
|
||||
ifdef BUILD_DEBUG_GC
|
||||
|
||||
@@ -70,7 +70,36 @@
|
||||
#define PNG_NO_READ_OPT_PLTE
|
||||
#define PNG_NO_MNG_FEATURES
|
||||
|
||||
#ifdef MOZ_PNG_WRITE
|
||||
#define PNG_NO_WRITE_BACKGROUND
|
||||
#define PNG_NO_WRITE_DITHER
|
||||
#define PNG_NO_WRITE_INVERT
|
||||
#define PNG_NO_WRITE_SHIFT
|
||||
#define PNG_NO_WRITE_PACK
|
||||
#define PNG_NO_WRITE_PACKSWAP
|
||||
#define PNG_NO_WRITE_FILLER
|
||||
#define PNG_NO_WRITE_SWAP_ALPHA
|
||||
#define PNG_NO_WRITE_INVERT_ALPHA
|
||||
#define PNG_NO_WRITE_RGB_TO_GRAY
|
||||
#define PNG_NO_WRITE_USER_TRANSFORM
|
||||
#define PNG_NO_WRITE_bKGD
|
||||
#define PNG_NO_WRITE_cHRM
|
||||
#define PNG_NO_WRITE_hIST
|
||||
#define PNG_NO_WRITE_iCCP
|
||||
#define PNG_NO_WRITE_pCAL
|
||||
#define PNG_NO_WRITE_pHYs
|
||||
#define PNG_NO_WRITE_sBIT
|
||||
#define PNG_NO_WRITE_sCAL
|
||||
#define PNG_NO_WRITE_sPLT
|
||||
#define PNG_NO_WRITE_TEXT
|
||||
#define PNG_NO_WRITE_tIME
|
||||
#define PNG_NO_WRITE_UNKNOWN_CHUNKS
|
||||
#define PNG_NO_WRITE_USER_CHUNKS
|
||||
#define PNG_NO_WRITE_EMPTY_PLTE
|
||||
#define PNG_NO_WRITE_OPT_PLTE
|
||||
#else
|
||||
#define PNG_NO_WRITE_SUPPORTED
|
||||
#endif
|
||||
|
||||
#define PNG_NO_READ_STRIP_ALPHA
|
||||
#define PNG_NO_USER_TRANSFORM_PTR
|
||||
|
||||
@@ -1262,8 +1262,15 @@ typedef z_stream FAR * png_zstreamp;
|
||||
# endif
|
||||
# endif /* PNG_IMPEXP */
|
||||
#else /* !(DLL || non-cygwin WINDOWS) */
|
||||
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
|
||||
# ifndef PNGAPI
|
||||
# if defined(__OS2__)
|
||||
# if defined(__GNUC__) && defined(__declspec) && defined(PNG_DLL) && !defined(PNG_IMPEXP)
|
||||
# ifdef PNG_BUILD_DLL
|
||||
# define PNG_IMPEXP __declspec(dllexport)
|
||||
# else
|
||||
# define PNG_IMPEXP __declspec(dllimport)
|
||||
# endif
|
||||
# endif /* GNUC & declspec */
|
||||
# if (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(PNGAPI)
|
||||
# define PNGAPI _System
|
||||
# endif
|
||||
# else
|
||||
|
||||
@@ -50,6 +50,10 @@ ifdef MOZ_IMG_DECODERS
|
||||
DIRS += decoders
|
||||
endif
|
||||
|
||||
ifdef MOZ_IMG_ENCODERS
|
||||
DIRS += encoders
|
||||
endif
|
||||
|
||||
DIRS += build
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -66,25 +66,30 @@ CPPSRCS = \
|
||||
nsImageModule.cpp \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += $(foreach d,$(filter-out icon,$(MOZ_IMG_DECODERS)),\
|
||||
-DIMG_BUILD_${d})
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I. \
|
||||
-I$(srcdir)/../src \
|
||||
$(foreach d,$(filter-out icon,$(MOZ_IMG_DECODERS)), \
|
||||
-I$(srcdir)/../decoders/${d}) \
|
||||
$(foreach d,$(MOZ_IMG_ENCODERS), \
|
||||
-I$(srcdir)/../encoders/${d}) \
|
||||
$(NULL)
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
../src/$(LIB_PREFIX)imglib2_s.$(LIB_SUFFIX) \
|
||||
$(foreach d,$(filter-out icon,$(MOZ_IMG_DECODERS)), \
|
||||
../decoders/${d}/$(LIB_PREFIX)img${d}_s.$(LIB_SUFFIX))\
|
||||
$(foreach d,$(MOZ_IMG_ENCODERS), \
|
||||
../encoders/${d}/$(LIB_PREFIX)img${d}e_s.$(LIB_SUFFIX))\
|
||||
$(NULL)
|
||||
|
||||
EXTRA_DSO_LIBS = \
|
||||
gkgfx \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_ENABLE_CAIRO_GFX
|
||||
EXTRA_DSO_LIBS += thebes
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(LIBS_DIR) \
|
||||
@@ -94,16 +99,23 @@ EXTRA_DSO_LDOPTS = \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
# Force a rebuild of nsImageModule when either of MOZ_IMG_{DE,EN}CODERS changes
|
||||
|
||||
GARBAGE += _img_list nsImgBuildDefines.h
|
||||
|
||||
export::
|
||||
@echo "$(MOZ_IMG_DECODERS)" > tmp_img_list
|
||||
@if `cmp -s _img_list tmp_img_list`; then \
|
||||
rm -f tmp_img_list; \
|
||||
@{ \
|
||||
$(foreach d,$(filter-out icon,$(MOZ_IMG_DECODERS)), \
|
||||
echo "#define IMG_BUILD_DECODER_${d}";) \
|
||||
$(foreach d,$(MOZ_IMG_ENCODERS), \
|
||||
echo "#define IMG_BUILD_ENCODER_${d}";) \
|
||||
} > nsImgBuildDefines.tmp
|
||||
@if `cmp -s nsImgBuildDefines.h nsImgBuildDefines.tmp`; then \
|
||||
rm -f nsImgBuildDefines.tmp; \
|
||||
else \
|
||||
rm -f _img_list; \
|
||||
mv tmp_img_list _img_list; \
|
||||
touch Makefile; \
|
||||
rm -f nsImgBuildDefines.h; \
|
||||
mv nsImgBuildDefines.tmp nsImgBuildDefines.h; \
|
||||
fi
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsImgBuildDefines.h"
|
||||
|
||||
#ifdef XP_MAC
|
||||
#define IMG_BUILD_gif 1
|
||||
#define IMG_BUILD_bmp 1
|
||||
@@ -57,37 +59,44 @@
|
||||
#include "imgRequest.h"
|
||||
#include "imgRequestProxy.h"
|
||||
|
||||
#ifdef IMG_BUILD_gif
|
||||
#ifdef IMG_BUILD_DECODER_gif
|
||||
// gif
|
||||
#include "imgContainerGIF.h"
|
||||
#include "nsGIFDecoder2.h"
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_bmp
|
||||
#ifdef IMG_BUILD_DECODER_bmp
|
||||
// bmp/ico
|
||||
#include "nsBMPDecoder.h"
|
||||
#include "nsICODecoder.h"
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_png
|
||||
#ifdef IMG_BUILD_DECODER_png
|
||||
// png
|
||||
#include "nsPNGDecoder.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN32) && defined(IMG_BUILD_jpeg) && !defined(WINCE)
|
||||
#include "nsJPEGEncoder.h"
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_jpeg
|
||||
#ifdef IMG_BUILD_DECODER_jpeg
|
||||
// jpeg
|
||||
#include "nsJPEGDecoder.h"
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_xbm
|
||||
#ifdef IMG_BUILD_DECODER_xbm
|
||||
// xbm
|
||||
#include "nsXBMDecoder.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef IMG_BUILD_ENCODER_png
|
||||
// png
|
||||
#include "nsPNGEncoder.h"
|
||||
#endif
|
||||
#ifdef IMG_BUILD_ENCODER_jpeg
|
||||
// jpeg
|
||||
#include "nsJPEGEncoder.h"
|
||||
#endif
|
||||
|
||||
|
||||
// objects that just require generic constructors
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(imgCache)
|
||||
@@ -95,56 +104,60 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(imgContainer)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(imgLoader)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(imgRequestProxy)
|
||||
|
||||
#ifdef IMG_BUILD_gif
|
||||
#ifdef IMG_BUILD_DECODER_gif
|
||||
// gif
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(imgContainerGIF)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIFDecoder2)
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_jpeg
|
||||
#ifdef IMG_BUILD_DECODER_jpeg
|
||||
// jpeg
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJPEGDecoder)
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN32) && defined(IMG_BUILD_jpeg) && !defined(WINCE)
|
||||
#ifdef IMG_BUILD_ENCODER_jpeg
|
||||
// jpeg
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJPEGEncoder)
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_bmp
|
||||
#ifdef IMG_BUILD_DECODER_bmp
|
||||
// bmp
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsICODecoder)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBMPDecoder)
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_png
|
||||
#ifdef IMG_BUILD_DECODER_png
|
||||
// png
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGDecoder)
|
||||
#endif
|
||||
#ifdef IMG_BUILD_ENCODER_png
|
||||
// png
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGEncoder)
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_xbm
|
||||
#ifdef IMG_BUILD_DECODER_xbm
|
||||
// xbm
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsXBMDecoder)
|
||||
#endif
|
||||
|
||||
static const char* gImageMimeTypes[] = {
|
||||
#ifdef IMG_BUILD_gif
|
||||
#ifdef IMG_BUILD_DECODER_gif
|
||||
"image/gif",
|
||||
#endif
|
||||
#ifdef IMG_BUILD_jpeg
|
||||
#ifdef IMG_BUILD_DECODER_jpeg
|
||||
"image/jpeg",
|
||||
"image/pjpeg",
|
||||
"image/jpg",
|
||||
#endif
|
||||
#ifdef IMG_BUILD_bmp
|
||||
#ifdef IMG_BUILD_DECODER_bmp
|
||||
"image/x-icon",
|
||||
"image/vnd.microsoft.icon",
|
||||
"image/bmp",
|
||||
#endif
|
||||
#ifdef IMG_BUILD_png
|
||||
#ifdef IMG_BUILD_DECODER_png
|
||||
"image/png",
|
||||
"image/x-png",
|
||||
#endif
|
||||
#ifdef IMG_BUILD_xbm
|
||||
#ifdef IMG_BUILD_DECODER_xbm
|
||||
"image/x-xbitmap",
|
||||
"image/x-xbm",
|
||||
"image/xbm"
|
||||
@@ -207,7 +220,7 @@ static const nsModuleComponentInfo components[] =
|
||||
"@mozilla.org/image/request;1",
|
||||
imgRequestProxyConstructor, },
|
||||
|
||||
#ifdef IMG_BUILD_gif
|
||||
#ifdef IMG_BUILD_DECODER_gif
|
||||
// gif
|
||||
{ "GIF image container",
|
||||
NS_GIFCONTAINER_CID,
|
||||
@@ -219,7 +232,7 @@ static const nsModuleComponentInfo components[] =
|
||||
nsGIFDecoder2Constructor, },
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_jpeg
|
||||
#ifdef IMG_BUILD_DECODER_jpeg
|
||||
// jpeg
|
||||
{ "JPEG decoder",
|
||||
NS_JPEGDECODER_CID,
|
||||
@@ -234,15 +247,15 @@ static const nsModuleComponentInfo components[] =
|
||||
"@mozilla.org/image/decoder;2?type=image/jpg",
|
||||
nsJPEGDecoderConstructor, },
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN32) && defined(IMG_BUILD_jpeg) && !defined(WINCE)
|
||||
{ "JPEG encoder",
|
||||
NS_JPEGENCODER_CID,
|
||||
#ifdef IMG_BUILD_ENCODER_jpeg
|
||||
// jpeg (encoder)
|
||||
{ "JPEG Encoder",
|
||||
NS_JPEGENCODER_CID,
|
||||
"@mozilla.org/image/encoder;2?type=image/jpeg",
|
||||
nsJPEGEncoderConstructor, },
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_bmp
|
||||
#ifdef IMG_BUILD_DECODER_bmp
|
||||
// bmp
|
||||
{ "ICO Decoder",
|
||||
NS_ICODECODER_CID,
|
||||
@@ -258,7 +271,7 @@ static const nsModuleComponentInfo components[] =
|
||||
nsBMPDecoderConstructor, },
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_png
|
||||
#ifdef IMG_BUILD_DECODER_png
|
||||
// png
|
||||
{ "PNG Decoder",
|
||||
NS_PNGDECODER_CID,
|
||||
@@ -269,8 +282,15 @@ static const nsModuleComponentInfo components[] =
|
||||
"@mozilla.org/image/decoder;2?type=image/x-png",
|
||||
nsPNGDecoderConstructor, },
|
||||
#endif
|
||||
#ifdef IMG_BUILD_ENCODER_png
|
||||
// png
|
||||
{ "PNG Encoder",
|
||||
NS_PNGENCODER_CID,
|
||||
"@mozilla.org/image/encoder;2?type=image/png",
|
||||
nsPNGEncoderConstructor, },
|
||||
#endif
|
||||
|
||||
#ifdef IMG_BUILD_xbm
|
||||
#ifdef IMG_BUILD_DECODER_xbm
|
||||
// xbm
|
||||
{ "XBM Decoder",
|
||||
NS_XBMDECODER_CID,
|
||||
@@ -298,7 +318,7 @@ PR_STATIC_CALLBACK(void)
|
||||
imglib_Shutdown(nsIModule* aSelf)
|
||||
{
|
||||
imgCache::Shutdown();
|
||||
#ifdef IMG_BUILD_gif
|
||||
#ifdef IMG_BUILD_DECODER_gif
|
||||
nsGifShutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -51,17 +51,11 @@ LIBXUL_LIBRARY = 1
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
gfx \
|
||||
widget \
|
||||
imglib2 \
|
||||
necko \
|
||||
$(JPEG_REQUIRES) \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = nsJPEGDecoder.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
CPPSRCS += nsJPEGEncoder.cpp
|
||||
endif
|
||||
CPPSRCS = nsJPEGDecoder.cpp
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "imgIEncoder.h"
|
||||
#ifdef MOZILLA_1_8_BRANCH
|
||||
#define imgIEncoder imgIEncoder_MOZILLA_1_8_BRANCH
|
||||
#define NS_DECL_IMGIENCODER NS_DECL_IMGIENCODER_MOZILLA_1_8_BRANCH
|
||||
#endif
|
||||
|
||||
// needed for JPEG library
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "imgIEncoder.h"
|
||||
#ifdef MOZILLA_1_8_BRANCH
|
||||
#define imgIEncoder imgIEncoder_MOZILLA_1_8_BRANCH
|
||||
#define NS_DECL_IMGIENCODER NS_DECL_IMGIENCODER_MOZILLA_1_8_BRANCH
|
||||
#endif
|
||||
|
||||
#include <png.h>
|
||||
|
||||
|
||||
@@ -53,10 +53,10 @@ XPIDLSRCS = \
|
||||
imgIContainerObserver.idl \
|
||||
imgIDecoder.idl \
|
||||
imgIDecoderObserver.idl \
|
||||
imgIEncoder.idl \
|
||||
imgILoad.idl \
|
||||
imgILoader.idl \
|
||||
imgIRequest.idl \
|
||||
imgIEncoder.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
@@ -12,13 +12,15 @@
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is image encoder interface.
|
||||
* The Original Code is Oracle Corporation code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Scott MacGregor <mscott@mozilla.org>.
|
||||
* The Initial Developer of the Original Code is Oracle Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@pavlov.net>
|
||||
* Brett Wilson <brettw@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@@ -35,24 +37,65 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIClipboardImage;
|
||||
interface nsIFile;
|
||||
#include "nsIInputStream.idl"
|
||||
|
||||
/**
|
||||
* imgIEncoder interface
|
||||
* Currently this is a very specific encoder designed to encode a native clipboard image as a JPEG out to disk.
|
||||
* It is not intended to be a generic image encoder.
|
||||
*
|
||||
*/
|
||||
[scriptable, uuid(b1b0b493-3369-44e0-878d-f7c56d937680)]
|
||||
interface imgIEncoder_MOZILLA_1_8_BRANCH : nsIInputStream
|
||||
{
|
||||
// Possible values for input format (note that not all image formats
|
||||
// support saving alpha channels):
|
||||
|
||||
// Input is RGB each pixel is represented by three bytes:
|
||||
// R, G, and B (in that order, regardless of host endianness)
|
||||
const PRUint32 INPUT_FORMAT_RGB = 0;
|
||||
|
||||
// Input is RGB each pixel is represented by four bytes:
|
||||
// R, G, and B (in that order, regardless of host endianness).
|
||||
// POST-MULTIPLIED alpha us used (50% transparent red is 0xff000080)
|
||||
const PRUint32 INPUT_FORMAT_RGBA = 1;
|
||||
|
||||
// Input is host-endian ARGB: On big-endian machines each pixel is therefore
|
||||
// ARGB, and for little-endian machiens (Intel) each pixel is BGRA
|
||||
// (This is used by canvas to match it's internal representation)
|
||||
//
|
||||
// PRE-MULTIPLIED alpha is used (That is, 50% transparent red is 0x80800000,
|
||||
// not 0x80ff0000
|
||||
const PRUint32 INPUT_FORMAT_HOSTARGB = 2;
|
||||
|
||||
/* data - list of bytes in the format specified by inputFormat
|
||||
* width - width in pixels
|
||||
* height - height in pixels
|
||||
* stride - number of bytes per row in the image
|
||||
* Normally (width*3) or (width*4), depending on your input format,
|
||||
* but some data uses padding at the end of each row, which would
|
||||
* be extra.
|
||||
* inputFormat - one of INPUT_FORMAT_* specifying the format of data
|
||||
* outputOptions - semicolon-delimited list of name=value pairs that can
|
||||
* give options to the output encoder. Options are encoder-
|
||||
* specific. Just give empty string for default behavior.
|
||||
*/
|
||||
void initFromData([array, size_is(length), const] in PRUint8 data,
|
||||
in unsigned long length,
|
||||
in PRUint32 width,
|
||||
in PRUint32 height,
|
||||
in PRUint32 stride,
|
||||
in PRUint32 inputFormat,
|
||||
in AString outputOptions);
|
||||
};
|
||||
|
||||
/**
|
||||
* This is the old imgIEncoder interface that only ever existed on the
|
||||
* Aviary and 1.8 branch.
|
||||
*/
|
||||
interface nsIClipboardImage;
|
||||
interface nsIFile;
|
||||
|
||||
[scriptable, uuid(CCC5B3AD-3E67-4e3d-97E1-B06B2E96FEF8)]
|
||||
interface imgIEncoder : nsISupports
|
||||
{
|
||||
/**
|
||||
Encode a native clipboard image
|
||||
**/
|
||||
|
||||
void encodeClipboardImage(in nsIClipboardImage aClipboardImage, out nsIFile aImageFile);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user