title: zxing lib not smoothly detecting qrcode in portrait mode
body: <p>I've successfully modified ZXing lib to portrait mode <a href="https://stackoverflow.com/questions/16252791/zxing-camera-in-portrait-mode-on-android?rq=1">following this post</a>, also modify the preview rect to an square like img below. But I found <strong>the actually scanning rect is only half size of preview rect</strong>, only when I <strong>aligned qrcode to upper half of preview rect</strong> then I can get a result quick and smooth, just like ZXing demo app.</p>
  
  <p>I check both <strong>getFramingRect()</strong> &amp; <strong>getFramingRectInPreview()</strong> method in <strong>CameraManager</strong> to modify the preview rect, and from ViewFinderView.onDraw() I can print out those 2 rect. But I still don't know which rect is actually for <strong>DETECTING</strong>. Is it frame or previewFrame? Or something else? How could I align my preview square rect to the detecting rect???</p>
  
  <pre><code>@Override
  public void onDraw(Canvas canvas) {
      if (cameraManager == null) {
          return; // not ready yet, early draw before done configuring
      }
      Rect frame = cameraManager.getFramingRect();
      Rect previewFrame = cameraManager.getFramingRectInPreview();
      if (frame == null || previewFrame == null) {
          return;
      }
      int width = canvas.getWidth();
      int height = canvas.getHeight();
  
      Log.d(TAG, "@ FramingRect : " + frame.left + "/" + frame.top + "/" + frame.right + "/" + frame.bottom);
      Log.d(TAG, "@ Preview FramingRect : " +
              previewFrame.left + "/" + previewFrame.top + "/" + previewFrame.right + "/" + previewFrame.bottom);
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ug5QR.png" alt="enter image description here"></p>
  
  <p>Whenever I adjust the previewRect in the <code>getFramingRectInPreview()</code> this exception will occur:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Crop rectangle does not fit within image data.
      at com.google.zxing.PlanarYUVLuminanceSource.&lt;init&gt;(PlanarYUVLuminanceSource.java:50)
      at com.google.zxing.client.android.camera.CameraManager.buildLuminanceSource(CameraManager.java:339)
      at com.google.zxing.client.android.DecodeHandler.decode(DecodeHandler.java:87)
      at com.google.zxing.client.android.DecodeHandler.handleMessage(DecodeHandler.java:55)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:137)
      at com.google.zxing.client.android.DecodeThread.run(DecodeThread.java:104)
  </code></pre>
  
  <p>After try&amp;error I can only move previewRect down by 100, move right by 60. It seems make detecting process more smooth.</p>