Temp fix for crash when generating 16-bit cache for colorTables.
authordjsollen <djsollen@google.com>
Mon, 29 Sep 2014 15:57:49 +0000 (08:57 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 29 Sep 2014 15:57:50 +0000 (08:57 -0700)
BUG=skia:2795
R=reed@google.com

Author: djsollen@google.com

Review URL: https://codereview.chromium.org/617443002

src/core/SkColorTable.cpp

index 4d0a795..2607f9a 100644 (file)
@@ -73,7 +73,10 @@ static inline void build_16bitcache(uint16_t dst[], const SkPMColor src[],
 }
 
 const uint16_t* SkColorTable::lock16BitCache() {
-    if (this->isOpaque() && NULL == f16BitCache) {
+    // Assert that we're opaque, since our 16-bit cache will be sort of useless
+    // if there is alpha (which we're throwing away)
+    SkASSERT(this->isOpaque());
+    if (NULL == f16BitCache) {
         f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t));
         build_16bitcache(f16BitCache, fColors, fCount);
     }