aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkBmpRLECodec.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-02-11 10:35:48 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-11 10:35:48 -0800
commit17315c20e7a87d6e92fdc4623d2e27303037a051 (patch)
treed29c74c43c3bbaf1d2bc8901c5beb68bf2161a4c /src/codec/SkBmpRLECodec.cpp
parentf62a8b786c0e17a3818d0bdc8dbf1c627b063e1b (diff)
Avoid initializing memory twice on incomplete RLE bmps
Diffstat (limited to 'src/codec/SkBmpRLECodec.cpp')
-rw-r--r--src/codec/SkBmpRLECodec.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index 57707d60c9..05691cc079 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -520,8 +520,13 @@ private:
SkBmpRLECodec* fCodec;
};
-SkSampler* SkBmpRLECodec::getSampler(bool createIfNecessary) {
- if (!fSampler && createIfNecessary) {
+SkSampler* SkBmpRLECodec::getSampler(bool /*createIfNecessary*/) {
+ // We will always create an SkBmpRLESampler if one is requested.
+ // This allows clients to always use the SkBmpRLESampler's
+ // version of fill(), which does nothing since RLE decodes have
+ // already filled pixel memory. This seems fine, since creating
+ // an SkBmpRLESampler is pretty inexpensive.
+ if (!fSampler) {
fSampler.reset(new SkBmpRLESampler(this));
}