OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 "SkPaintPriv.h" | 8 #include "SkPaintPriv.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return true; | 72 return true; |
73 default: | 73 default: |
74 break; | 74 break; |
75 } | 75 } |
76 } | 76 } |
77 return false; | 77 return false; |
78 } | 78 } |
79 | 79 |
80 bool NeedsDeepCopy(const SkPaint& paint) { | 80 bool NeedsDeepCopy(const SkPaint& paint) { |
81 /* | 81 /* |
82 * These fields are known to be immutable, and so can be shallow-copied | 82 * The types below are not yet immutable/reentrant-safe, and so we return |
| 83 * true if instances of them are present in the paint. |
83 * | 84 * |
84 * getTypeface() | 85 * Eventually we hope this list will be empty, and we can always return |
85 * getAnnotation() | 86 * false. |
86 * paint.getColorFilter() | |
87 * getXfermode() | |
88 * getPathEffect() | |
89 * getMaskFilter() | |
90 */ | 87 */ |
91 | 88 return false |
92 return paint.getShader() || | 89 #ifdef SK_SUPPORT_LEGACY_SHADER_LOCALMATRIX |
| 90 || paint.getShader() |
| 91 #endif |
93 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API | 92 #ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API |
94 paint.getRasterizer() || | 93 || paint.getRasterizer() |
95 #endif | 94 #endif |
96 paint.getLooper() || // needs to hide its addLayer... | 95 || paint.getImageFilter() |
97 paint.getImageFilter(); | 96 ; |
98 } | 97 } |
OLD | NEW |