aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-04 21:46:08 +0000
committerGravatar scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-10-04 21:46:08 +0000
commit5a7c6be72b940dde8ff6ad2485a09aecd56a2660 (patch)
treedae271d0e09ac6fcbb50dbc4509755055f20fc9c /tools
parent94bc60f9864094edbfb787b09c963d8818c8962f (diff)
Add the ability to provide function pointers to SkPicture serialization
and deserialization for encoding and decoding bitmaps. Remove kForceFlattenBitmapPixels_Flag, which is no longer used. When an SkOrderedReadBuffer needs to read a bitmap, if it does not have an image decoder, use a dummy bitmap. In GM, add a tolerance option for color differences, used when testing picture serialization, so it can assume two images are the same even though PNG encoding/decoding may have resulted in small differences. Create dummy implementations for SkImageDecoder and SkImageEncoder functions in SkImageDecoder_empty so that a project that does not want to include the images project it can still build. Allow ports to build without images project. In Mac's image encoder, copy 4444 to 8888 before encoding. Add SkWriter32::reservePad, to provide a pointer to write non 4 byte aligned data, padded with zeroes. In bench_ and render_ pictures, pass decode function to SkPicture creation from a stream. BUG=https://code.google.com/p/skia/issues/detail?id=842 Review URL: https://codereview.appspot.com/6551071 git-svn-id: http://skia.googlecode.com/svn/trunk@5818 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/bench_pictures_main.cpp3
-rw-r--r--tools/render_pictures_main.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp
index 26943d9120..e602bd923d 100644
--- a/tools/bench_pictures_main.cpp
+++ b/tools/bench_pictures_main.cpp
@@ -10,6 +10,7 @@
#include "SkBenchLogger.h"
#include "SkCanvas.h"
#include "SkGraphics.h"
+#include "SkImageDecoder.h"
#include "SkMath.h"
#include "SkOSFile.h"
#include "SkPicture.h"
@@ -109,7 +110,7 @@ static bool run_single_benchmark(const SkString& inputPath,
}
bool success = false;
- SkPicture picture(&inputStream, &success);
+ SkPicture picture(&inputStream, &success, &SkImageDecoder::DecodeStream);
if (!success) {
SkString err;
err.printf("Could not read an SkPicture from %s\n", inputPath.c_str());
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 477272df25..6d6e8db19a 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -9,6 +9,7 @@
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkGraphics.h"
+#include "SkImageDecoder.h"
#include "SkMath.h"
#include "SkOSFile.h"
#include "SkPicture.h"
@@ -96,7 +97,7 @@ static bool render_picture(const SkString& inputPath, const SkString& outputDir,
}
bool success = false;
- SkPicture picture(&inputStream, &success);
+ SkPicture picture(&inputStream, &success, &SkImageDecoder::DecodeStream);
if (!success) {
SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str());
return false;