You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2008/02/03 15:11:41 UTC
svn commit: r617989 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/fo/expr/ICCColorFunction.java status.xml
Author: adelmelle
Date: Sun Feb 3 06:11:40 2008
New Revision: 617989
URL: http://svn.apache.org/viewvc?rev=617989&view=rev
Log:
Bugzilla 43705:
Fixed a bug when the rgb-icc() function was used before the fo:declarations,
or in documents without fo:declarations. Function now correctly (?) reverts
to the sRGB fallback in those cases.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
xmlgraphics/fop/trunk/status.xml
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java?rev=617989&r1=617988&r2=617989&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/expr/ICCColorFunction.java Sun Feb 3 06:11:40 2008
@@ -19,6 +19,7 @@
package org.apache.fop.fo.expr;
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.pagination.ColorProfile;
import org.apache.fop.fo.pagination.Declarations;
import org.apache.fop.fo.properties.ColorProperty;
@@ -39,6 +40,11 @@
}
/** {@inheritDoc} */
+ public PercentBase getPercentBase() {
+ return new RGBColorFunction.RGBPercentBase();
+ }
+
+ /** {@inheritDoc} */
public Property eval(Property[] args,
PropertyInfo pInfo) throws PropertyException {
StringBuffer sb = new StringBuffer();
@@ -46,12 +52,24 @@
// Map color profile NCNAME to src from declarations/color-profile element
String colorProfileName = args[3].getString();
Declarations decls = pInfo.getFO().getRoot().getDeclarations();
- ColorProfile cp = decls.getColorProfile(colorProfileName);
- if (cp == null) {
- PropertyException pe = new PropertyException("The " + colorProfileName
- + " color profile was not declared");
- pe.setPropertyInfo(pInfo);
- throw pe;
+ ColorProfile cp = null;
+ if (decls == null) {
+ //function used in a color-specification
+ //on a FO occurring:
+ //a) before the fo:declarations,
+ //b) or in a document without fo:declarations?
+ //=> return the sRGB fallback
+ Property[] rgbArgs = new Property[3];
+ System.arraycopy(args, 0, rgbArgs, 0, 3);
+ return new RGBColorFunction().eval(rgbArgs, pInfo);
+ } else {
+ cp = decls.getColorProfile(colorProfileName);
+ if (cp == null) {
+ PropertyException pe = new PropertyException("The " + colorProfileName
+ + " color profile was not declared");
+ pe.setPropertyInfo(pInfo);
+ throw pe;
+ }
}
String src = cp.getSrc();
Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=617989&r1=617988&r2=617989&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Sun Feb 3 06:11:40 2008
@@ -28,6 +28,11 @@
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="AD" type="fix" fixes-bug="43705">
+ Fixed a bug when the rgb-icc() function was used either before the fo:declarations,
+ or in documents without a fo:declarations node. In such cases, the sRGB fallback
+ is now used to avoid an ugly NullPointerException.
+ </action>
<action context="Code" dev="AD" type="add">
Added very basic parsing for the xml:lang shorthand.
</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org