diff options
author | 2013-06-28 19:40:50 +0000 | |
---|---|---|
committer | 2013-06-28 19:40:50 +0000 | |
commit | 60d3235ab42bd1d32a070695ee30d6e3ec2fa222 (patch) | |
tree | 277c080c15a56aa5c429c15eb67f4cc9f51af397 /include/core | |
parent | 0a208a117b2d7f2c2231aa357f1db4864dbdcba3 (diff) |
add bitmap::eraseArea
BUG=
R=scroggo@google.com
Review URL: https://codereview.chromium.org/18029021
git-svn-id: http://skia.googlecode.com/svn/trunk@9815 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkBitmap.h | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index 86e267ccdd..887169ccb5 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -386,28 +386,38 @@ public: */ void notifyPixelsChanged() const; - /** Initialize the bitmap's pixels with the specified color+alpha, automatically converting into the correct format - for the bitmap's config. If the config is kRGB_565_Config, then the alpha value is ignored. - If the config is kA8_Config, then the r,g,b parameters are ignored. - */ - void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const; - /** Initialize the bitmap's pixels with the specified color+alpha, automatically converting into the correct format - for the bitmap's config. If the config is kRGB_565_Config, then the alpha value is presumed - to be 0xFF. If the config is kA8_Config, then the r,g,b parameters are ignored and the - pixels are all set to 0xFF. - */ - void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const { - this->eraseARGB(0xFF, r, g, b); - } - /** Initialize the bitmap's pixels with the specified color, automatically converting into the correct format - for the bitmap's config. If the config is kRGB_565_Config, then the color's alpha value is presumed - to be 0xFF. If the config is kA8_Config, then only the color's alpha value is used. - */ + /** + * Fill the entire bitmap with the specified color. + * If the bitmap's config does not support alpha (e.g. 565) then the alpha + * of the color is ignored (treated as opaque). If the config only supports + * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. + */ void eraseColor(SkColor c) const { this->eraseARGB(SkColorGetA(c), SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); } + /** + * Fill the entire bitmap with the specified color. + * If the bitmap's config does not support alpha (e.g. 565) then the alpha + * of the color is ignored (treated as opaque). If the config only supports + * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. + */ + void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const; + + // DEPRECATED -- call eraseColor or eraseARGB + void eraseRGB(U8CPU r, U8CPU g, U8CPU b) const { + this->eraseARGB(0xFF, r, g, b); + } + + /** + * Fill the specified area of this bitmap with the specified color. + * If the bitmap's config does not support alpha (e.g. 565) then the alpha + * of the color is ignored (treated as opaque). If the config only supports + * alpha (e.g. A1 or A8) then the color's r,g,b components are ignored. + */ + void eraseArea(const SkIRect& area, SkColor c) const; + /** Scroll (a subset of) the contents of this bitmap by dx/dy. If there are no pixels allocated (i.e. getPixels() returns null) the method will still update the inval region (if present). If the bitmap is immutable, @@ -665,6 +675,8 @@ private: uint8_t fFlags; uint8_t fBytesPerPixel; // based on config + void internalErase(const SkIRect&, U8CPU a, U8CPU r, U8CPU g, U8CPU b)const; + /* Internal computations for safe size. */ static Sk64 ComputeSafeSize64(Config config, |