Spell checker fixes, narrowed scope / made less visible where possible. Little stuff
[zxing.git] / core / src / com / google / zxing / common / GridSampler.java
index 4cf2776..e7af414 100644 (file)
@@ -16,7 +16,6 @@
 
 package com.google.zxing.common;
 
-import com.google.zxing.MonochromeBitmapSource;
 import com.google.zxing.ReaderException;
 
 /**
@@ -34,7 +33,7 @@ import com.google.zxing.ReaderException;
  */
 public abstract class GridSampler {
 
-  private static GridSampler gridSampler = null;
+  private static GridSampler gridSampler = new DefaultGridSampler();
 
   /**
    * Sets the implementation of {@link GridSampler} used by the library. One global
@@ -43,7 +42,7 @@ public abstract class GridSampler {
    * in the whole lifetime of the JVM. For instance, an Android activity can swap in
    * an implementation that takes advantage of native platform libraries.
    * 
-   * @param newGridSampler
+   * @param newGridSampler The platform-specific object to install.
    */
   public static void setGridSampler(GridSampler newGridSampler) {
     if (newGridSampler == null) {
@@ -56,11 +55,6 @@ public abstract class GridSampler {
    * @return the current implementation of {@link GridSampler}
    */
   public static GridSampler getInstance() {
-    // No real point in trying to make this thread-safe;
-    // doesn't matter if a second instance is created
-    if (gridSampler == null) {
-      gridSampler = new DefaultGridSampler();
-    }
     return gridSampler;
   }
 
@@ -81,13 +75,13 @@ public abstract class GridSampler {
    * <p>These 16 parameters define the transformation needed to sample the image.</p>
    *
    * @param image image to sample
-   * @param dimension width/height of {@link BitMatrix} to sample from iamge
+   * @param dimension width/height of {@link BitMatrix} to sample from image
    * @return {@link BitMatrix} representing a grid of points sampled from the image within a region
    *   defined by the "from" parameters
    * @throws ReaderException if image can't be sampled, for example, if the transformation defined
    *   by the given points is invalid or results in sampling outside the image boundaries
    */
-  public abstract BitMatrix sampleGrid(MonochromeBitmapSource image,
+  public abstract BitMatrix sampleGrid(BitMatrix image,
                                        int dimension,
                                        float p1ToX, float p1ToY,
                                        float p2ToX, float p2ToY,
@@ -113,7 +107,7 @@ public abstract class GridSampler {
    * @param points actual points in x1,y1,...,xn,yn form
    * @throws ReaderException if an endpoint is lies outside the image boundaries
    */
-  protected static void checkAndNudgePoints(MonochromeBitmapSource image, float[] points)
+  protected static void checkAndNudgePoints(BitMatrix image, float[] points)
       throws ReaderException {
     int width = image.getWidth();
     int height = image.getHeight();