Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: include/core/SkBitmap.h

Issue 18029021: add bitmap::eraseArea (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkBitmap.h
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 86e267ccdd99004333072570291c126d00c30236..887169ccb522c2820c8c2f0ff3f78e454d0d00cf 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,
« no previous file with comments | « no previous file | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698