diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPixmap.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp index 9bc0e23386..5a6b27d8d7 100644 --- a/src/core/SkPixmap.cpp +++ b/src/core/SkPixmap.cpp @@ -116,6 +116,14 @@ bool SkPixmap::erase(SkColor color, const SkIRect& inArea) const { const int width = area.width(); const int rowBytes = this->rowBytes(); + if (color == 0 + && width == this->rowBytesAsPixels() + && inArea == this->bounds()) { + // All formats represent SkColor(0) as byte 0. + memset(this->writable_addr(), 0, height * rowBytes); + return true; + } + switch (this->colorType()) { case kGray_8_SkColorType: { if (255 != a) { |