OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 | 174 |
175 #ifdef SK_BUILD_FOR_ANDROID | 175 #ifdef SK_BUILD_FOR_ANDROID |
176 uint32_t SkPaint::getGenerationID() const { | 176 uint32_t SkPaint::getGenerationID() const { |
177 return fGenerationID; | 177 return fGenerationID; |
178 } | 178 } |
179 | 179 |
180 void SkPaint::setGenerationID(uint32_t generationID) { | 180 void SkPaint::setGenerationID(uint32_t generationID) { |
181 fGenerationID = generationID; | 181 fGenerationID = generationID; |
182 } | 182 } |
183 #endif | |
184 | 183 |
185 #ifdef SK_BUILD_FOR_ANDROID | |
186 unsigned SkPaint::getBaseGlyphCount(SkUnichar text) const { | 184 unsigned SkPaint::getBaseGlyphCount(SkUnichar text) const { |
187 SkAutoGlyphCache autoCache(*this, NULL, NULL); | 185 SkAutoGlyphCache autoCache(*this, NULL, NULL); |
188 SkGlyphCache* cache = autoCache.getCache(); | 186 SkGlyphCache* cache = autoCache.getCache(); |
189 return cache->getBaseGlyphCount(text); | 187 return cache->getBaseGlyphCount(text); |
190 } | 188 } |
| 189 |
| 190 void SkPaint::setPaintOptionsAndroid(const SkPaintOptionsAndroid& options) { |
| 191 if(!memcmp(&fPaintOptionsAndroid, &options, sizeof(SkPaintOptionsAndroid)))
{ |
| 192 fPaintOptionsAndroid = options; |
| 193 GEN_ID_INC; |
| 194 } |
| 195 } |
191 #endif | 196 #endif |
192 | 197 |
193 void SkPaint::setHinting(Hinting hintingLevel) { | 198 void SkPaint::setHinting(Hinting hintingLevel) { |
194 GEN_ID_INC_EVAL((unsigned) hintingLevel != fHinting); | 199 GEN_ID_INC_EVAL((unsigned) hintingLevel != fHinting); |
195 fHinting = hintingLevel; | 200 fHinting = hintingLevel; |
196 } | 201 } |
197 | 202 |
198 void SkPaint::setFlags(uint32_t flags) { | 203 void SkPaint::setFlags(uint32_t flags) { |
199 GEN_ID_INC_EVAL(fFlags != flags); | 204 GEN_ID_INC_EVAL(fFlags != flags); |
200 fFlags = flags; | 205 fFlags = flags; |
(...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 Also, all existing users of blur have calibrated for linear. */ | 1805 Also, all existing users of blur have calibrated for linear. */ |
1801 rec.ignorePreBlend(); | 1806 rec.ignorePreBlend(); |
1802 } | 1807 } |
1803 if (ra) { | 1808 if (ra) { |
1804 raBuffer.writeFlattenable(ra); | 1809 raBuffer.writeFlattenable(ra); |
1805 descSize += raBuffer.size(); | 1810 descSize += raBuffer.size(); |
1806 entryCount += 1; | 1811 entryCount += 1; |
1807 rec.fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do
the scan conversion | 1812 rec.fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do
the scan conversion |
1808 } | 1813 } |
1809 | 1814 |
| 1815 #ifdef SK_BUILD_FOR_ANDROID |
| 1816 SkOrderedWriteBuffer androidBuffer(128); |
| 1817 fPaintOptionsAndroid.flatten(androidBuffer); |
| 1818 descSize += androidBuffer.size(); |
| 1819 entryCount += 1; |
| 1820 #endif |
| 1821 |
1810 /////////////////////////////////////////////////////////////////////////// | 1822 /////////////////////////////////////////////////////////////////////////// |
1811 // Now that we're done tweaking the rec, call the PostMakeRec cleanup | 1823 // Now that we're done tweaking the rec, call the PostMakeRec cleanup |
1812 SkScalerContext::PostMakeRec(*this, &rec); | 1824 SkScalerContext::PostMakeRec(*this, &rec); |
1813 | 1825 |
1814 descSize += SkDescriptor::ComputeOverhead(entryCount); | 1826 descSize += SkDescriptor::ComputeOverhead(entryCount); |
1815 | 1827 |
1816 SkAutoDescriptor ad(descSize); | 1828 SkAutoDescriptor ad(descSize); |
1817 SkDescriptor* desc = ad.getDesc(); | 1829 SkDescriptor* desc = ad.getDesc(); |
1818 | 1830 |
1819 desc->init(); | 1831 desc->init(); |
1820 desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); | 1832 desc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); |
1821 | 1833 |
| 1834 #ifdef SK_BUILD_FOR_ANDROID |
| 1835 add_flattenable(desc, kAndroidOpts_SkDescriptorTag, &androidBuffer); |
| 1836 #endif |
| 1837 |
1822 if (pe) { | 1838 if (pe) { |
1823 add_flattenable(desc, kPathEffect_SkDescriptorTag, &peBuffer); | 1839 add_flattenable(desc, kPathEffect_SkDescriptorTag, &peBuffer); |
1824 } | 1840 } |
1825 if (mf) { | 1841 if (mf) { |
1826 add_flattenable(desc, kMaskFilter_SkDescriptorTag, &mfBuffer); | 1842 add_flattenable(desc, kMaskFilter_SkDescriptorTag, &mfBuffer); |
1827 } | 1843 } |
1828 if (ra) { | 1844 if (ra) { |
1829 add_flattenable(desc, kRasterizer_SkDescriptorTag, &raBuffer); | 1845 add_flattenable(desc, kRasterizer_SkDescriptorTag, &raBuffer); |
1830 } | 1846 } |
1831 | 1847 |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 if (firstTime) { | 2583 if (firstTime) { |
2568 *dst = r; | 2584 *dst = r; |
2569 } else { | 2585 } else { |
2570 dst->join(r); | 2586 dst->join(r); |
2571 } | 2587 } |
2572 } else { | 2588 } else { |
2573 break; | 2589 break; |
2574 } | 2590 } |
2575 } | 2591 } |
2576 } | 2592 } |
OLD | NEW |