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" | |
10 #include "SkAutoKern.h" | 9 #include "SkAutoKern.h" |
11 #include "SkChecksum.h" | 10 #include "SkChecksum.h" |
12 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
13 #include "SkData.h" | 12 #include "SkData.h" |
14 #include "SkDraw.h" | 13 #include "SkDraw.h" |
15 #include "SkFontDescriptor.h" | 14 #include "SkFontDescriptor.h" |
16 #include "SkGlyphCache.h" | 15 #include "SkGlyphCache.h" |
17 #include "SkImageFilter.h" | 16 #include "SkImageFilter.h" |
18 #include "SkMaskFilter.h" | 17 #include "SkMaskFilter.h" |
19 #include "SkMaskGamma.h" | 18 #include "SkMaskGamma.h" |
(...skipping 27 matching lines...) Expand all Loading... |
47 SkPaint::SkPaint() { | 46 SkPaint::SkPaint() { |
48 fTypeface = nullptr; | 47 fTypeface = nullptr; |
49 fPathEffect = nullptr; | 48 fPathEffect = nullptr; |
50 fShader = nullptr; | 49 fShader = nullptr; |
51 fXfermode = nullptr; | 50 fXfermode = nullptr; |
52 fMaskFilter = nullptr; | 51 fMaskFilter = nullptr; |
53 fColorFilter = nullptr; | 52 fColorFilter = nullptr; |
54 fRasterizer = nullptr; | 53 fRasterizer = nullptr; |
55 fLooper = nullptr; | 54 fLooper = nullptr; |
56 fImageFilter = nullptr; | 55 fImageFilter = nullptr; |
57 fAnnotation = nullptr; | |
58 | 56 |
59 fTextSize = SkPaintDefaults_TextSize; | 57 fTextSize = SkPaintDefaults_TextSize; |
60 fTextScaleX = SK_Scalar1; | 58 fTextScaleX = SK_Scalar1; |
61 fTextSkewX = 0; | 59 fTextSkewX = 0; |
62 fColor = SK_ColorBLACK; | 60 fColor = SK_ColorBLACK; |
63 fWidth = 0; | 61 fWidth = 0; |
64 fMiterLimit = SkPaintDefaults_MiterLimit; | 62 fMiterLimit = SkPaintDefaults_MiterLimit; |
65 | 63 |
66 // Zero all bitfields, then set some non-zero defaults. | 64 // Zero all bitfields, then set some non-zero defaults. |
67 fBitfieldsUInt = 0; | 65 fBitfieldsUInt = 0; |
(...skipping 12 matching lines...) Expand all Loading... |
80 | 78 |
81 REF_COPY(fTypeface); | 79 REF_COPY(fTypeface); |
82 REF_COPY(fPathEffect); | 80 REF_COPY(fPathEffect); |
83 REF_COPY(fShader); | 81 REF_COPY(fShader); |
84 REF_COPY(fXfermode); | 82 REF_COPY(fXfermode); |
85 REF_COPY(fMaskFilter); | 83 REF_COPY(fMaskFilter); |
86 REF_COPY(fColorFilter); | 84 REF_COPY(fColorFilter); |
87 REF_COPY(fRasterizer); | 85 REF_COPY(fRasterizer); |
88 REF_COPY(fLooper); | 86 REF_COPY(fLooper); |
89 REF_COPY(fImageFilter); | 87 REF_COPY(fImageFilter); |
90 REF_COPY(fAnnotation); | |
91 | 88 |
92 COPY(fTextSize); | 89 COPY(fTextSize); |
93 COPY(fTextScaleX); | 90 COPY(fTextScaleX); |
94 COPY(fTextSkewX); | 91 COPY(fTextSkewX); |
95 COPY(fColor); | 92 COPY(fColor); |
96 COPY(fWidth); | 93 COPY(fWidth); |
97 COPY(fMiterLimit); | 94 COPY(fMiterLimit); |
98 COPY(fBitfields); | 95 COPY(fBitfields); |
99 | 96 |
100 #undef COPY | 97 #undef COPY |
101 #undef REF_COPY | 98 #undef REF_COPY |
102 } | 99 } |
103 | 100 |
104 SkPaint::SkPaint(SkPaint&& src) { | 101 SkPaint::SkPaint(SkPaint&& src) { |
105 #define MOVE(field) field = std::move(src.field) | 102 #define MOVE(field) field = std::move(src.field) |
106 #define REF_MOVE(field) field = src.field; src.field = nullptr | 103 #define REF_MOVE(field) field = src.field; src.field = nullptr |
107 | 104 |
108 REF_MOVE(fTypeface); | 105 REF_MOVE(fTypeface); |
109 REF_MOVE(fPathEffect); | 106 REF_MOVE(fPathEffect); |
110 REF_MOVE(fShader); | 107 REF_MOVE(fShader); |
111 REF_MOVE(fXfermode); | 108 REF_MOVE(fXfermode); |
112 REF_MOVE(fMaskFilter); | 109 REF_MOVE(fMaskFilter); |
113 REF_MOVE(fColorFilter); | 110 REF_MOVE(fColorFilter); |
114 REF_MOVE(fRasterizer); | 111 REF_MOVE(fRasterizer); |
115 REF_MOVE(fLooper); | 112 REF_MOVE(fLooper); |
116 REF_MOVE(fImageFilter); | 113 REF_MOVE(fImageFilter); |
117 REF_MOVE(fAnnotation); | |
118 | 114 |
119 MOVE(fTextSize); | 115 MOVE(fTextSize); |
120 MOVE(fTextScaleX); | 116 MOVE(fTextScaleX); |
121 MOVE(fTextSkewX); | 117 MOVE(fTextSkewX); |
122 MOVE(fColor); | 118 MOVE(fColor); |
123 MOVE(fWidth); | 119 MOVE(fWidth); |
124 MOVE(fMiterLimit); | 120 MOVE(fMiterLimit); |
125 MOVE(fBitfields); | 121 MOVE(fBitfields); |
126 | 122 |
127 #undef MOVE | 123 #undef MOVE |
128 #undef REF_MOVE | 124 #undef REF_MOVE |
129 } | 125 } |
130 | 126 |
131 SkPaint::~SkPaint() { | 127 SkPaint::~SkPaint() { |
132 SkSafeUnref(fTypeface); | 128 SkSafeUnref(fTypeface); |
133 SkSafeUnref(fPathEffect); | 129 SkSafeUnref(fPathEffect); |
134 SkSafeUnref(fShader); | 130 SkSafeUnref(fShader); |
135 SkSafeUnref(fXfermode); | 131 SkSafeUnref(fXfermode); |
136 SkSafeUnref(fMaskFilter); | 132 SkSafeUnref(fMaskFilter); |
137 SkSafeUnref(fColorFilter); | 133 SkSafeUnref(fColorFilter); |
138 SkSafeUnref(fRasterizer); | 134 SkSafeUnref(fRasterizer); |
139 SkSafeUnref(fLooper); | 135 SkSafeUnref(fLooper); |
140 SkSafeUnref(fImageFilter); | 136 SkSafeUnref(fImageFilter); |
141 SkSafeUnref(fAnnotation); | |
142 } | 137 } |
143 | 138 |
144 SkPaint& SkPaint::operator=(const SkPaint& src) { | 139 SkPaint& SkPaint::operator=(const SkPaint& src) { |
145 if (this == &src) { | 140 if (this == &src) { |
146 return *this; | 141 return *this; |
147 } | 142 } |
148 | 143 |
149 #define COPY(field) field = src.field | 144 #define COPY(field) field = src.field |
150 #define REF_COPY(field) SkSafeUnref(field); field = SkSafeRef(src.field) | 145 #define REF_COPY(field) SkSafeUnref(field); field = SkSafeRef(src.field) |
151 | 146 |
152 REF_COPY(fTypeface); | 147 REF_COPY(fTypeface); |
153 REF_COPY(fPathEffect); | 148 REF_COPY(fPathEffect); |
154 REF_COPY(fShader); | 149 REF_COPY(fShader); |
155 REF_COPY(fXfermode); | 150 REF_COPY(fXfermode); |
156 REF_COPY(fMaskFilter); | 151 REF_COPY(fMaskFilter); |
157 REF_COPY(fColorFilter); | 152 REF_COPY(fColorFilter); |
158 REF_COPY(fRasterizer); | 153 REF_COPY(fRasterizer); |
159 REF_COPY(fLooper); | 154 REF_COPY(fLooper); |
160 REF_COPY(fImageFilter); | 155 REF_COPY(fImageFilter); |
161 REF_COPY(fAnnotation); | |
162 | 156 |
163 COPY(fTextSize); | 157 COPY(fTextSize); |
164 COPY(fTextScaleX); | 158 COPY(fTextScaleX); |
165 COPY(fTextSkewX); | 159 COPY(fTextSkewX); |
166 COPY(fColor); | 160 COPY(fColor); |
167 COPY(fWidth); | 161 COPY(fWidth); |
168 COPY(fMiterLimit); | 162 COPY(fMiterLimit); |
169 COPY(fBitfields); | 163 COPY(fBitfields); |
170 | 164 |
171 return *this; | 165 return *this; |
(...skipping 12 matching lines...) Expand all Loading... |
184 | 178 |
185 REF_MOVE(fTypeface); | 179 REF_MOVE(fTypeface); |
186 REF_MOVE(fPathEffect); | 180 REF_MOVE(fPathEffect); |
187 REF_MOVE(fShader); | 181 REF_MOVE(fShader); |
188 REF_MOVE(fXfermode); | 182 REF_MOVE(fXfermode); |
189 REF_MOVE(fMaskFilter); | 183 REF_MOVE(fMaskFilter); |
190 REF_MOVE(fColorFilter); | 184 REF_MOVE(fColorFilter); |
191 REF_MOVE(fRasterizer); | 185 REF_MOVE(fRasterizer); |
192 REF_MOVE(fLooper); | 186 REF_MOVE(fLooper); |
193 REF_MOVE(fImageFilter); | 187 REF_MOVE(fImageFilter); |
194 REF_MOVE(fAnnotation); | |
195 | 188 |
196 MOVE(fTextSize); | 189 MOVE(fTextSize); |
197 MOVE(fTextScaleX); | 190 MOVE(fTextScaleX); |
198 MOVE(fTextSkewX); | 191 MOVE(fTextSkewX); |
199 MOVE(fColor); | 192 MOVE(fColor); |
200 MOVE(fWidth); | 193 MOVE(fWidth); |
201 MOVE(fMiterLimit); | 194 MOVE(fMiterLimit); |
202 MOVE(fBitfields); | 195 MOVE(fBitfields); |
203 | 196 |
204 return *this; | 197 return *this; |
205 | 198 |
206 #undef MOVE | 199 #undef MOVE |
207 #undef REF_MOVE | 200 #undef REF_MOVE |
208 } | 201 } |
209 | 202 |
210 bool operator==(const SkPaint& a, const SkPaint& b) { | 203 bool operator==(const SkPaint& a, const SkPaint& b) { |
211 #define EQUAL(field) (a.field == b.field) | 204 #define EQUAL(field) (a.field == b.field) |
212 return EQUAL(fTypeface) | 205 return EQUAL(fTypeface) |
213 && EQUAL(fPathEffect) | 206 && EQUAL(fPathEffect) |
214 && EQUAL(fShader) | 207 && EQUAL(fShader) |
215 && EQUAL(fXfermode) | 208 && EQUAL(fXfermode) |
216 && EQUAL(fMaskFilter) | 209 && EQUAL(fMaskFilter) |
217 && EQUAL(fColorFilter) | 210 && EQUAL(fColorFilter) |
218 && EQUAL(fRasterizer) | 211 && EQUAL(fRasterizer) |
219 && EQUAL(fLooper) | 212 && EQUAL(fLooper) |
220 && EQUAL(fImageFilter) | 213 && EQUAL(fImageFilter) |
221 && EQUAL(fAnnotation) | |
222 && EQUAL(fTextSize) | 214 && EQUAL(fTextSize) |
223 && EQUAL(fTextScaleX) | 215 && EQUAL(fTextScaleX) |
224 && EQUAL(fTextSkewX) | 216 && EQUAL(fTextSkewX) |
225 && EQUAL(fColor) | 217 && EQUAL(fColor) |
226 && EQUAL(fWidth) | 218 && EQUAL(fWidth) |
227 && EQUAL(fMiterLimit) | 219 && EQUAL(fMiterLimit) |
228 && EQUAL(fBitfieldsUInt) | 220 && EQUAL(fBitfieldsUInt) |
229 ; | 221 ; |
230 #undef EQUAL | 222 #undef EQUAL |
231 } | 223 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) { | 405 SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) { |
414 SkRefCnt_SafeAssign(fLooper, looper); | 406 SkRefCnt_SafeAssign(fLooper, looper); |
415 return looper; | 407 return looper; |
416 } | 408 } |
417 | 409 |
418 SkImageFilter* SkPaint::setImageFilter(SkImageFilter* imageFilter) { | 410 SkImageFilter* SkPaint::setImageFilter(SkImageFilter* imageFilter) { |
419 SkRefCnt_SafeAssign(fImageFilter, imageFilter); | 411 SkRefCnt_SafeAssign(fImageFilter, imageFilter); |
420 return imageFilter; | 412 return imageFilter; |
421 } | 413 } |
422 | 414 |
423 SkAnnotation* SkPaint::setAnnotation(SkAnnotation* annotation) { | |
424 SkRefCnt_SafeAssign(fAnnotation, annotation); | |
425 return annotation; | |
426 } | |
427 | |
428 /////////////////////////////////////////////////////////////////////////////// | 415 /////////////////////////////////////////////////////////////////////////////// |
429 | 416 |
430 static SkScalar mag2(SkScalar x, SkScalar y) { | 417 static SkScalar mag2(SkScalar x, SkScalar y) { |
431 return x * x + y * y; | 418 return x * x + y * y; |
432 } | 419 } |
433 | 420 |
434 static bool tooBig(const SkMatrix& m, SkScalar ma2max) { | 421 static bool tooBig(const SkMatrix& m, SkScalar ma2max) { |
435 return mag2(m[SkMatrix::kMScaleX], m[SkMatrix::kMSkewY]) > ma2max | 422 return mag2(m[SkMatrix::kMScaleX], m[SkMatrix::kMSkewY]) > ma2max |
436 || | 423 || |
437 mag2(m[SkMatrix::kMSkewX], m[SkMatrix::kMScaleY]) > ma2max; | 424 mag2(m[SkMatrix::kMSkewX], m[SkMatrix::kMScaleY]) > ma2max; |
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 if (this->getTypeface()) { | 1877 if (this->getTypeface()) { |
1891 flatFlags |= kHasTypeface_FlatFlag; | 1878 flatFlags |= kHasTypeface_FlatFlag; |
1892 } | 1879 } |
1893 if (asint(this->getPathEffect()) | | 1880 if (asint(this->getPathEffect()) | |
1894 asint(this->getShader()) | | 1881 asint(this->getShader()) | |
1895 asint(this->getXfermode()) | | 1882 asint(this->getXfermode()) | |
1896 asint(this->getMaskFilter()) | | 1883 asint(this->getMaskFilter()) | |
1897 asint(this->getColorFilter()) | | 1884 asint(this->getColorFilter()) | |
1898 asint(this->getRasterizer()) | | 1885 asint(this->getRasterizer()) | |
1899 asint(this->getLooper()) | | 1886 asint(this->getLooper()) | |
1900 asint(this->getAnnotation()) | | |
1901 asint(this->getImageFilter())) { | 1887 asint(this->getImageFilter())) { |
1902 flatFlags |= kHasEffects_FlatFlag; | 1888 flatFlags |= kHasEffects_FlatFlag; |
1903 } | 1889 } |
1904 | 1890 |
1905 SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize); | 1891 SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize); |
1906 uint32_t* ptr = buffer.reserve(kPODPaintSize); | 1892 uint32_t* ptr = buffer.reserve(kPODPaintSize); |
1907 | 1893 |
1908 ptr = write_scalar(ptr, this->getTextSize()); | 1894 ptr = write_scalar(ptr, this->getTextSize()); |
1909 ptr = write_scalar(ptr, this->getTextScaleX()); | 1895 ptr = write_scalar(ptr, this->getTextScaleX()); |
1910 ptr = write_scalar(ptr, this->getTextSkewX()); | 1896 ptr = write_scalar(ptr, this->getTextSkewX()); |
(...skipping 13 matching lines...) Expand all Loading... |
1924 } | 1910 } |
1925 if (flatFlags & kHasEffects_FlatFlag) { | 1911 if (flatFlags & kHasEffects_FlatFlag) { |
1926 buffer.writeFlattenable(this->getPathEffect()); | 1912 buffer.writeFlattenable(this->getPathEffect()); |
1927 buffer.writeFlattenable(this->getShader()); | 1913 buffer.writeFlattenable(this->getShader()); |
1928 buffer.writeFlattenable(this->getXfermode()); | 1914 buffer.writeFlattenable(this->getXfermode()); |
1929 buffer.writeFlattenable(this->getMaskFilter()); | 1915 buffer.writeFlattenable(this->getMaskFilter()); |
1930 buffer.writeFlattenable(this->getColorFilter()); | 1916 buffer.writeFlattenable(this->getColorFilter()); |
1931 buffer.writeFlattenable(this->getRasterizer()); | 1917 buffer.writeFlattenable(this->getRasterizer()); |
1932 buffer.writeFlattenable(this->getLooper()); | 1918 buffer.writeFlattenable(this->getLooper()); |
1933 buffer.writeFlattenable(this->getImageFilter()); | 1919 buffer.writeFlattenable(this->getImageFilter()); |
1934 | |
1935 if (fAnnotation) { | |
1936 buffer.writeBool(true); | |
1937 fAnnotation->writeToBuffer(buffer); | |
1938 } else { | |
1939 buffer.writeBool(false); | |
1940 } | |
1941 } | 1920 } |
1942 } | 1921 } |
1943 | 1922 |
1944 void SkPaint::unflatten(SkReadBuffer& buffer) { | 1923 void SkPaint::unflatten(SkReadBuffer& buffer) { |
1945 SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize); | 1924 SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize); |
1946 if (!buffer.validateAvailable(kPODPaintSize)) { | 1925 if (!buffer.validateAvailable(kPODPaintSize)) { |
1947 return; | 1926 return; |
1948 } | 1927 } |
1949 const void* podData = buffer.skip(kPODPaintSize); | 1928 const void* podData = buffer.skip(kPODPaintSize); |
1950 const uint32_t* pod = reinterpret_cast<const uint32_t*>(podData); | 1929 const uint32_t* pod = reinterpret_cast<const uint32_t*>(podData); |
(...skipping 23 matching lines...) Expand all Loading... |
1974 if (flatFlags & kHasEffects_FlatFlag) { | 1953 if (flatFlags & kHasEffects_FlatFlag) { |
1975 SkSafeUnref(this->setPathEffect(buffer.readPathEffect())); | 1954 SkSafeUnref(this->setPathEffect(buffer.readPathEffect())); |
1976 SkSafeUnref(this->setShader(buffer.readShader())); | 1955 SkSafeUnref(this->setShader(buffer.readShader())); |
1977 SkSafeUnref(this->setXfermode(buffer.readXfermode())); | 1956 SkSafeUnref(this->setXfermode(buffer.readXfermode())); |
1978 SkSafeUnref(this->setMaskFilter(buffer.readMaskFilter())); | 1957 SkSafeUnref(this->setMaskFilter(buffer.readMaskFilter())); |
1979 SkSafeUnref(this->setColorFilter(buffer.readColorFilter())); | 1958 SkSafeUnref(this->setColorFilter(buffer.readColorFilter())); |
1980 SkSafeUnref(this->setRasterizer(buffer.readRasterizer())); | 1959 SkSafeUnref(this->setRasterizer(buffer.readRasterizer())); |
1981 SkSafeUnref(this->setLooper(buffer.readDrawLooper())); | 1960 SkSafeUnref(this->setLooper(buffer.readDrawLooper())); |
1982 SkSafeUnref(this->setImageFilter(buffer.readImageFilter())); | 1961 SkSafeUnref(this->setImageFilter(buffer.readImageFilter())); |
1983 | 1962 |
1984 if (buffer.readBool()) { | 1963 if (buffer.isVersionLT(SkReadBuffer::kAnnotationsMovedToCanvas_Version))
{ |
1985 this->setAnnotation(SkAnnotation::Create(buffer))->unref(); | 1964 // We used to store annotations here (string+skdata) if this bool wa
s true |
| 1965 if (buffer.readBool()) { |
| 1966 // Annotations have moved to drawAnnotation, so we just drop thi
s one on the floor. |
| 1967 SkString key; |
| 1968 buffer.readString(&key); |
| 1969 SkSafeUnref(buffer.readByteArrayAsData()); |
| 1970 } |
1986 } | 1971 } |
1987 } else { | 1972 } else { |
1988 this->setPathEffect(nullptr); | 1973 this->setPathEffect(nullptr); |
1989 this->setShader(nullptr); | 1974 this->setShader(nullptr); |
1990 this->setXfermode(nullptr); | 1975 this->setXfermode(nullptr); |
1991 this->setMaskFilter(nullptr); | 1976 this->setMaskFilter(nullptr); |
1992 this->setColorFilter(nullptr); | 1977 this->setColorFilter(nullptr); |
1993 this->setRasterizer(nullptr); | 1978 this->setRasterizer(nullptr); |
1994 this->setLooper(nullptr); | 1979 this->setLooper(nullptr); |
1995 this->setImageFilter(nullptr); | 1980 this->setImageFilter(nullptr); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2198 str->append("</dd>"); | 2183 str->append("</dd>"); |
2199 } | 2184 } |
2200 | 2185 |
2201 SkImageFilter* imageFilter = this->getImageFilter(); | 2186 SkImageFilter* imageFilter = this->getImageFilter(); |
2202 if (imageFilter) { | 2187 if (imageFilter) { |
2203 str->append("<dt>ImageFilter:</dt><dd>"); | 2188 str->append("<dt>ImageFilter:</dt><dd>"); |
2204 imageFilter->toString(str); | 2189 imageFilter->toString(str); |
2205 str->append("</dd>"); | 2190 str->append("</dd>"); |
2206 } | 2191 } |
2207 | 2192 |
2208 SkAnnotation* annotation = this->getAnnotation(); | |
2209 if (annotation) { | |
2210 str->append("<dt>Annotation:</dt><dd>"); | |
2211 str->append("</dd>"); | |
2212 } | |
2213 | |
2214 str->append("<dt>Color:</dt><dd>0x"); | 2193 str->append("<dt>Color:</dt><dd>0x"); |
2215 SkColor color = this->getColor(); | 2194 SkColor color = this->getColor(); |
2216 str->appendHex(color); | 2195 str->appendHex(color); |
2217 str->append("</dd>"); | 2196 str->append("</dd>"); |
2218 | 2197 |
2219 str->append("<dt>Stroke Width:</dt><dd>"); | 2198 str->append("<dt>Stroke Width:</dt><dd>"); |
2220 str->appendScalar(this->getStrokeWidth()); | 2199 str->appendScalar(this->getStrokeWidth()); |
2221 str->append("</dd>"); | 2200 str->append("</dd>"); |
2222 | 2201 |
2223 str->append("<dt>Stroke Miter:</dt><dd>"); | 2202 str->append("<dt>Stroke Miter:</dt><dd>"); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2430 default: | 2409 default: |
2431 break; | 2410 break; |
2432 } | 2411 } |
2433 } | 2412 } |
2434 return false; | 2413 return false; |
2435 } | 2414 } |
2436 | 2415 |
2437 uint32_t SkPaint::getHash() const { | 2416 uint32_t SkPaint::getHash() const { |
2438 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2417 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
2439 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2418 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
2440 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size
of(uint32_t), | 2419 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo
f(uint32_t), |
2441 "SkPaint_notPackedTightly"); | 2420 "SkPaint_notPackedTightly"); |
2442 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2421 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2443 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2422 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2444 } | 2423 } |
OLD | NEW |