diff options
author | 2014-10-09 18:22:41 -0700 | |
---|---|---|
committer | 2014-10-09 18:22:41 -0700 | |
commit | 092dab98220110e7244ccbbb851efa8ad621ab88 (patch) | |
tree | 108d88a67b2a08327444f0573382f7f7ac4ad005 /src/core/SkTileGrid.h | |
parent | 232f6b0f90a02bcdac0c5931d5f9cfd08003b10c (diff) |
Use BBH reserve hook to preallocate space for tiles.
Before getting too far into changing how SkTileGrid stores its tiles, I figured I'd
better see how much I can tweak out the existing format. Cleverly, that way
any improvements I make by changing the format will look that much less
impressive.
This CL looks like it will be a 5-15% win in time spent recording, with no effect
on playback.
This CL also shrinks the tiles to fit exactly when we're done inserting,
using newly added SkTDArray::shrinkToFit(). It's quite cheap to run (maybe
taking back 1-2% from those 5-15% wins), and means we'll lug around about 15%
fewer bytes in the tile grids. Note though this strategy temporarily uses up to
30% more memory while building the tile grid. For our largest SKPs, that's
maybe 75-100K extra.
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/52455cbc02d7f480d988ae7cdacc11ad69078c2c
CQ_EXTRA_TRYBOTS=tryserver.skia:Canary-Chrome-Ubuntu13.10-Ninja-x86_64-ToT-Trybot
Review URL: https://codereview.chromium.org/639823005
Diffstat (limited to 'src/core/SkTileGrid.h')
-rw-r--r-- | src/core/SkTileGrid.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/SkTileGrid.h b/src/core/SkTileGrid.h index e8a0d96a65..fd7584fd9c 100644 --- a/src/core/SkTileGrid.h +++ b/src/core/SkTileGrid.h @@ -39,6 +39,9 @@ public: // For testing. int tileCount(int x, int y) { return fTiles[y * fXTiles + x].count(); } + virtual void reserve(unsigned opCount) SK_OVERRIDE; + virtual void flushDeferredInserts() SK_OVERRIDE; + private: void commonAdjust(SkRect*) const; void userToGrid(const SkRect&, SkIRect* grid) const; |