2012-06-12 14:56:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2012-11-07 18:01:46 +00:00
|
|
|
#include "CopyTilesRenderer.h"
|
2012-06-12 14:56:36 +00:00
|
|
|
#include "SkBitmap.h"
|
|
|
|
#include "SkCanvas.h"
|
2012-07-20 22:34:27 +00:00
|
|
|
#include "SkDevice.h"
|
2012-09-10 17:19:06 +00:00
|
|
|
#include "SkGraphics.h"
|
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
2012-10-04 21:46:08 +00:00
|
|
|
#include "SkImageDecoder.h"
|
2012-12-18 22:24:03 +00:00
|
|
|
#include "SkImageEncoder.h"
|
2012-08-23 20:53:25 +00:00
|
|
|
#include "SkMath.h"
|
2012-06-12 14:56:36 +00:00
|
|
|
#include "SkOSFile.h"
|
|
|
|
#include "SkPicture.h"
|
|
|
|
#include "SkStream.h"
|
|
|
|
#include "SkString.h"
|
2012-07-13 18:55:53 +00:00
|
|
|
#include "SkTArray.h"
|
2012-07-26 17:27:57 +00:00
|
|
|
#include "PictureRenderer.h"
|
2012-06-22 18:24:56 +00:00
|
|
|
#include "picture_utils.h"
|
2012-06-12 14:56:36 +00:00
|
|
|
|
|
|
|
static void usage(const char* argv0) {
|
|
|
|
SkDebugf("SkPicture rendering tool\n");
|
|
|
|
SkDebugf("\n"
|
|
|
|
"Usage: \n"
|
2012-10-26 13:26:55 +00:00
|
|
|
" %s <input>... \n"
|
2012-11-07 18:01:46 +00:00
|
|
|
" [-w <outputDir>]\n"
|
|
|
|
" [--mode pow2tile minWidth height | copyTile width height | simple\n"
|
|
|
|
" | tile width height]\n"
|
2012-10-03 17:32:33 +00:00
|
|
|
" [--pipe]\n"
|
2012-12-18 22:24:03 +00:00
|
|
|
" [--bbh bbhType]\n"
|
2012-10-03 17:32:33 +00:00
|
|
|
" [--multi count]\n"
|
2013-01-16 18:18:48 +00:00
|
|
|
" [--validate [--maxComponentDiff n]]\n"
|
2012-12-18 22:24:03 +00:00
|
|
|
" [--writeWholeImage]\n"
|
|
|
|
" [--clone n]\n"
|
2012-12-17 19:25:54 +00:00
|
|
|
" [--viewport width height][--scale sf]\n"
|
2012-08-20 15:04:04 +00:00
|
|
|
" [--device bitmap"
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
" | gpu"
|
|
|
|
#endif
|
|
|
|
"]"
|
2012-06-12 14:56:36 +00:00
|
|
|
, argv0);
|
2012-07-20 22:34:27 +00:00
|
|
|
SkDebugf("\n\n");
|
2012-06-12 14:56:36 +00:00
|
|
|
SkDebugf(
|
2012-08-02 18:57:53 +00:00
|
|
|
" input: A list of directories and files to use as input. Files are\n"
|
|
|
|
" expected to have the .skp extension.\n\n");
|
2012-06-12 14:56:36 +00:00
|
|
|
SkDebugf(
|
2012-08-02 18:57:53 +00:00
|
|
|
" outputDir: directory to write the rendered images.\n\n");
|
2012-07-20 22:34:27 +00:00
|
|
|
SkDebugf(
|
2012-11-07 18:01:46 +00:00
|
|
|
" --mode pow2tile minWidth height | copyTile width height | simple\n"
|
|
|
|
" | tile width height | rerecord: Run in the corresponding mode.\n"
|
2012-08-23 20:53:25 +00:00
|
|
|
" Default is simple.\n");
|
2012-07-20 22:34:27 +00:00
|
|
|
SkDebugf(
|
2012-11-07 18:01:46 +00:00
|
|
|
" pow2tile minWidth height, Creates tiles with widths\n"
|
2012-08-23 20:53:25 +00:00
|
|
|
" that are all a power of two\n"
|
|
|
|
" such that they minimize the\n"
|
|
|
|
" amount of wasted tile space.\n"
|
|
|
|
" minWidth is the minimum width\n"
|
|
|
|
" of these tiles and must be a\n"
|
|
|
|
" power of two. A simple render\n"
|
|
|
|
" is done with these tiles.\n");
|
|
|
|
SkDebugf(
|
2012-11-07 17:52:48 +00:00
|
|
|
" simple, Render using the default rendering method.\n"
|
|
|
|
" rerecord, Record the picture as a new skp, with the bitmaps PNG encoded.\n"
|
|
|
|
);
|
2012-08-02 18:57:53 +00:00
|
|
|
SkDebugf(
|
2012-11-07 18:01:46 +00:00
|
|
|
" tile width height, Do a simple render using tiles\n"
|
|
|
|
" with the given dimensions.\n"
|
|
|
|
" copyTile width height, Draw the picture, then copy it into tiles.\n"
|
|
|
|
" Does not support percentages.\n"
|
|
|
|
" If the picture is large enough, breaks it into\n"
|
|
|
|
" larger tiles (and draws the picture once per\n"
|
|
|
|
" larger tile) to avoid creating a large canvas.\n"
|
|
|
|
" Add --tiles x y to specify the number of tiles\n"
|
|
|
|
" per larger tile in the x and y direction.\n"
|
|
|
|
);
|
2012-08-20 15:04:04 +00:00
|
|
|
SkDebugf("\n");
|
|
|
|
SkDebugf(
|
2012-10-03 17:32:33 +00:00
|
|
|
" --multi count : Set the number of threads for multi threaded drawing. Must be greater\n"
|
|
|
|
" than 1. Only works with tiled rendering.\n"
|
2012-12-13 21:40:48 +00:00
|
|
|
" --viewport width height : Set the viewport.\n"
|
2012-12-17 19:25:54 +00:00
|
|
|
" --scale sf : Scale drawing by sf.\n"
|
2012-11-02 21:28:12 +00:00
|
|
|
" --pipe: Benchmark SkGPipe rendering. Currently incompatible with \"mode\".\n");
|
2012-10-03 17:32:33 +00:00
|
|
|
SkDebugf(
|
2012-12-18 22:24:03 +00:00
|
|
|
" --validate: Verify that the rendered image contains the same pixels as "
|
|
|
|
"the picture rendered in simple mode.\n"
|
2013-01-16 18:18:48 +00:00
|
|
|
" --maxComponentDiff: maximum diff on a component. Default is 256, "
|
|
|
|
"which means we report but we do not generate an error.\n"
|
2012-12-18 22:24:03 +00:00
|
|
|
" --writeWholeImage: In tile mode, write the entire rendered image to a "
|
|
|
|
"file, instead of an image for each tile.\n");
|
|
|
|
SkDebugf(
|
|
|
|
" --clone n: Clone the picture n times before rendering.\n");
|
|
|
|
SkDebugf(
|
|
|
|
" --bbh bbhType [width height]: Set the bounding box hierarchy type to\n"
|
|
|
|
" be used. Accepted values are: none, rtree, grid. Default\n"
|
|
|
|
" value is none. Not compatible with --pipe. With value\n"
|
|
|
|
" 'grid', width and height must be specified. 'grid' can\n"
|
|
|
|
" only be used with modes tile, record, and\n"
|
|
|
|
" playbackCreation.");
|
|
|
|
SkDebugf(
|
2012-08-20 15:04:04 +00:00
|
|
|
" --device bitmap"
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
" | gpu"
|
|
|
|
#endif
|
|
|
|
": Use the corresponding device. Default is bitmap.\n");
|
|
|
|
SkDebugf(
|
|
|
|
" bitmap, Render to a bitmap.\n");
|
|
|
|
#if SK_SUPPORT_GPU
|
2012-08-20 15:04:12 +00:00
|
|
|
SkDebugf(
|
2012-08-20 15:04:04 +00:00
|
|
|
" gpu, Render to the GPU.\n");
|
|
|
|
#endif
|
2012-06-12 14:56:36 +00:00
|
|
|
}
|
|
|
|
|
2012-07-13 18:22:59 +00:00
|
|
|
static void make_output_filepath(SkString* path, const SkString& dir,
|
2012-06-12 14:56:36 +00:00
|
|
|
const SkString& name) {
|
2012-06-22 18:24:56 +00:00
|
|
|
sk_tools::make_filepath(path, dir, name);
|
2012-09-20 14:54:21 +00:00
|
|
|
// Remove ".skp"
|
|
|
|
path->remove(path->size() - 4, 4);
|
2012-06-12 14:56:36 +00:00
|
|
|
}
|
|
|
|
|
2012-10-26 13:26:55 +00:00
|
|
|
static bool render_picture(const SkString& inputPath, const SkString* outputDir,
|
2012-12-18 22:24:03 +00:00
|
|
|
sk_tools::PictureRenderer& renderer,
|
|
|
|
SkBitmap** out,
|
|
|
|
int clones) {
|
2012-07-09 18:32:08 +00:00
|
|
|
SkString inputFilename;
|
|
|
|
sk_tools::get_basename(&inputFilename, inputPath);
|
2012-06-22 18:24:56 +00:00
|
|
|
|
2012-07-09 18:32:08 +00:00
|
|
|
SkFILEStream inputStream;
|
2012-06-22 18:24:56 +00:00
|
|
|
inputStream.setPath(inputPath.c_str());
|
|
|
|
if (!inputStream.isValid()) {
|
|
|
|
SkDebugf("Could not open file %s\n", inputPath.c_str());
|
2012-09-17 18:26:06 +00:00
|
|
|
return false;
|
2012-06-22 18:24:56 +00:00
|
|
|
}
|
|
|
|
|
2012-09-17 18:26:06 +00:00
|
|
|
bool success = false;
|
2012-12-18 22:24:03 +00:00
|
|
|
SkPicture* picture = SkNEW_ARGS(SkPicture,
|
|
|
|
(&inputStream, &success, &SkImageDecoder::DecodeStream));
|
2012-09-17 18:26:06 +00:00
|
|
|
if (!success) {
|
|
|
|
SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str());
|
|
|
|
return false;
|
|
|
|
}
|
2012-07-26 17:27:57 +00:00
|
|
|
|
2012-12-18 22:24:03 +00:00
|
|
|
for (int i = 0; i < clones; ++i) {
|
|
|
|
SkPicture* clone = picture->clone();
|
|
|
|
SkDELETE(picture);
|
|
|
|
picture = clone;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(),
|
2012-09-10 18:18:38 +00:00
|
|
|
inputPath.c_str());
|
2012-09-14 02:01:10 +00:00
|
|
|
|
2012-12-18 22:24:03 +00:00
|
|
|
renderer.init(picture);
|
2012-10-01 20:06:09 +00:00
|
|
|
renderer.setup();
|
2012-08-07 17:11:33 +00:00
|
|
|
|
2012-10-26 13:26:55 +00:00
|
|
|
SkString* outputPath = NULL;
|
|
|
|
if (NULL != outputDir) {
|
|
|
|
outputPath = SkNEW(SkString);
|
|
|
|
make_output_filepath(outputPath, *outputDir, inputFilename);
|
|
|
|
}
|
2012-12-18 22:24:03 +00:00
|
|
|
|
|
|
|
success = renderer.render(outputPath, out);
|
2012-10-26 13:26:55 +00:00
|
|
|
if (outputPath) {
|
|
|
|
if (!success) {
|
|
|
|
SkDebugf("Could not write to file %s\n", outputPath->c_str());
|
|
|
|
}
|
|
|
|
SkDELETE(outputPath);
|
2012-09-20 14:54:21 +00:00
|
|
|
}
|
2012-08-07 17:11:33 +00:00
|
|
|
|
|
|
|
renderer.end();
|
2012-12-18 22:24:03 +00:00
|
|
|
|
|
|
|
SkDELETE(picture);
|
2012-09-17 18:26:06 +00:00
|
|
|
return success;
|
2012-06-12 14:56:36 +00:00
|
|
|
}
|
|
|
|
|
2013-01-16 18:18:48 +00:00
|
|
|
static inline int getByte(uint32_t value, int index) {
|
|
|
|
SkASSERT(0 <= index && index < 4);
|
|
|
|
return (value >> (index * 8)) & 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int MaxByteDiff(uint32_t v1, uint32_t v2) {
|
|
|
|
return SkMax32(SkMax32(abs(getByte(v1, 0) - getByte(v2, 0)), abs(getByte(v1, 1) - getByte(v2, 1))),
|
|
|
|
SkMax32(abs(getByte(v1, 2) - getByte(v2, 2)), abs(getByte(v1, 3) - getByte(v2, 3))));
|
|
|
|
}
|
|
|
|
|
2012-12-18 22:24:03 +00:00
|
|
|
static bool render_picture(const SkString& inputPath, const SkString* outputDir,
|
|
|
|
sk_tools::PictureRenderer& renderer,
|
2013-01-16 18:18:48 +00:00
|
|
|
bool validate, int maxComponentDiff,
|
2012-12-18 22:24:03 +00:00
|
|
|
bool writeWholeImage,
|
|
|
|
int clones) {
|
2013-01-16 18:18:48 +00:00
|
|
|
int diffs[256] = {0};
|
2012-12-18 22:24:03 +00:00
|
|
|
SkBitmap* bitmap = NULL;
|
|
|
|
bool success = render_picture(inputPath,
|
|
|
|
writeWholeImage ? NULL : outputDir,
|
|
|
|
renderer,
|
|
|
|
validate || writeWholeImage ? &bitmap : NULL, clones);
|
|
|
|
|
|
|
|
if (!success || ((validate || writeWholeImage) && bitmap == NULL)) {
|
|
|
|
SkDebugf("Failed to draw the picture.\n");
|
|
|
|
SkDELETE(bitmap);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (validate) {
|
|
|
|
SkBitmap* referenceBitmap = NULL;
|
|
|
|
sk_tools::SimplePictureRenderer referenceRenderer;
|
|
|
|
success = render_picture(inputPath, NULL, referenceRenderer,
|
|
|
|
&referenceBitmap, 0);
|
|
|
|
|
|
|
|
if (!success || !referenceBitmap) {
|
|
|
|
SkDebugf("Failed to draw the reference picture.\n");
|
|
|
|
SkDELETE(bitmap);
|
|
|
|
SkDELETE(referenceBitmap);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (success && (bitmap->width() != referenceBitmap->width())) {
|
|
|
|
SkDebugf("Expected image width: %i, actual image width %i.\n",
|
|
|
|
referenceBitmap->width(), bitmap->width());
|
|
|
|
SkDELETE(bitmap);
|
|
|
|
SkDELETE(referenceBitmap);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (success && (bitmap->height() != referenceBitmap->height())) {
|
|
|
|
SkDebugf("Expected image height: %i, actual image height %i",
|
|
|
|
referenceBitmap->height(), bitmap->height());
|
|
|
|
SkDELETE(bitmap);
|
|
|
|
SkDELETE(referenceBitmap);
|
|
|
|
return false;
|
|
|
|
}
|
2012-12-19 02:01:38 +00:00
|
|
|
|
2012-12-18 22:24:03 +00:00
|
|
|
for (int y = 0; success && y < bitmap->height(); y++) {
|
|
|
|
for (int x = 0; success && x < bitmap->width(); x++) {
|
2013-01-16 18:18:48 +00:00
|
|
|
int diff = MaxByteDiff(*referenceBitmap->getAddr32(x, y),
|
|
|
|
*bitmap->getAddr32(x, y));
|
|
|
|
SkASSERT(diff >= 0 && diff <= 255);
|
|
|
|
diffs[diff]++;
|
2013-01-17 07:06:06 +00:00
|
|
|
|
2013-01-16 18:18:48 +00:00
|
|
|
if (diff > maxComponentDiff) {
|
|
|
|
SkDebugf("Expected pixel at (%i %i) exceedds maximum "
|
|
|
|
"component diff of %i: 0x%x, actual 0x%x\n",
|
|
|
|
x, y, maxComponentDiff,
|
2013-01-11 16:08:07 +00:00
|
|
|
*referenceBitmap->getAddr32(x, y),
|
2012-12-18 22:24:03 +00:00
|
|
|
*bitmap->getAddr32(x, y));
|
|
|
|
SkDELETE(bitmap);
|
|
|
|
SkDELETE(referenceBitmap);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SkDELETE(referenceBitmap);
|
2013-01-16 18:18:48 +00:00
|
|
|
|
|
|
|
for (int i = 1; i <= 255; ++i) {
|
|
|
|
if(diffs[i] > 0) {
|
|
|
|
SkDebugf("Number of pixels with max diff of %i is %i\n", i, diffs[i]);
|
|
|
|
}
|
|
|
|
}
|
2012-12-18 22:24:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (writeWholeImage) {
|
|
|
|
sk_tools::force_all_opaque(*bitmap);
|
|
|
|
if (NULL != outputDir && writeWholeImage) {
|
|
|
|
SkString inputFilename;
|
|
|
|
sk_tools::get_basename(&inputFilename, inputPath);
|
|
|
|
SkString outputPath;
|
|
|
|
make_output_filepath(&outputPath, *outputDir, inputFilename);
|
|
|
|
outputPath.append(".png");
|
|
|
|
if (!SkImageEncoder::EncodeFile(outputPath.c_str(), *bitmap,
|
|
|
|
SkImageEncoder::kPNG_Type, 100)) {
|
|
|
|
SkDebugf("Failed to draw the picture.\n");
|
|
|
|
success = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SkDELETE(bitmap);
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-26 13:26:55 +00:00
|
|
|
static int process_input(const SkString& input, const SkString* outputDir,
|
2012-12-18 22:24:03 +00:00
|
|
|
sk_tools::PictureRenderer& renderer,
|
2013-01-16 18:18:48 +00:00
|
|
|
bool validate, int maxComponentDiff,
|
|
|
|
bool writeWholeImage, int clones) {
|
2012-07-13 18:22:59 +00:00
|
|
|
SkOSFile::Iter iter(input.c_str(), "skp");
|
2012-07-09 18:32:08 +00:00
|
|
|
SkString inputFilename;
|
2012-09-17 18:26:06 +00:00
|
|
|
int failures = 0;
|
2012-10-26 13:26:55 +00:00
|
|
|
SkDebugf("process_input, %s\n", input.c_str());
|
2012-07-09 18:32:08 +00:00
|
|
|
if (iter.next(&inputFilename)) {
|
|
|
|
do {
|
|
|
|
SkString inputPath;
|
|
|
|
sk_tools::make_filepath(&inputPath, input, inputFilename);
|
2012-12-18 22:24:03 +00:00
|
|
|
if (!render_picture(inputPath, outputDir, renderer,
|
2013-01-16 18:18:48 +00:00
|
|
|
validate, maxComponentDiff,
|
|
|
|
writeWholeImage, clones)) {
|
2012-09-19 17:28:29 +00:00
|
|
|
++failures;
|
|
|
|
}
|
2012-07-09 18:32:08 +00:00
|
|
|
} while(iter.next(&inputFilename));
|
2012-09-19 17:28:29 +00:00
|
|
|
} else if (SkStrEndsWith(input.c_str(), ".skp")) {
|
2012-07-09 18:32:08 +00:00
|
|
|
SkString inputPath(input);
|
2012-12-18 22:24:03 +00:00
|
|
|
if (!render_picture(inputPath, outputDir, renderer,
|
2013-01-16 18:18:48 +00:00
|
|
|
validate, maxComponentDiff,
|
|
|
|
writeWholeImage, clones)) {
|
2012-09-19 17:28:29 +00:00
|
|
|
++failures;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
SkString warning;
|
|
|
|
warning.printf("Warning: skipping %s\n", input.c_str());
|
|
|
|
SkDebugf(warning.c_str());
|
2012-07-09 18:32:08 +00:00
|
|
|
}
|
2012-09-17 18:26:06 +00:00
|
|
|
return failures;
|
2012-07-09 18:32:08 +00:00
|
|
|
}
|
|
|
|
|
2012-07-13 18:22:59 +00:00
|
|
|
static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>* inputs,
|
2012-12-18 22:24:03 +00:00
|
|
|
sk_tools::PictureRenderer*& renderer, SkString*& outputDir,
|
2013-01-16 18:18:48 +00:00
|
|
|
bool* validate, int* maxComponentDiff,
|
|
|
|
bool* writeWholeImage,
|
2012-12-18 22:24:03 +00:00
|
|
|
int* clones){
|
2012-07-13 18:22:59 +00:00
|
|
|
const char* argv0 = argv[0];
|
|
|
|
char* const* stop = argv + argc;
|
|
|
|
|
2012-08-20 15:04:04 +00:00
|
|
|
sk_tools::PictureRenderer::SkDeviceTypes deviceType =
|
|
|
|
sk_tools::PictureRenderer::kBitmap_DeviceType;
|
|
|
|
|
2012-10-03 17:32:33 +00:00
|
|
|
bool usePipe = false;
|
|
|
|
int numThreads = 1;
|
|
|
|
bool useTiles = false;
|
|
|
|
const char* widthString = NULL;
|
|
|
|
const char* heightString = NULL;
|
2012-12-18 22:24:03 +00:00
|
|
|
int gridWidth = 0;
|
|
|
|
int gridHeight = 0;
|
2012-10-03 17:32:33 +00:00
|
|
|
bool isPowerOf2Mode = false;
|
2012-11-07 18:01:46 +00:00
|
|
|
bool isCopyMode = false;
|
|
|
|
const char* xTilesString = NULL;
|
|
|
|
const char* yTilesString = NULL;
|
2012-10-03 17:32:33 +00:00
|
|
|
const char* mode = NULL;
|
2012-12-18 22:24:03 +00:00
|
|
|
bool gridSupported = false;
|
|
|
|
sk_tools::PictureRenderer::BBoxHierarchyType bbhType =
|
|
|
|
sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
|
|
|
|
*validate = false;
|
2013-01-16 18:18:48 +00:00
|
|
|
*maxComponentDiff = 256;
|
2012-12-18 22:24:03 +00:00
|
|
|
*writeWholeImage = false;
|
|
|
|
*clones = 0;
|
2012-12-13 21:40:48 +00:00
|
|
|
SkISize viewport;
|
|
|
|
viewport.setEmpty();
|
2012-12-17 19:25:54 +00:00
|
|
|
SkScalar scaleFactor = SK_Scalar1;
|
2012-12-18 22:24:03 +00:00
|
|
|
|
2012-07-13 18:22:59 +00:00
|
|
|
for (++argv; argv < stop; ++argv) {
|
2012-08-02 18:57:53 +00:00
|
|
|
if (0 == strcmp(*argv, "--mode")) {
|
2012-11-02 21:28:12 +00:00
|
|
|
if (renderer != NULL) {
|
|
|
|
renderer->unref();
|
|
|
|
SkDebugf("Cannot combine modes.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-08-02 18:57:53 +00:00
|
|
|
|
2012-07-27 20:09:26 +00:00
|
|
|
++argv;
|
2012-08-02 18:57:53 +00:00
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing mode for --mode\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2012-10-03 17:32:33 +00:00
|
|
|
if (0 == strcmp(*argv, "simple")) {
|
2012-08-02 18:57:53 +00:00
|
|
|
renderer = SkNEW(sk_tools::SimplePictureRenderer);
|
2012-11-07 18:01:46 +00:00
|
|
|
} else if ((0 == strcmp(*argv, "tile")) || (0 == strcmp(*argv, "pow2tile"))
|
|
|
|
|| 0 == strcmp(*argv, "copyTile")) {
|
2012-10-03 17:32:33 +00:00
|
|
|
useTiles = true;
|
|
|
|
mode = *argv;
|
2012-08-23 20:53:25 +00:00
|
|
|
|
|
|
|
if (0 == strcmp(*argv, "pow2tile")) {
|
|
|
|
isPowerOf2Mode = true;
|
2012-11-07 18:01:46 +00:00
|
|
|
} else if (0 == strcmp(*argv, "copyTile")) {
|
|
|
|
isCopyMode = true;
|
2012-12-18 22:24:03 +00:00
|
|
|
} else {
|
|
|
|
gridSupported = true;
|
2012-08-23 20:53:25 +00:00
|
|
|
}
|
|
|
|
|
2012-08-02 18:57:53 +00:00
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
2012-08-23 20:53:25 +00:00
|
|
|
SkDebugf("Missing width for --mode %s\n", mode);
|
2012-08-02 18:57:53 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2012-10-03 17:32:33 +00:00
|
|
|
widthString = *argv;
|
2012-08-02 18:57:53 +00:00
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
2012-11-07 18:01:46 +00:00
|
|
|
SkDebugf("Missing height for --mode %s\n", mode);
|
2012-08-02 18:57:53 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-10-03 17:32:33 +00:00
|
|
|
heightString = *argv;
|
2012-11-07 17:52:48 +00:00
|
|
|
} else if (0 == strcmp(*argv, "rerecord")) {
|
|
|
|
renderer = SkNEW(sk_tools::RecordPictureRenderer);
|
2012-07-27 20:09:26 +00:00
|
|
|
} else {
|
2012-08-02 18:57:53 +00:00
|
|
|
SkDebugf("%s is not a valid mode for --mode\n", *argv);
|
2012-07-27 20:09:26 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-12-18 22:24:03 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--bbh")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing value for --bbh\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
if (0 == strcmp(*argv, "none")) {
|
|
|
|
bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
|
|
|
|
} else if (0 == strcmp(*argv, "rtree")) {
|
|
|
|
bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType;
|
|
|
|
} else if (0 == strcmp(*argv, "grid")) {
|
|
|
|
bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType;
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing width for --bbh grid\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
gridWidth = atoi(*argv);
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing height for --bbh grid\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
gridHeight = atoi(*argv);
|
|
|
|
} else {
|
|
|
|
SkDebugf("%s is not a valid value for --bbhType\n", *argv);
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);;
|
|
|
|
}
|
2012-12-13 21:40:48 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--viewport")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing width for --viewport\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
viewport.fWidth = atoi(*argv);
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing height for --viewport\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
viewport.fHeight = atoi(*argv);
|
2012-12-17 19:25:54 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--scale")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing scaleFactor for --scale\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2013-01-07 22:26:05 +00:00
|
|
|
scaleFactor = SkDoubleToScalar(atof(*argv));
|
2012-11-07 18:01:46 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--tiles")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing x for --tiles\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
xTilesString = *argv;
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing y for --tiles\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
yTilesString = *argv;
|
2012-10-03 17:32:33 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--pipe")) {
|
|
|
|
usePipe = true;
|
|
|
|
} else if (0 == strcmp(*argv, "--multi")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
2012-11-02 21:28:12 +00:00
|
|
|
SkSafeUnref(renderer);
|
2012-10-03 17:32:33 +00:00
|
|
|
SkDebugf("Missing arg for --multi\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
numThreads = atoi(*argv);
|
|
|
|
if (numThreads < 2) {
|
2012-11-02 21:28:12 +00:00
|
|
|
SkSafeUnref(renderer);
|
2012-10-03 17:32:33 +00:00
|
|
|
SkDebugf("Number of threads must be at least 2.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-12-18 22:24:03 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--clone")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkSafeUnref(renderer);
|
|
|
|
SkDebugf("Missing arg for --clone\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
*clones = atoi(*argv);
|
|
|
|
if (*clones < 0) {
|
|
|
|
SkSafeUnref(renderer);
|
|
|
|
SkDebugf("Number of clones must be at least 0.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-08-20 15:04:04 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--device")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
2012-11-02 21:28:12 +00:00
|
|
|
SkSafeUnref(renderer);
|
2012-10-03 17:32:33 +00:00
|
|
|
SkDebugf("Missing mode for --device\n");
|
2012-08-20 15:04:04 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == strcmp(*argv, "bitmap")) {
|
|
|
|
deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType;
|
|
|
|
}
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
else if (0 == strcmp(*argv, "gpu")) {
|
|
|
|
deviceType = sk_tools::PictureRenderer::kGPU_DeviceType;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else {
|
2012-11-02 21:28:12 +00:00
|
|
|
SkSafeUnref(renderer);
|
2012-08-20 15:04:04 +00:00
|
|
|
SkDebugf("%s is not a valid mode for --device\n", *argv);
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2012-07-20 22:34:27 +00:00
|
|
|
} else if ((0 == strcmp(*argv, "-h")) || (0 == strcmp(*argv, "--help"))) {
|
2012-11-02 21:28:12 +00:00
|
|
|
SkSafeUnref(renderer);
|
2012-07-20 22:34:27 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
2012-10-26 13:26:55 +00:00
|
|
|
} else if (0 == strcmp(*argv, "-w")) {
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing output directory for -w\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
outputDir = SkNEW_ARGS(SkString, (*argv));
|
2012-12-18 22:24:03 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--validate")) {
|
|
|
|
*validate = true;
|
2013-01-16 18:18:48 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--maxComponentDiff")) {
|
|
|
|
if (!*validate) {
|
|
|
|
SkDebugf("--maxComponentDiff must be used only with --validate\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
++argv;
|
|
|
|
if (argv >= stop) {
|
|
|
|
SkDebugf("Missing arg for --maxComponentDiff\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
*maxComponentDiff = atoi(*argv);
|
|
|
|
if (*maxComponentDiff < 0 || *maxComponentDiff > 256) {
|
|
|
|
SkSafeUnref(renderer);
|
|
|
|
SkDebugf("maxComponentDiff: 0 - 256.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
2013-01-17 07:06:06 +00:00
|
|
|
}
|
2012-12-18 22:24:03 +00:00
|
|
|
} else if (0 == strcmp(*argv, "--writeWholeImage")) {
|
|
|
|
*writeWholeImage = true;
|
2012-07-16 17:29:16 +00:00
|
|
|
} else {
|
|
|
|
inputs->push_back(SkString(*argv));
|
|
|
|
}
|
2012-06-12 14:56:36 +00:00
|
|
|
}
|
2012-07-20 22:34:27 +00:00
|
|
|
|
2012-10-03 17:32:33 +00:00
|
|
|
if (numThreads > 1 && !useTiles) {
|
2012-11-02 21:28:12 +00:00
|
|
|
SkSafeUnref(renderer);
|
2012-10-03 17:32:33 +00:00
|
|
|
SkDebugf("Multithreaded drawing requires tiled rendering.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2012-12-18 22:24:03 +00:00
|
|
|
if (usePipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType != bbhType) {
|
|
|
|
SkDebugf("--pipe and --bbh cannot be used together\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType == bbhType &&
|
|
|
|
!gridSupported) {
|
|
|
|
SkDebugf("'--bbh grid' is not compatible with specified --mode.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
|
2012-10-03 17:32:33 +00:00
|
|
|
if (useTiles) {
|
|
|
|
SkASSERT(NULL == renderer);
|
2012-11-02 21:28:12 +00:00
|
|
|
sk_tools::TiledPictureRenderer* tiledRenderer;
|
2012-11-07 18:01:46 +00:00
|
|
|
if (isCopyMode) {
|
|
|
|
int x, y;
|
|
|
|
if (xTilesString != NULL) {
|
|
|
|
SkASSERT(yTilesString != NULL);
|
|
|
|
x = atoi(xTilesString);
|
|
|
|
y = atoi(yTilesString);
|
|
|
|
if (x <= 0 || y <= 0) {
|
|
|
|
SkDebugf("--tiles must be given values > 0\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
x = y = 4;
|
|
|
|
}
|
|
|
|
tiledRenderer = SkNEW_ARGS(sk_tools::CopyTilesRenderer, (x, y));
|
|
|
|
} else if (numThreads > 1) {
|
2012-11-02 21:28:12 +00:00
|
|
|
tiledRenderer = SkNEW_ARGS(sk_tools::MultiCorePictureRenderer, (numThreads));
|
|
|
|
} else {
|
|
|
|
tiledRenderer = SkNEW(sk_tools::TiledPictureRenderer);
|
|
|
|
}
|
2012-10-03 17:32:33 +00:00
|
|
|
if (isPowerOf2Mode) {
|
|
|
|
int minWidth = atoi(widthString);
|
|
|
|
if (!SkIsPow2(minWidth) || minWidth < 0) {
|
|
|
|
tiledRenderer->unref();
|
|
|
|
SkString err;
|
|
|
|
err.printf("-mode %s must be given a width"
|
|
|
|
" value that is a power of two\n", mode);
|
|
|
|
SkDebugf(err.c_str());
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
tiledRenderer->setTileMinPowerOf2Width(minWidth);
|
|
|
|
} else if (sk_tools::is_percentage(widthString)) {
|
2012-11-07 18:01:46 +00:00
|
|
|
if (isCopyMode) {
|
|
|
|
tiledRenderer->unref();
|
|
|
|
SkString err;
|
|
|
|
err.printf("--mode %s does not support percentages.\n", mode);
|
|
|
|
SkDebugf(err.c_str());
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-10-03 17:32:33 +00:00
|
|
|
tiledRenderer->setTileWidthPercentage(atof(widthString));
|
|
|
|
if (!(tiledRenderer->getTileWidthPercentage() > 0)) {
|
|
|
|
tiledRenderer->unref();
|
2012-11-07 18:01:46 +00:00
|
|
|
SkDebugf("--mode %s must be given a width percentage > 0\n", mode);
|
2012-10-03 17:32:33 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tiledRenderer->setTileWidth(atoi(widthString));
|
|
|
|
if (!(tiledRenderer->getTileWidth() > 0)) {
|
|
|
|
tiledRenderer->unref();
|
2012-11-07 18:01:46 +00:00
|
|
|
SkDebugf("--mode %s must be given a width > 0\n", mode);
|
2012-10-03 17:32:33 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sk_tools::is_percentage(heightString)) {
|
2012-11-07 18:01:46 +00:00
|
|
|
if (isCopyMode) {
|
|
|
|
tiledRenderer->unref();
|
|
|
|
SkString err;
|
|
|
|
err.printf("--mode %s does not support percentages.\n", mode);
|
|
|
|
SkDebugf(err.c_str());
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-10-03 17:32:33 +00:00
|
|
|
tiledRenderer->setTileHeightPercentage(atof(heightString));
|
|
|
|
if (!(tiledRenderer->getTileHeightPercentage() > 0)) {
|
|
|
|
tiledRenderer->unref();
|
2012-11-07 18:01:46 +00:00
|
|
|
SkDebugf("--mode %s must be given a height percentage > 0\n", mode);
|
2012-10-03 17:32:33 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tiledRenderer->setTileHeight(atoi(heightString));
|
|
|
|
if (!(tiledRenderer->getTileHeight() > 0)) {
|
|
|
|
tiledRenderer->unref();
|
2012-11-07 18:01:46 +00:00
|
|
|
SkDebugf("--mode %s must be given a height > 0\n", mode);
|
2012-10-03 17:32:33 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (numThreads > 1) {
|
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
if (sk_tools::PictureRenderer::kGPU_DeviceType == deviceType) {
|
|
|
|
tiledRenderer->unref();
|
|
|
|
SkDebugf("GPU not compatible with multithreaded tiling.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
renderer = tiledRenderer;
|
2012-11-02 21:28:12 +00:00
|
|
|
if (usePipe) {
|
|
|
|
SkDebugf("Pipe rendering is currently not compatible with tiling.\n"
|
|
|
|
"Turning off pipe.\n");
|
|
|
|
}
|
2012-10-03 17:32:33 +00:00
|
|
|
} else if (usePipe) {
|
2012-11-02 21:28:12 +00:00
|
|
|
if (renderer != NULL) {
|
|
|
|
renderer->unref();
|
|
|
|
SkDebugf("Pipe is incompatible with other modes.\n");
|
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-10-03 17:32:33 +00:00
|
|
|
renderer = SkNEW(sk_tools::PipePictureRenderer);
|
|
|
|
}
|
|
|
|
|
2012-10-26 13:26:55 +00:00
|
|
|
if (inputs->empty()) {
|
2012-11-02 21:28:12 +00:00
|
|
|
SkSafeUnref(renderer);
|
2012-10-26 13:26:55 +00:00
|
|
|
if (NULL != outputDir) {
|
|
|
|
SkDELETE(outputDir);
|
|
|
|
}
|
2012-07-20 22:34:27 +00:00
|
|
|
usage(argv0);
|
|
|
|
exit(-1);
|
|
|
|
}
|
2012-07-26 17:27:57 +00:00
|
|
|
|
|
|
|
if (NULL == renderer) {
|
|
|
|
renderer = SkNEW(sk_tools::SimplePictureRenderer);
|
|
|
|
}
|
2012-08-20 15:03:29 +00:00
|
|
|
|
2012-12-18 22:24:03 +00:00
|
|
|
renderer->setBBoxHierarchyType(bbhType);
|
|
|
|
renderer->setGridSize(gridWidth, gridHeight);
|
2012-12-13 21:40:48 +00:00
|
|
|
renderer->setViewport(viewport);
|
2012-12-17 19:25:54 +00:00
|
|
|
renderer->setScaleFactor(scaleFactor);
|
2012-08-20 15:04:04 +00:00
|
|
|
renderer->setDeviceType(deviceType);
|
2012-07-13 18:22:59 +00:00
|
|
|
}
|
2012-06-12 14:56:36 +00:00
|
|
|
|
2012-10-02 18:33:14 +00:00
|
|
|
int tool_main(int argc, char** argv);
|
|
|
|
int tool_main(int argc, char** argv) {
|
2012-09-17 18:26:06 +00:00
|
|
|
SkAutoGraphics ag;
|
2012-07-13 18:22:59 +00:00
|
|
|
SkTArray<SkString> inputs;
|
2012-07-26 17:27:57 +00:00
|
|
|
sk_tools::PictureRenderer* renderer = NULL;
|
2012-10-26 13:26:55 +00:00
|
|
|
SkString* outputDir = NULL;
|
2012-12-18 22:24:03 +00:00
|
|
|
bool validate = false;
|
2013-01-16 18:18:48 +00:00
|
|
|
int maxComponentDiff = 256;
|
2012-12-18 22:24:03 +00:00
|
|
|
bool writeWholeImage = false;
|
|
|
|
int clones = 0;
|
|
|
|
parse_commandline(argc, argv, &inputs, renderer, outputDir,
|
2013-01-16 18:18:48 +00:00
|
|
|
&validate, &maxComponentDiff, &writeWholeImage, &clones);
|
2012-07-26 17:27:57 +00:00
|
|
|
SkASSERT(renderer);
|
2012-06-12 14:56:36 +00:00
|
|
|
|
2012-09-17 18:26:06 +00:00
|
|
|
int failures = 0;
|
2012-10-26 13:26:55 +00:00
|
|
|
for (int i = 0; i < inputs.count(); i ++) {
|
2012-12-18 22:24:03 +00:00
|
|
|
failures += process_input(inputs[i], outputDir, *renderer,
|
2013-01-16 18:18:48 +00:00
|
|
|
validate, maxComponentDiff,
|
|
|
|
writeWholeImage, clones);
|
2012-09-17 18:26:06 +00:00
|
|
|
}
|
|
|
|
if (failures != 0) {
|
|
|
|
SkDebugf("Failed to render %i pictures.\n", failures);
|
|
|
|
return 1;
|
2012-06-12 14:56:36 +00:00
|
|
|
}
|
2012-09-13 15:40:37 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
#if GR_CACHE_STATS
|
|
|
|
if (renderer->isUsingGpuDevice()) {
|
|
|
|
GrContext* ctx = renderer->getGrContext();
|
|
|
|
|
|
|
|
ctx->printCacheStats();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
2012-10-26 13:26:55 +00:00
|
|
|
if (NULL != outputDir) {
|
|
|
|
SkDELETE(outputDir);
|
|
|
|
}
|
2012-07-26 17:27:57 +00:00
|
|
|
SkDELETE(renderer);
|
2012-10-02 20:00:03 +00:00
|
|
|
return 0;
|
2012-06-12 14:56:36 +00:00
|
|
|
}
|
2012-10-02 18:33:14 +00:00
|
|
|
|
|
|
|
#if !defined SK_BUILD_FOR_IOS
|
|
|
|
int main(int argc, char * const argv[]) {
|
|
|
|
return tool_main(argc, (char**) argv);
|
|
|
|
}
|
|
|
|
#endif
|