aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/bench_record.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-16 16:02:10 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-16 16:02:10 +0000
commitd393b17cf3427bd6f6255f8670067d9aa529e409 (patch)
tree3c534a8644f344121e6e56b3322ea7ebcf62d51c /tools/bench_record.cpp
parent4453e8b45aaaaea568da35f8144177bdc8d2e171 (diff)
Retract SkPicture::kOptimizeForClippedPlayback_RecordingFlag from public API
This CL sets the stage for retracting the SkPicture::kOptimizeForClippedPlayback_RecordingFlag flag from the public API (more work needs to be done in Blink & Chrome). In the new world the only way to set this flag (and thus instantiate an SkPicture-derived class) is by passing a factory to the SkPictureRecorder class. This is to get all clients always using factories so that we can then change the factory call used (i.e., so the factory just creates a BBH) and do away with the SkPicture-derived classes. BUG=skia:2315 R=reed@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/239703006 git-svn-id: http://skia.googlecode.com/svn/trunk@14221 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools/bench_record.cpp')
-rw-r--r--tools/bench_record.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/tools/bench_record.cpp b/tools/bench_record.cpp
index ae91eb119a..0798de21e7 100644
--- a/tools/bench_record.cpp
+++ b/tools/bench_record.cpp
@@ -12,6 +12,7 @@
#include "SkPicture.h"
#include "SkQuadTreePicture.h"
#include "SkRecording.h"
+#include "SkRTreePicture.h"
#include "SkStream.h"
#include "SkString.h"
#include "SkTileGridPicture.h"
@@ -33,19 +34,17 @@ DEFINE_int32(tileGridSize, 512, "Set the tile grid size. Has no effect if bbh is
DEFINE_string(bbh, "", "Turn on the bbh and select the type, one of rtree, tilegrid, quadtree");
DEFINE_bool(skr, false, "Record SKR instead of SKP.");
-typedef SkPictureFactory* (*PictureFactory)(int* recordingFlags);
+typedef SkPictureFactory* (*PictureFactory)();
-static SkPictureFactory* vanilla_factory(int* recordingFlags) {
+static SkPictureFactory* vanilla_factory() {
return NULL;
}
-static SkPictureFactory* rtree_factory(int* recordingFlags) {
- *recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
- return NULL;
+static SkPictureFactory* rtree_factory() {
+ return SkNEW(SkRTreePictureFactory);
}
-static SkPictureFactory* tilegrid_factory(int* recordingFlags) {
- *recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
+static SkPictureFactory* tilegrid_factory() {
SkTileGridPicture::TileGridInfo info;
info.fTileInterval.set(FLAGS_tileGridSize, FLAGS_tileGridSize);
info.fMargin.setEmpty();
@@ -53,8 +52,7 @@ static SkPictureFactory* tilegrid_factory(int* recordingFlags) {
return SkNEW_ARGS(SkTileGridPictureFactory, (info));
}
-static SkPictureFactory* quadtree_factory(int* recordingFlags) {
- *recordingFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
+static SkPictureFactory* quadtree_factory() {
return SkNEW(SkQuadTreePictureFactory);
}
@@ -94,7 +92,7 @@ static void bench_record(SkPicture* src, const char* name, PictureFactory pictur
SkDELETE(SkRecording::Delete(recording)); // delete the SkPlayback*.
} else {
int recordingFlags = FLAGS_flags;
- SkAutoTUnref<SkPictureFactory> factory(pictureFactory(&recordingFlags));
+ SkAutoTUnref<SkPictureFactory> factory(pictureFactory());
SkPictureRecorder recorder(factory);
SkCanvas* canvas = recorder.beginRecording(width, height, recordingFlags);
if (NULL != src) {