cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r348560 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java
Date Wed, 23 Nov 2005 21:00:56 GMT
Author: vgritsenko
Date: Wed Nov 23 13:00:52 2005
New Revision: 348560

URL: http://svn.apache.org/viewcvs?rev=348560&view=rev
Log:
correct caching key

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java?rev=348560&r1=348559&r2=348560&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/reading/ImageReader.java Wed Nov
23 13:00:52 2005
@@ -31,7 +31,6 @@
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.reading.ResourceReader;
 import org.apache.commons.lang.SystemUtils;
 import org.xml.sax.SAXException;
 
@@ -95,7 +94,7 @@
  * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
  * @author <a href="mailto:tcurdt@apache.org">Torsten Curdt</a>
  * @author <a href="mailto:eric@plauditdesign.com">Eric Caron</a>
- * @version CVS $Id$
+ * @version $Id$
  */
 final public class ImageReader extends ResourceReader {
     private static final boolean GRAYSCALE_DEFAULT = false;
@@ -165,7 +164,7 @@
         } else {
             height = Integer.parseInt(tmpHeight);
         }
-		
+
         if (par.getParameterAsBoolean("grayscale", GRAYSCALE_DEFAULT)) {
             this.grayscaleFilter = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY),
null);
         }
@@ -287,7 +286,7 @@
                     double ow = decodeParam.getWidth();
                     double oh = decodeParam.getHeight();
 
-                    if (usePercent == true) {
+                    if (usePercent) {
                         if (width > 0) {
                             width = Math.round((int)(ow * width) / 100);
                         }
@@ -319,7 +318,7 @@
                     p.setQuality(this.quality[0], true);
                     encoder.setJPEGEncodeParam(p);
                     encoder.encode(currentImage);
-                } else { 
+                } else {
                     ByteArrayOutputStream bstream = new ByteArrayOutputStream();
                     JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bstream);
                     JPEGEncodeParam p = encoder.getDefaultJPEGEncodeParam(currentImage);
@@ -352,11 +351,11 @@
      * Generate the unique key.
      * This key must be unique inside the space of this component.
      *
-     * @return The generated key consists of the src and width and height, and the color
transform
-     * parameters
+     * @return The generated key consists of the src and width and height,
+     *         and the color transform parameters
     */
     public Serializable getKey() {
-        return this.inputSource.getURI()
+        return super.getKey().toString()
                 + ':' + this.width
                 + ':' + this.height
                 + ":" + this.scaleColor[0]
@@ -366,10 +365,9 @@
                 + ":" + this.offsetColor[1]
                 + ":" + this.offsetColor[2]
                 + ":" + this.quality[0]
-                + ":" + ((null == this.grayscaleFilter) ? "color" : "grayscale")
-                + ":" + super.getKey();
+                + ":" + (this.grayscaleFilter == null ? "color" : "bw");
     }
-    
+
     public void recycle(){
         super.recycle();
         this.colorFilter = null;



Mime
View raw message