GreyscaleRotatedLuminanceSource: implemented getMatrix()
[zxing.git] / cpp / core / src / zxing / common / GreyscaleRotatedLuminanceSource.cpp
index 4e3aec8..25c09db 100644 (file)
@@ -55,8 +55,14 @@ unsigned char* GreyscaleRotatedLuminanceSource::getRow(int y, unsigned char* row
 }
 
 unsigned char* GreyscaleRotatedLuminanceSource::getMatrix() {
-  // FIXME(flyashi): fine for 1D scanning, need to implement for 2D scanning
-  return NULL;
+  unsigned char* result = new unsigned char[width_ * height_];
+  unsigned char* row = new unsigned char[width_];
+  for (int y = 0; y < height_; y++) {
+    row = getRow(y, row);
+    memcpy(result + y * width_, row, width_);
+  }
+  delete [] row;
+  return result;
 }
 
 } // namespace