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 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 flags |= SkScalerContext::kFrameAndFill_Flag; | 1400 flags |= SkScalerContext::kFrameAndFill_Flag; |
1401 } | 1401 } |
1402 } else { | 1402 } else { |
1403 rec->fFrameWidth = 0; | 1403 rec->fFrameWidth = 0; |
1404 rec->fMiterLimit = 0; | 1404 rec->fMiterLimit = 0; |
1405 rec->fStrokeJoin = 0; | 1405 rec->fStrokeJoin = 0; |
1406 } | 1406 } |
1407 | 1407 |
1408 rec->fMaskFormat = SkToU8(computeMaskFormat(paint)); | 1408 rec->fMaskFormat = SkToU8(computeMaskFormat(paint)); |
1409 | 1409 |
1410 if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == re
c->fMaskFormat) { | 1410 if (SkMask::kLCD16_Format == rec->fMaskFormat) { |
1411 if (too_big_for_lcd(*rec, checkPost2x2)) { | 1411 if (too_big_for_lcd(*rec, checkPost2x2)) { |
1412 rec->fMaskFormat = SkMask::kA8_Format; | 1412 rec->fMaskFormat = SkMask::kA8_Format; |
1413 flags |= SkScalerContext::kGenA8FromLCD_Flag; | 1413 flags |= SkScalerContext::kGenA8FromLCD_Flag; |
1414 } else { | 1414 } else { |
1415 SkPixelGeometry geometry = deviceProperties | 1415 SkPixelGeometry geometry = deviceProperties |
1416 ? deviceProperties->pixelGeometry() | 1416 ? deviceProperties->pixelGeometry() |
1417 : SkSurfacePropsDefaultPixelGeometry(); | 1417 : SkSurfacePropsDefaultPixelGeometry(); |
1418 switch (geometry) { | 1418 switch (geometry) { |
1419 case kUnknown_SkPixelGeometry: | 1419 case kUnknown_SkPixelGeometry: |
1420 // eeek, can't support LCD | 1420 // eeek, can't support LCD |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 /** | 1546 /** |
1547 * We ensure that the rec is self-consistent and efficient (where possible) | 1547 * We ensure that the rec is self-consistent and efficient (where possible) |
1548 */ | 1548 */ |
1549 void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) { | 1549 void SkScalerContext::PostMakeRec(const SkPaint&, SkScalerContext::Rec* rec) { |
1550 /** | 1550 /** |
1551 * If we're asking for A8, we force the colorlum to be gray, since that | 1551 * If we're asking for A8, we force the colorlum to be gray, since that |
1552 * limits the number of unique entries, and the scaler will only look at | 1552 * limits the number of unique entries, and the scaler will only look at |
1553 * the lum of one of them. | 1553 * the lum of one of them. |
1554 */ | 1554 */ |
1555 switch (rec->fMaskFormat) { | 1555 switch (rec->fMaskFormat) { |
1556 case SkMask::kLCD16_Format: | 1556 case SkMask::kLCD16_Format: { |
1557 case SkMask::kLCD32_Format: { | |
1558 // filter down the luminance color to a finite number of bits | 1557 // filter down the luminance color to a finite number of bits |
1559 SkColor color = rec->getLuminanceColor(); | 1558 SkColor color = rec->getLuminanceColor(); |
1560 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); | 1559 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); |
1561 break; | 1560 break; |
1562 } | 1561 } |
1563 case SkMask::kA8_Format: { | 1562 case SkMask::kA8_Format: { |
1564 // filter down the luminance to a single component, since A8 can't | 1563 // filter down the luminance to a single component, since A8 can't |
1565 // use per-component information | 1564 // use per-component information |
1566 SkColor color = rec->getLuminanceColor(); | 1565 SkColor color = rec->getLuminanceColor(); |
1567 U8CPU lum = SkComputeLuminance(SkColorGetR(color), | 1566 U8CPU lum = SkComputeLuminance(SkColorGetR(color), |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2415 } | 2414 } |
2416 | 2415 |
2417 uint32_t SkPaint::getHash() const { | 2416 uint32_t SkPaint::getHash() const { |
2418 // 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, |
2419 // 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. |
2420 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), | 2419 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 *
sizeof(uint32_t), |
2421 SkPaint_notPackedTightly); | 2420 SkPaint_notPackedTightly); |
2422 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), | 2421 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), |
2423 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); | 2422 offsetof(SkPaint, fBitfields) + sizeof(fBitfields
)); |
2424 } | 2423 } |
OLD | NEW |