OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPaint.h" | 8 #include "SkPaint.h" |
9 #include "SkAnnotation.h" | 9 #include "SkAnnotation.h" |
10 #include "SkAutoKern.h" | 10 #include "SkAutoKern.h" |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 static SkMaskGamma* gLinearMaskGamma = NULL; | 1730 static SkMaskGamma* gLinearMaskGamma = NULL; |
1731 static SkMaskGamma* gMaskGamma = NULL; | 1731 static SkMaskGamma* gMaskGamma = NULL; |
1732 static SkScalar gContrast = SK_ScalarMin; | 1732 static SkScalar gContrast = SK_ScalarMin; |
1733 static SkScalar gPaintGamma = SK_ScalarMin; | 1733 static SkScalar gPaintGamma = SK_ScalarMin; |
1734 static SkScalar gDeviceGamma = SK_ScalarMin; | 1734 static SkScalar gDeviceGamma = SK_ScalarMin; |
1735 /** | 1735 /** |
1736 * The caller must hold the gMaskGammaCacheMutex and continue to hold it until | 1736 * The caller must hold the gMaskGammaCacheMutex and continue to hold it until |
1737 * the returned SkMaskGamma pointer is refed or forgotten. | 1737 * the returned SkMaskGamma pointer is refed or forgotten. |
1738 */ | 1738 */ |
1739 static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
, SkScalar deviceGamma) { | 1739 static const SkMaskGamma& cachedMaskGamma(SkScalar contrast, SkScalar paintGamma
, SkScalar deviceGamma) { |
| 1740 gMaskGammaCacheMutex.assertHeld(); |
1740 if (0 == contrast && SK_Scalar1 == paintGamma && SK_Scalar1 == deviceGamma)
{ | 1741 if (0 == contrast && SK_Scalar1 == paintGamma && SK_Scalar1 == deviceGamma)
{ |
1741 if (NULL == gLinearMaskGamma) { | 1742 if (NULL == gLinearMaskGamma) { |
1742 gLinearMaskGamma = SkNEW(SkMaskGamma); | 1743 gLinearMaskGamma = SkNEW(SkMaskGamma); |
1743 } | 1744 } |
1744 return *gLinearMaskGamma; | 1745 return *gLinearMaskGamma; |
1745 } | 1746 } |
1746 if (gContrast != contrast || gPaintGamma != paintGamma || gDeviceGamma != de
viceGamma) { | 1747 if (gContrast != contrast || gPaintGamma != paintGamma || gDeviceGamma != de
viceGamma) { |
1747 SkSafeUnref(gMaskGamma); | 1748 SkSafeUnref(gMaskGamma); |
1748 gMaskGamma = SkNEW_ARGS(SkMaskGamma, (contrast, paintGamma, deviceGamma)
); | 1749 gMaskGamma = SkNEW_ARGS(SkMaskGamma, (contrast, paintGamma, deviceGamma)
); |
1749 gContrast = contrast; | 1750 gContrast = contrast; |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 } | 2730 } |
2730 #ifdef SK_BUILD_FOR_ANDROID | 2731 #ifdef SK_BUILD_FOR_ANDROID |
2731 if (dirty & kPaintOptionsAndroid_DirtyBit) { | 2732 if (dirty & kPaintOptionsAndroid_DirtyBit) { |
2732 SkPaintOptionsAndroid options; | 2733 SkPaintOptionsAndroid options; |
2733 options.unflatten(buffer); | 2734 options.unflatten(buffer); |
2734 paint->setPaintOptionsAndroid(options); | 2735 paint->setPaintOptionsAndroid(options); |
2735 } | 2736 } |
2736 #endif | 2737 #endif |
2737 SkASSERT(dirty == paint->fDirtyBits); | 2738 SkASSERT(dirty == paint->fDirtyBits); |
2738 } | 2739 } |
OLD | NEW |