| 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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 return rec.fTextSize > SK_MAX_SIZE_FOR_LCDTEXT; | 1311 return rec.fTextSize > SK_MAX_SIZE_FOR_LCDTEXT; |
| 1312 } | 1312 } |
| 1313 } | 1313 } |
| 1314 | 1314 |
| 1315 /* | 1315 /* |
| 1316 * Return the scalar with only limited fractional precision. Used to consolidat
e matrices | 1316 * Return the scalar with only limited fractional precision. Used to consolidat
e matrices |
| 1317 * that vary only slightly when we create our key into the font cache, since th
e font scaler | 1317 * that vary only slightly when we create our key into the font cache, since th
e font scaler |
| 1318 * typically returns the same looking resuts for tiny changes in the matrix. | 1318 * typically returns the same looking resuts for tiny changes in the matrix. |
| 1319 */ | 1319 */ |
| 1320 static SkScalar sk_relax(SkScalar x) { | 1320 static SkScalar sk_relax(SkScalar x) { |
| 1321 int n = sk_float_round2int(x * 1024); | 1321 SkScalar n = SkScalarRoundToScalar(x * 1024); |
| 1322 return n / 1024.0f; | 1322 return n / 1024.0f; |
| 1323 } | 1323 } |
| 1324 | 1324 |
| 1325 void SkScalerContext::MakeRec(const SkPaint& paint, | 1325 void SkScalerContext::MakeRec(const SkPaint& paint, |
| 1326 const SkSurfaceProps* surfaceProps, | 1326 const SkSurfaceProps* surfaceProps, |
| 1327 const SkMatrix* deviceMatrix, | 1327 const SkMatrix* deviceMatrix, |
| 1328 Rec* rec) { | 1328 Rec* rec) { |
| 1329 SkASSERT(deviceMatrix == nullptr || !deviceMatrix->hasPerspective()); | 1329 SkASSERT(deviceMatrix == nullptr || !deviceMatrix->hasPerspective()); |
| 1330 | 1330 |
| 1331 SkTypeface* typeface = paint.getTypeface(); | 1331 SkTypeface* typeface = paint.getTypeface(); |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2435 } | 2435 } |
| 2436 | 2436 |
| 2437 uint32_t SkPaint::getHash() const { | 2437 uint32_t SkPaint::getHash() const { |
| 2438 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2438 // 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. | 2439 // 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), | 2440 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size
of(uint32_t), |
| 2441 "SkPaint_notPackedTightly"); | 2441 "SkPaint_notPackedTightly"); |
| 2442 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2442 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
| 2443 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2443 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
| 2444 } | 2444 } |
| OLD | NEW |