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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 if (scale) { | 918 if (scale) { |
919 maxWidth /= scale; | 919 maxWidth /= scale; |
920 } | 920 } |
921 | 921 |
922 SkAutoGlyphCache autoCache(paint, nullptr, nullptr); | 922 SkAutoGlyphCache autoCache(paint, nullptr, nullptr); |
923 SkGlyphCache* cache = autoCache.getCache(); | 923 SkGlyphCache* cache = autoCache.getCache(); |
924 | 924 |
925 GlyphCacheProc glyphCacheProc = paint.getGlyphCacheProc(false); | 925 GlyphCacheProc glyphCacheProc = paint.getGlyphCacheProc(false); |
926 const int xyIndex = paint.isVerticalText() ? 1 : 0; | 926 const int xyIndex = paint.isVerticalText() ? 1 : 0; |
927 // use 64bits for our accumulator, to avoid overflowing 16.16 | 927 // use 64bits for our accumulator, to avoid overflowing 16.16 |
928 Sk48Dot16 max = SkScalarToFixed(maxWidth); | 928 Sk48Dot16 max = SkScalarTo48Dot16(maxWidth); |
929 Sk48Dot16 width = 0; | 929 Sk48Dot16 width = 0; |
930 | 930 |
931 SkAutoKern autokern; | 931 SkAutoKern autokern; |
932 | 932 |
933 if (this->isDevKernText()) { | 933 if (this->isDevKernText()) { |
934 int rsb = 0; | 934 int rsb = 0; |
935 while (text < stop) { | 935 while (text < stop) { |
936 const char* curr = text; | 936 const char* curr = text; |
937 const SkGlyph& g = glyphCacheProc(cache, &text); | 937 const SkGlyph& g = glyphCacheProc(cache, &text); |
938 SkFixed x = SkAutoKern_AdjustF(rsb, g.fLsbDelta) + advance(g, xyInde
x); | 938 SkFixed x = SkAutoKern_AdjustF(rsb, g.fLsbDelta) + advance(g, xyInde
x); |
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 } | 2431 } |
2432 | 2432 |
2433 uint32_t SkPaint::getHash() const { | 2433 uint32_t SkPaint::getHash() const { |
2434 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2434 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
2435 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2435 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
2436 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size
of(uint32_t), | 2436 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size
of(uint32_t), |
2437 "SkPaint_notPackedTightly"); | 2437 "SkPaint_notPackedTightly"); |
2438 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2438 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2439 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2439 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2440 } | 2440 } |
OLD | NEW |