| 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 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 if (gContrast != contrast || gPaintGamma != paintGamma || gDeviceGamma != de
viceGamma) { | 1518 if (gContrast != contrast || gPaintGamma != paintGamma || gDeviceGamma != de
viceGamma) { |
| 1519 SkSafeUnref(gMaskGamma); | 1519 SkSafeUnref(gMaskGamma); |
| 1520 gMaskGamma = new SkMaskGamma(contrast, paintGamma, deviceGamma); | 1520 gMaskGamma = new SkMaskGamma(contrast, paintGamma, deviceGamma); |
| 1521 gContrast = contrast; | 1521 gContrast = contrast; |
| 1522 gPaintGamma = paintGamma; | 1522 gPaintGamma = paintGamma; |
| 1523 gDeviceGamma = deviceGamma; | 1523 gDeviceGamma = deviceGamma; |
| 1524 } | 1524 } |
| 1525 return *gMaskGamma; | 1525 return *gMaskGamma; |
| 1526 } | 1526 } |
| 1527 | 1527 |
| 1528 /*static*/ void SkPaint::Term() { | |
| 1529 SkAutoMutexAcquire ama(gMaskGammaCacheMutex); | |
| 1530 | |
| 1531 SkSafeUnref(gLinearMaskGamma); | |
| 1532 gLinearMaskGamma = nullptr; | |
| 1533 SkSafeUnref(gMaskGamma); | |
| 1534 gMaskGamma = nullptr; | |
| 1535 SkDEBUGCODE(gContrast = SK_ScalarMin;) | |
| 1536 SkDEBUGCODE(gPaintGamma = SK_ScalarMin;) | |
| 1537 SkDEBUGCODE(gDeviceGamma = SK_ScalarMin;) | |
| 1538 } | |
| 1539 | |
| 1540 /** | 1528 /** |
| 1541 * We ensure that the rec is self-consistent and efficient (where possible) | 1529 * We ensure that the rec is self-consistent and efficient (where possible) |
| 1542 */ | 1530 */ |
| 1543 void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) { | 1531 void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) { |
| 1544 /** | 1532 /** |
| 1545 * If we're asking for A8, we force the colorlum to be gray, since that | 1533 * If we're asking for A8, we force the colorlum to be gray, since that |
| 1546 * limits the number of unique entries, and the scaler will only look at | 1534 * limits the number of unique entries, and the scaler will only look at |
| 1547 * the lum of one of them. | 1535 * the lum of one of them. |
| 1548 */ | 1536 */ |
| 1549 switch (rec->fMaskFormat) { | 1537 switch (rec->fMaskFormat) { |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2427 } | 2415 } |
| 2428 | 2416 |
| 2429 uint32_t SkPaint::getHash() const { | 2417 uint32_t SkPaint::getHash() const { |
| 2430 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, | 2418 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB
itfields, |
| 2431 // so fBitfields should be 10 pointers and 6 32-bit values from the start. | 2419 // so fBitfields should be 10 pointers and 6 32-bit values from the start. |
| 2432 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size
of(uint32_t), | 2420 static_assert(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * size
of(uint32_t), |
| 2433 "SkPaint_notPackedTightly"); | 2421 "SkPaint_notPackedTightly"); |
| 2434 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2422 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
| 2435 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2423 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
| 2436 } | 2424 } |
| OLD | NEW |