diff options
author | Lucas Crowthers <lucasc@codeaurora.org> | 2012-12-03 17:21:30 -0500 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-03-04 15:46:32 -0800 |
commit | 705eb622415dc3db0d1740ff29aa0fbf4e8aafa5 (patch) | |
tree | b2c036b96b9eb54bc9d35aa46e0cbf893afe86f0 /include/core/SkBitmap.h | |
parent | 425325c48d72df437bd734ba0820403204fa79ae (diff) | |
download | external_skia-705eb622415dc3db0d1740ff29aa0fbf4e8aafa5.zip external_skia-705eb622415dc3db0d1740ff29aa0fbf4e8aafa5.tar.gz external_skia-705eb622415dc3db0d1740ff29aa0fbf4e8aafa5.tar.bz2 |
Skia: Introduce caching of unscaled Bitmaps.
This allows skia to choose whether to use the prescaled bitmap or the
unscaled bitmap depending on which would be optimal in the current
situation. This commit also introduces two functions necessary for
properly resizing Rects when using the non-pre-scaled bitmaps.
CRs-fixed: 451681
Change-Id: I36779d8a680a3ced7c28da492e879de02c7e87a5
Diffstat (limited to 'include/core/SkBitmap.h')
-rw-r--r-- | include/core/SkBitmap.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 2d5fc41..e125924 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -551,6 +551,17 @@ public: void flatten(SkFlattenableWriteBuffer&) const; void unflatten(SkFlattenableReadBuffer&); + /** Get the unscaled version of this SkBitmap (may be null; in fact it usually will be) + */ + SkBitmap* unscaledBitmap() const { return fUnscaledBitmap; } + + /** Assign an unscaled bitmap so we can do some transforms with it + * TODO do some basic error-checking (make sure URIs match?) + */ + SkBitmap* setUnscaledBitmap(SkBitmap* unscaledBitmap) { return fUnscaledBitmap = unscaledBitmap; } + + void freeUnscaledBitmap(); + SkDEBUGCODE(void validate() const;) class Allocator : public SkRefCnt { @@ -611,6 +622,11 @@ private: // pixels (e.g. as a gpu texture) mutable int fRawPixelGenerationID; + // Holds shadow copy of this bitmap in cases where it was pre-upscaled, and + // we want to retain the original for possible performance improvements in + // later transformations + mutable SkBitmap* fUnscaledBitmap; + enum Flags { kImageIsOpaque_Flag = 0x01, kImageIsVolatile_Flag = 0x02, |