aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/gradients
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2014-07-25 11:52:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-25 11:52:48 -0700
commitd6aeb6dc8fe21066f1a2c4813a4256a3acd3edf5 (patch)
tree9f2eb3a4e8ece352a5d2ad05a78b3ad1ad1cbb03 /src/effects/gradients
parent6c18c80c866dc1d89f0a76c93d62bbff886e3c2b (diff)
Fix thread unsafe mutex initialization.
BUG=skia:2779 R=robertphillips@google.com, mtklein@google.com, reed@android.com, bsalomon@google.com Author: bungeman@google.com Review URL: https://codereview.chromium.org/419113002
Diffstat (limited to 'src/effects/gradients')
-rw-r--r--src/effects/gradients/SkGradientShader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 5014c35ee0..48904fa8fd 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -570,6 +570,7 @@ SkGradientShaderBase::GradientShaderCache* SkGradientShaderBase::refCache(U8CPU
return fCache;
}
+SK_DECLARE_STATIC_MUTEX(gGradientCacheMutex);
/*
* Because our caller might rebuild the same (logically the same) gradient
* over and over, we'd like to return exactly the same "bitmap" if possible,
@@ -605,11 +606,10 @@ void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap) const {
///////////////////////////////////
- SK_DECLARE_STATIC_MUTEX(gMutex);
static SkBitmapCache* gCache;
// each cache cost 1K of RAM, since each bitmap will be 1x256 at 32bpp
static const int MAX_NUM_CACHED_GRADIENT_BITMAPS = 32;
- SkAutoMutexAcquire ama(gMutex);
+ SkAutoMutexAcquire ama(gGradientCacheMutex);
if (NULL == gCache) {
gCache = SkNEW_ARGS(SkBitmapCache, (MAX_NUM_CACHED_GRADIENT_BITMAPS));