Revert "Revert of implement readPixels and writePixels natively, w/o using the (deprecated) (https://codereview.chromium.org/199733016/)"

This reverts commit 9a90bd16dc6756395c422adf0f24560d033ed9ea.

BUG=skia:
R=bsalomon@google.com

Review URL: https://codereview.chromium.org/211293002

git-svn-id: http://skia.googlecode.com/svn/trunk@13939 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkConfig8888.h b/src/core/SkConfig8888.h
index 041773e..97a3433 100644
--- a/src/core/SkConfig8888.h
+++ b/src/core/SkConfig8888.h
@@ -5,75 +5,27 @@
  * found in the LICENSE file.
  */
 
-#ifndef SkConfig8888_DEFINED
-#define SkConfig8888_DEFINED
+#ifndef SkPixelInfo_DEFINED
+#define SkPixelInfo_DEFINED
 
-#include "SkCanvas.h"
-#include "SkColorPriv.h"
+#include "SkImageInfo.h"
 
-/**
- * Converts pixels from one Config8888 to another Config8888
- */
-void SkConvertConfig8888Pixels(uint32_t* dstPixels,
-                               size_t dstRowBytes,
-                               SkCanvas::Config8888 dstConfig,
-                               const uint32_t* srcPixels,
-                               size_t srcRowBytes,
-                               SkCanvas::Config8888 srcConfig,
-                               int width,
-                               int height);
+struct SkPixelInfo {
+    SkColorType fColorType;
+    SkAlphaType fAlphaType;
+    size_t      fRowBytes;
+};
 
-/**
- * Packs a, r, g, b, values into byte order specified by config.
- */
-uint32_t SkPackConfig8888(SkCanvas::Config8888 config,
-                          uint32_t a,
-                          uint32_t r,
-                          uint32_t g,
-                          uint32_t b);
+struct SkDstPixelInfo : SkPixelInfo {
+    void* fPixels;
+};
 
-///////////////////////////////////////////////////////////////////////////////
-// Implementation
+struct SkSrcPixelInfo : SkPixelInfo {
+    const void* fPixels;
 
-namespace {
-
-/**
-  Copies all pixels from a bitmap to a dst ptr with a given rowBytes and
-  Config8888. The bitmap must have kARGB_8888_Config.
- */
-
-static inline void SkCopyBitmapToConfig8888(uint32_t* dstPixels,
-                                     size_t dstRowBytes,
-                                     SkCanvas::Config8888 dstConfig8888,
-                                     const SkBitmap& srcBmp) {
-    SkASSERT(SkBitmap::kARGB_8888_Config == srcBmp.config());
-    SkAutoLockPixels alp(srcBmp);
-    int w = srcBmp.width();
-    int h = srcBmp.height();
-    size_t srcRowBytes = srcBmp.rowBytes();
-    const uint32_t* srcPixels = reinterpret_cast<uint32_t*>(srcBmp.getPixels());
-
-    SkConvertConfig8888Pixels(dstPixels, dstRowBytes, dstConfig8888, srcPixels, srcRowBytes, SkCanvas::kNative_Premul_Config8888, w, h);
-}
-
-/**
-  Copies over all pixels in a bitmap from a src ptr with a given rowBytes and
-  Config8888. The bitmap must have pixels and be kARGB_8888_Config.
- */
-static inline void SkCopyConfig8888ToBitmap(const SkBitmap& dstBmp,
-                                     const uint32_t* srcPixels,
-                                     size_t srcRowBytes,
-                                     SkCanvas::Config8888 srcConfig8888) {
-    SkASSERT(SkBitmap::kARGB_8888_Config == dstBmp.config());
-    SkAutoLockPixels alp(dstBmp);
-    int w = dstBmp.width();
-    int h = dstBmp.height();
-    size_t dstRowBytes = dstBmp.rowBytes();
-    uint32_t* dstPixels = reinterpret_cast<uint32_t*>(dstBmp.getPixels());
-
-    SkConvertConfig8888Pixels(dstPixels, dstRowBytes, SkCanvas::kNative_Premul_Config8888, srcPixels, srcRowBytes, srcConfig8888, w, h);
-}
-
-}
+    // Guaranteed to work even if src.fPixels and dst.fPixels are the same
+    // (but not if they overlap partially)
+    bool convertPixelsTo(SkDstPixelInfo* dst, int width, int height) const;
+};
 
 #endif