diff options
author | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 09:51:20 +0000 |
---|---|---|
committer | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 09:51:20 +0000 |
commit | c97dfc681180e48f4408c8121293cd4ea64bc41c (patch) | |
tree | 8d4bf609decb3f6d015cc535ae6dc69117a6ea47 /cc/picture_pile_impl.cc | |
parent | c17ca9d20bd6d8ba21e7b13fa0e2634c9951f268 (diff) | |
download | chromium_src-c97dfc681180e48f4408c8121293cd4ea64bc41c.zip chromium_src-c97dfc681180e48f4408c8121293cd4ea64bc41c.tar.gz chromium_src-c97dfc681180e48f4408c8121293cd4ea64bc41c.tar.bz2 |
Make PicturePile pile.
This follows a similar policy as Android browser:
- If an invalidate only intersects the base plus at most one non-base SkPicture, then it creates a new SkPicture of that size.
- If an invalidate intersects two or more non-base SkPictures, then a new SkPicture is created at the top of the pile, sized to the union of the invalidate plus the bounds of all the intersecting pictures.
- Whenever new picture's area fully contains an existing picture, that old picture is destroyed.
- If an SkPicture's area would be >70% of the base, the pile is
destroyed and the base SkPicture is recreated.
During the invalidate pass, invalidated pictures are represented as
Pictures with a size but no recording. Then all the blank pictures
are filled in at the end of the Update().
BUG=163429
Review URL: https://chromiumcodereview.appspot.com/11299324
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170917 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/picture_pile_impl.cc')
-rw-r--r-- | cc/picture_pile_impl.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cc/picture_pile_impl.cc b/cc/picture_pile_impl.cc index 2f89828..216643b 100644 --- a/cc/picture_pile_impl.cc +++ b/cc/picture_pile_impl.cc @@ -23,9 +23,9 @@ PicturePileImpl::~PicturePileImpl() { scoped_refptr<PicturePileImpl> PicturePileImpl::CloneForDrawing() const { TRACE_EVENT0("cc", "PicturePileImpl::CloneForDrawing"); scoped_refptr<PicturePileImpl> clone = Create(); - clone->pile_.resize(pile_.size()); - for (size_t i = 0; i < pile_.size(); ++i) - clone->pile_[i] = pile_[i]->Clone(); + for (PicturePile::Pile::const_iterator i = pile_.begin(); + i != pile_.end(); ++i) + clone->pile_.push_back((*i)->Clone()); return clone; } @@ -40,10 +40,11 @@ void PicturePileImpl::Raster(SkCanvas* canvas, gfx::Rect rect, SkRect layer_skrect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()); canvas->clipRect(layer_skrect); - for (size_t i = 0; i < pile_.size(); ++i) { - if (!pile_[i]->LayerRect().Intersects(rect)) + for (PicturePile::Pile::const_iterator i = pile_.begin(); + i != pile_.end(); ++i) { + if (!(*i)->LayerRect().Intersects(rect)) continue; - pile_[i]->Raster(canvas); + (*i)->Raster(canvas); SkISize deviceSize = canvas->getDeviceSize(); stats->totalPixelsRasterized += deviceSize.width() * deviceSize.height(); |