aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar schenney <schenney@chromium.org>2015-03-05 07:43:10 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-05 07:43:10 -0800
commit2dd3b6647dc726f36fd8774b3d0d2e83b493aeac (patch)
tree14642943da226d88b521524664d334f726548589 /tests
parentdc812222a7488d2a0e39b4a09c81c9f000d4b869 (diff)
Update SkPicture cull rects with RTree information
When computed, the RTree for an SkPicture will have a root bounds that reflects the best bounding information available, rather than the best estimate at the time the picture recorder is created. Given that creators frequently don't know ahead of time what will be drawn, the RTree bound is often tighter. Perf testing on Chrome indicates a small raster performance advantage. For upcoming painting changes in Chrome the performance advantage is much larger. BUG= Review URL: https://codereview.chromium.org/971803002
Diffstat (limited to 'tests')
-rw-r--r--tests/PictureTest.cpp9
-rw-r--r--tests/RecordDrawTest.cpp1
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 33e058cc2e..ac750e9a85 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1248,8 +1248,9 @@ DEF_TEST(DontOptimizeSaveLayerDrawDrawRestore, reporter) {
struct CountingBBH : public SkBBoxHierarchy {
mutable int searchCalls;
+ SkRect rootBound;
- CountingBBH() : searchCalls(0) {}
+ CountingBBH(const SkRect& bound) : searchCalls(0), rootBound(bound) {}
void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE {
this->searchCalls++;
@@ -1257,6 +1258,7 @@ struct CountingBBH : public SkBBoxHierarchy {
void insert(const SkRect[], int) SK_OVERRIDE {}
virtual size_t bytesUsed() const SK_OVERRIDE { return 0; }
+ SkRect getRootBound() const SK_OVERRIDE { return rootBound; }
};
class SpoonFedBBHFactory : public SkBBHFactory {
@@ -1271,11 +1273,12 @@ private:
// When the canvas clip covers the full picture, we don't need to call the BBH.
DEF_TEST(Picture_SkipBBH, r) {
- CountingBBH bbh;
+ SkRect bound = SkRect::MakeWH(320, 240);
+ CountingBBH bbh(bound);
SpoonFedBBHFactory factory(&bbh);
SkPictureRecorder recorder;
- recorder.beginRecording(320, 240, &factory);
+ recorder.beginRecording(bound, &factory);
SkAutoTUnref<const SkPicture> picture(recorder.endRecording());
SkCanvas big(640, 480), small(300, 200);
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index cf138b8d4e..baee712b37 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -133,6 +133,7 @@ struct TestBBH : public SkBBoxHierarchy {
void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE {}
size_t bytesUsed() const SK_OVERRIDE { return 0; }
+ SkRect getRootBound() const SK_OVERRIDE { return SkRect::MakeEmpty(); }
struct Entry {
unsigned opIndex;