Index: src/core/SkPicture.cpp |
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp |
index ab2faea6b6b4eb38b6e0a9a9ac4ae5338cb46c8b..6d3772823c899408f935419dde90ae8791b1881c 100644 |
--- a/src/core/SkPicture.cpp |
+++ b/src/core/SkPicture.cpp |
@@ -301,6 +301,34 @@ void SkPicture::initFromStream(SkStream* stream, bool* success, InstallPixelRefP |
} |
} |
+#define PREVENT_CHROME_BREAKAGE |
+#ifdef PREVENT_CHROME_BREAKAGE |
+// This block of code is to allow chromium to build until https://codereview.chromium.org/15496006/ |
+// is submitted. Then it will be reverted. |
+#include "SkThread.h" |
+ |
+static SkPicture::OldEncodeBitmap gOldEncodeBitmapFunction; |
+ |
+SK_DECLARE_STATIC_MUTEX(gEncodeFunctionMutex); |
+ |
+static SkData* encode_from_old_encoder(size_t* pixelRefOffset, const SkBitmap& bm) { |
+ SkASSERT(gOldEncodeBitmapFunction != NULL); |
+ SkDynamicMemoryWStream stream; |
+ if (!gOldEncodeBitmapFunction(&stream, bm)) { |
+ return NULL; |
+ } |
+ return stream.copyToData(); |
+} |
+ |
+void SkPicture::serialize(SkWStream* stream, OldEncodeBitmap oldEncoder) const { |
+ SkAutoMutexAcquire ac(gEncodeFunctionMutex); |
+ gOldEncodeBitmapFunction = oldEncoder; |
+ this->serialize(stream, &encode_from_old_encoder); |
+ gOldEncodeBitmapFunction = NULL; |
+} |
+ |
+#endif // PREVENT_CHROME_BREAKAGE |
+ |
void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { |
SkPicturePlayback* playback = fPlayback; |