aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-04-21 09:51:21 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-04-21 09:51:21 +0000
commit7c637cc8f0a1f0ff305f6a2fa68018d50ee52170 (patch)
treee3f411765e01247f5408e77dff76a635c9c3fa7a /src
parent61fe816e71ee48e847a7a2555ff1c0d973877def (diff)
downloadxmlgraphics-fop-7c637cc8f0a1f0ff305f6a2fa68018d50ee52170.tar.gz
xmlgraphics-fop-7c637cc8f0a1f0ff305f6a2fa68018d50ee52170.zip
Merged revisions 649657,650050 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r649657 | spepping | 2008-04-18 20:07:57 +0100 (Fri, 18 Apr 2008) | 4 lines An implementation of a positive integer property maker. It implements convertProperty, which is the correct method to implement if one wants to add to the make process. This fixes bug 44619. ........ r650050 | jeremias | 2008-04-21 09:32:02 +0100 (Mon, 21 Apr 2008) | 1 line Partially reverted my revision 641827: The yellow tint of certain JPEG images came from badly extracted ICC color profiles. This is fixed in XML Graphics Commons Trunk (revision 650048). ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@650069 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java14
-rw-r--r--src/java/org/apache/fop/fo/flow/table/TableFObj.java20
-rw-r--r--src/java/org/apache/fop/fo/properties/NumberProperty.java34
-rw-r--r--src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java17
4 files changed, 42 insertions, 43 deletions
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index 539648f5a..db19d6515 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -1095,13 +1095,13 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("hyphenation-character", m);
// hyphenation-push-character-count
- m = new NumberProperty.Maker(PR_HYPHENATION_PUSH_CHARACTER_COUNT);
+ m = new NumberProperty.PositiveIntegerMaker(PR_HYPHENATION_PUSH_CHARACTER_COUNT);
m.setInherited(true);
m.setDefault("2");
addPropertyMaker("hyphenation-push-character-count", m);
// hyphenation-remain-character-count
- m = new NumberProperty.Maker(PR_HYPHENATION_REMAIN_CHARACTER_COUNT);
+ m = new NumberProperty.PositiveIntegerMaker(PR_HYPHENATION_REMAIN_CHARACTER_COUNT);
m.setInherited(true);
m.setDefault("2");
addPropertyMaker("hyphenation-remain-character-count", m);
@@ -2137,7 +2137,7 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("blank-or-not-blank", m);
// column-count
- m = new NumberProperty.Maker(PR_COLUMN_COUNT);
+ m = new NumberProperty.PositiveIntegerMaker(PR_COLUMN_COUNT);
m.setInherited(false);
m.setDefault("1");
addPropertyMaker("column-count", m);
@@ -2175,7 +2175,7 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("force-page-count", m);
// initial-page-number
- m = new NumberProperty.Maker(PR_INITIAL_PAGE_NUMBER);
+ m = new NumberProperty.PositiveIntegerMaker(PR_INITIAL_PAGE_NUMBER);
m.setInherited(false);
m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
m.addEnum("auto-odd", getEnumProperty(EN_AUTO_ODD, "AUTO_ODD"));
@@ -2359,19 +2359,19 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("ends-row", m);
// number-columns-repeated
- m = new NumberProperty.Maker(PR_NUMBER_COLUMNS_REPEATED);
+ m = new NumberProperty.PositiveIntegerMaker(PR_NUMBER_COLUMNS_REPEATED);
m.setInherited(false);
m.setDefault("1");
addPropertyMaker("number-columns-repeated", m);
// number-columns-spanned
- m = new NumberProperty.Maker(PR_NUMBER_COLUMNS_SPANNED);
+ m = new NumberProperty.PositiveIntegerMaker(PR_NUMBER_COLUMNS_SPANNED);
m.setInherited(false);
m.setDefault("1");
addPropertyMaker("number-columns-spanned", m);
// number-rows-spanned
- m = new NumberProperty.Maker(PR_NUMBER_ROWS_SPANNED);
+ m = new NumberProperty.PositiveIntegerMaker(PR_NUMBER_ROWS_SPANNED);
m.setInherited(false);
m.setDefault("1");
addPropertyMaker("number-rows-spanned", m);
diff --git a/src/java/org/apache/fop/fo/flow/table/TableFObj.java b/src/java/org/apache/fop/fo/flow/table/TableFObj.java
index 24528f622..9b60de740 100644
--- a/src/java/org/apache/fop/fo/flow/table/TableFObj.java
+++ b/src/java/org/apache/fop/fo/flow/table/TableFObj.java
@@ -117,7 +117,7 @@ public abstract class TableFObj extends FObj {
* PropertyMaker subclass for the column-number property
*
*/
- public static class ColumnNumberPropertyMaker extends NumberProperty.Maker {
+ public static class ColumnNumberPropertyMaker extends NumberProperty.PositiveIntegerMaker {
/**
* Constructor
@@ -153,24 +153,6 @@ public abstract class TableFObj extends FObj {
= (ColumnNumberManagerHolder) propertyList.getParentFObj();
ColumnNumberManager columnIndexManager = parent.getColumnNumberManager();
int columnIndex = p.getNumeric().getValue();
- if (columnIndex <= 0) {
- /* No warning necessary as the spec clearly defines how to handle these cases.
- log.warn("Specified negative or zero value for "
- + "column-number on " + fo.getName() + ": "
- + columnIndex + " forced to "
- + columnIndexManager.getCurrentColumnNumber());*/
- return NumberProperty.getInstance(columnIndexManager.getCurrentColumnNumber());
- } else {
- double tmpIndex = p.getNumeric().getNumericValue();
- if (tmpIndex - columnIndex > 0.0) {
- columnIndex = (int) Math.round(tmpIndex);
- /* No warning necessary as the spec clearly defines how to handle these cases.
- log.warn("Rounding specified column-number of "
- + tmpIndex + " to " + columnIndex);*/
- p = NumberProperty.getInstance(columnIndex);
- }
- }
-
int colSpan = propertyList.get(Constants.PR_NUMBER_COLUMNS_SPANNED)
.getNumeric().getValue();
int i = -1;
diff --git a/src/java/org/apache/fop/fo/properties/NumberProperty.java b/src/java/org/apache/fop/fo/properties/NumberProperty.java
index 6f8d8a1d2..58400d76e 100644
--- a/src/java/org/apache/fop/fo/properties/NumberProperty.java
+++ b/src/java/org/apache/fop/fo/properties/NumberProperty.java
@@ -68,6 +68,40 @@ public final class NumberProperty extends Property implements Numeric {
}
+ public static class PositiveIntegerMaker extends PropertyMaker {
+
+ /**
+ * Constructor for NumberProperty.PositiveIntegerMaker
+ * @param propId the id of the property for which a PositiveIntegerMaker should be created
+ */
+ public PositiveIntegerMaker(int propId) {
+ super(propId);
+ }
+
+ /**
+ * If the value is not positive, return a property with value 1
+ *
+ * {@inheritDoc}
+ */
+ public Property convertProperty(Property p,
+ PropertyList propertyList, FObj fo)
+ throws PropertyException {
+ if (p instanceof EnumProperty) {
+ return EnumNumber.getInstance(p);
+ }
+ Number val = p.getNumber();
+ if (val != null) {
+ int i = val.intValue();
+ if (i <= 0) {
+ i = 1;
+ }
+ return getInstance(i);
+ }
+ return convertPropertyDatatype(p, propertyList, fo);
+ }
+
+ }
+
/** cache holding all canonical NumberProperty instances */
private static final PropertyCache cache = new PropertyCache();
diff --git a/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java b/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java
index 1c8fceb50..1e505daed 100644
--- a/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java
+++ b/src/java/org/apache/fop/render/pdf/ImageRawJPEGAdapter.java
@@ -18,7 +18,6 @@
/* $Id$ */
package org.apache.fop.render.pdf;
-import java.awt.color.ICC_Profile;
import java.io.DataInput;
import java.io.IOException;
import java.io.InputStream;
@@ -36,7 +35,6 @@ import org.apache.fop.pdf.PDFDeviceColorSpace;
import org.apache.fop.pdf.PDFDocument;
import org.apache.fop.pdf.PDFFilter;
import org.apache.fop.pdf.PDFFilterList;
-import org.apache.fop.util.ColorProfileUtil;
/**
* PDFImage implementation for the PDF renderer which handles raw JPEG images.
@@ -82,21 +80,6 @@ public class ImageRawJPEGAdapter extends AbstractImageAdapter {
}
/** {@inheritDoc} */
- protected ICC_Profile getEffectiveICCProfile() {
- ICC_Profile profile = super.getEffectiveICCProfile();
- if (profile != null
- && profile.getNumComponents() == 3
- && !ColorProfileUtil.isDefaultsRGB(profile)) {
- //RGB profiles which are not sRGB don't seem to work.
- //Without this override, the image drifts into yellow for an unknown reason.
- //TODO Find out why this happens.
- //Test using a JPEG images with, for example, "Adobe RGB 1998" color profile.
- profile = null;
- }
- return profile;
- }
-
- /** {@inheritDoc} */
public int getBitsPerComponent() {
return 8;
}