*/
void serialize(SkWStream*, EncodeBitmap encoder = NULL) const;
+ /**
+ * @Deprecated
+ * Old version of EncodeBitmap, here to prevent chrome tree from going
+ * red. Will be removed once chrome is switched to the new version.
+ */
+ typedef bool (*OldEncodeBitmap)(SkWStream*, const SkBitmap&);
+
+ /**
+ * @Deprecated
+ * Old version of serialize, taking the old version of EncodeBitmap,
+ * to keep the chrome build green. Will be removed once chrome is
+ * switched to the new version.
+ */
+ void serialize(SkWStream*, OldEncodeBitmap) const;
+
#ifdef SK_BUILD_FOR_ANDROID
/** Signals that the caller is prematurely done replaying the drawing
commands. This can be called from a canvas virtual while the picture
}
}
+#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;