Revert of Update SkPicture cull rects with RTree information (patchset #6 id:140001 of https://codereview.chromium.org/971803002/)

Reason for revert:
Might be breaking deps roll

Original issue's description:
> 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=
>
> Committed: https://skia.googlesource.com/skia/+/2dd3b6647dc726f36fd8774b3d0d2e83b493aeac

TBR=mtklein@google.com,schenney@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/977413003
This commit is contained in:
joshualitt 2015-03-05 12:18:38 -08:00 committed by Commit bot
parent c1e97b372e
commit a0865b4620
7 changed files with 5 additions and 31 deletions

View File

@ -34,9 +34,6 @@ public:
virtual size_t bytesUsed() const = 0;
// Get the root bound.
virtual SkRect getRootBound() const = 0;
SK_DECLARE_INST_COUNT(SkBBoxHierarchy)
private:
typedef SkRefCnt INHERITED;

View File

@ -60,10 +60,6 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() {
} else {
SkRecordFillBounds(fCullRect, *fRecord, fBBH.get());
}
SkRect bbhBound = fBBH->getRootBound();
SkASSERT((bbhBound.isEmpty() || fCullRect.contains(bbhBound))
|| (bbhBound.isEmpty() && fCullRect.isEmpty()));
fCullRect = bbhBound;
}
SkPicture* pict = SkNEW_ARGS(SkPicture, (fCullRect, fRecord, pictList, fBBH));

View File

@ -9,14 +9,6 @@
SkRTree::SkRTree(SkScalar aspectRatio) : fCount(0), fAspectRatio(aspectRatio) {}
SkRect SkRTree::getRootBound() const {
if (fCount) {
return fRoot.fBounds;
} else {
return SkRect::MakeEmpty();
}
}
void SkRTree::insert(const SkRect boundsArray[], int N) {
SkASSERT(0 == fCount);

View File

@ -52,9 +52,6 @@ public:
// Insertion count (not overall node count, which may be greater).
int getCount() const { return fCount; }
// Get the root bound.
SkRect getRootBound() const SK_OVERRIDE;
// These values were empirically determined to produce reasonable performance in most cases.
static const int kMinChildren = 6,
kMaxChildren = 11;

View File

@ -387,12 +387,8 @@ private:
Bounds bounds(const DrawPaint&) const { return fCurrentClipBounds; }
Bounds bounds(const NoOp&) const { return Bounds::MakeEmpty(); } // NoOps don't draw.
Bounds bounds(const DrawSprite& op) const { // Ignores the matrix, but respects the clip.
SkRect rect = Bounds::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bitmap.height());
if (!rect.intersect(fCurrentClipBounds)) {
return Bounds::MakeEmpty();
}
return rect;
Bounds bounds(const DrawSprite& op) const { // Ignores the matrix.
return Bounds::MakeXYWH(op.left, op.top, op.bitmap.width(), op.bitmap.height());
}
Bounds bounds(const DrawRect& op) const { return this->adjustAndMap(op.rect, &op.paint); }

View File

@ -1248,9 +1248,8 @@ DEF_TEST(DontOptimizeSaveLayerDrawDrawRestore, reporter) {
struct CountingBBH : public SkBBoxHierarchy {
mutable int searchCalls;
SkRect rootBound;
CountingBBH(const SkRect& bound) : searchCalls(0), rootBound(bound) {}
CountingBBH() : searchCalls(0) {}
void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE {
this->searchCalls++;
@ -1258,7 +1257,6 @@ 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 {
@ -1273,12 +1271,11 @@ private:
// When the canvas clip covers the full picture, we don't need to call the BBH.
DEF_TEST(Picture_SkipBBH, r) {
SkRect bound = SkRect::MakeWH(320, 240);
CountingBBH bbh(bound);
CountingBBH bbh;
SpoonFedBBHFactory factory(&bbh);
SkPictureRecorder recorder;
recorder.beginRecording(bound, &factory);
recorder.beginRecording(320, 240, &factory);
SkAutoTUnref<const SkPicture> picture(recorder.endRecording());
SkCanvas big(640, 480), small(300, 200);

View File

@ -133,7 +133,6 @@ 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;