classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] SampleModel/ComponentSampleModel fix


From: Tom Tromey
Subject: Re: [cp-patches] SampleModel/ComponentSampleModel fix
Date: 03 Oct 2005 11:44:13 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> "Tom" == Thomas Fitzsimmons <address@hidden> writes:

Tom>    * java/awt/image/SampleModel.java (numBands): Make field
Tom>    package-private.

According to both japi and the javadoc, this field is 'protected'.

Based on reading the javadoc, I think ComponentSampleModel also has a
protected field named 'numBands'.  That is kind of dumb, but valid.

What do you think of the appended?  The constructor change at least
is, I think, a needed bug fix.

Tom

 2005-10-03  Tom Tromey  <address@hidden>

        * java/awt/image/ComponentSampleModel.java (numBands): Updated
        javadoc.
        (ComponentSampleModel): Set numBands.
        * java/awt/image/SampleModel.java (numBands): Now protected.

Index: java/awt/image/ComponentSampleModel.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/java/awt/image/ComponentSampleModel.java,v
retrieving revision 1.8
diff -u -r1.8 ComponentSampleModel.java
--- java/awt/image/ComponentSampleModel.java    1 Oct 2005 18:57:57 -0000       
1.8
+++ java/awt/image/ComponentSampleModel.java    3 Oct 2005 17:44:44 -0000
@@ -63,8 +63,10 @@
   protected int[] bandOffsets;
   protected int[] bankIndices;
   
-  /** Number of bands in the image described. */
-  // This field shadows the package-private numBands in SampleModel.
+  /** 
+   * Number of bands in the image described.
+   * @specnote This field shadows the protected numBands in SampleModel.
+   */   
   protected int numBands;
   
   /** Used when creating data buffers. */
@@ -101,6 +103,7 @@
     
     this.bandOffsets = bandOffsets;
     this.bankIndices = bankIndices;
+    this.numBands = bandOffsets.length;
 
     this.numBanks = 0;
     for (int b=0; b<bankIndices.length; b++)
Index: java/awt/image/SampleModel.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/image/SampleModel.java,v
retrieving revision 1.8
diff -u -r1.8 SampleModel.java
--- java/awt/image/SampleModel.java     1 Oct 2005 18:57:57 -0000       1.8
+++ java/awt/image/SampleModel.java     3 Oct 2005 17:44:44 -0000
@@ -49,7 +49,7 @@
   
   /** Number of bands in the image described.  Package-private here,
       shadowed by ComponentSampleModel. */
-  int numBands;
+  protected int numBands;
 
   /** 
    * The DataBuffer type that is used to store the data of the image




reply via email to

[Prev in Thread] Current Thread [Next in Thread]