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

Unified Diff: src/codec/SkBmpRLECodec.cpp

Issue 1689983002: Avoid initializing memory twice on incomplete RLE bmps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkBmpRLECodec.cpp
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index b01012644bfded083a27c95deb41bff5be0f96be..b42d32a42e5d54ee77b2c5dfa674d992694852d7 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -503,8 +503,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));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698