Replace EncodeBitmap with an interface.

Gives more flexibility to the caller to decide whether to use the
encoded data returned by refEncodedData().

Provides an implementation that supports the old version of
SkPicture::serialize().

TODO: Update Chrome, so we can remove SK_LEGACY_ENCODE_BITMAP entirely

BUG=skia:3190

Review URL: https://codereview.chromium.org/784643002
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 3eb1247..46b039d 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1039,7 +1039,7 @@
 
     static SkPicture* stream_to_new_picture(const SkPicture& src) {
         SkDynamicMemoryWStream storage;
-        src.serialize(&storage, NULL);
+        src.serialize(&storage);
         SkAutoTUnref<SkStreamAsset> pictReadback(storage.detachAsStream());
         SkPicture* retval = SkPicture::CreateFromStream(pictReadback,
                                                         &SkImageDecoder::DecodeMemory);