#include "SkDevice.h"
#include "SkGraphics.h"
+#include "SkImageDecoder.h"
#include "SkImageEncoder.h"
#include "SkPicture.h"
#include "SkPicturePlayback.h"
virtual bool translate(SkScalar dx, SkScalar dy) SK_OVERRIDE {
++fTransTot;
+#if 0
if (0 == dx && 0 == dy) {
++fTransSkipped;
return true;
}
+#endif
return INHERITED::translate(dx, dy);
}
virtual bool scale(SkScalar sx, SkScalar sy) SK_OVERRIDE {
++fScalesTot;
+#if 0
if (SK_Scalar1 == sx && SK_Scalar1 == sy) {
++fScalesSkipped;
return true;
}
+#endif
return INHERITED::scale(sx, sy);
}
typedef SkPicture INHERITED;
};
+static bool PNGEncodeBitmapToStream(SkWStream* stream, const SkBitmap& bitmap) {
+ return SkImageEncoder::EncodeStream(stream, bitmap, SkImageEncoder::kPNG_Type, 100);
+}
// This function is not marked as 'static' so it can be referenced externally
// in the iOS build.
SkFILEStream inStream(inFile.c_str());
if (inStream.isValid()) {
- inPicture = SkNEW_ARGS(SkPicture, (&inStream));
+ inPicture = SkNEW_ARGS(SkPicture,
+ (&inStream, NULL, &SkImageDecoder::DecodeStream));
}
if (NULL == inPicture) {
SkFilterPicture outPicture(inPicture->width(), inPicture->height(), filterRecord);
SkFILEWStream outStream(outFile.c_str());
- outPicture.serialize(&outStream);
+ outPicture.serialize(&outStream, &PNGEncodeBitmapToStream);
}
if (!textureDir.isEmpty()) {