SkPicture::cullRect is a virtual method called from DrawingDisplayItem::Raster:
https://cs.chromium.org/chromium/src/cc/playback/drawing_display_item.cc?q=DrawingDisplayItem::Raster&sq=package:chromium&l=82&dr=CSs
Its implementations are actually trivial, and can be potentially turned into a short switch statement:
SkRect SkBigPicture::cullRect() const override { return fCullRect; }
SkRect SkEmptyPicture::cullRect() const override { return SkRect::MakeEmpty(); }
SkRect SkMiniPicture::cullRect() const override { return fCull; }
This can be turned into something like (pseudo-code):
switch(typeof(picture_)) {
case SkBigPicture: static_cast<SkBigPicture*>(picture_)->fCullRect;
case SkEmptyPicture: SkRect::MakeEmpty();
case SkMiniPicture: static_cast<SkMiniPicture*>(picture_)->fCull;
}
This looks like something that can be done automatically (and be worth it), but we need to find more places before we can justify spending time on implementing such optimization.
Comment 1 by krasin@chromium.org
, Aug 16 2016