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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 flags |= SkScalerContext::kFrameAndFill_Flag; | 1600 flags |= SkScalerContext::kFrameAndFill_Flag; |
1601 } | 1601 } |
1602 } else { | 1602 } else { |
1603 rec->fFrameWidth = 0; | 1603 rec->fFrameWidth = 0; |
1604 rec->fMiterLimit = 0; | 1604 rec->fMiterLimit = 0; |
1605 rec->fStrokeJoin = 0; | 1605 rec->fStrokeJoin = 0; |
1606 } | 1606 } |
1607 | 1607 |
1608 rec->fMaskFormat = SkToU8(computeMaskFormat(paint)); | 1608 rec->fMaskFormat = SkToU8(computeMaskFormat(paint)); |
1609 | 1609 |
| 1610 SkDeviceProperties::Geometry geometry = deviceProperties |
| 1611 ? deviceProperties->fGeometry |
| 1612 : SkDeviceProperties::Geometry::MakeDe
fault(); |
1610 if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == re
c->fMaskFormat) { | 1613 if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == re
c->fMaskFormat) { |
1611 if (tooBigForLCD(*rec)) { | 1614 if (!geometry.isOrientationKnown() || !geometry.isLayoutKnown() || tooBi
gForLCD(*rec)) { |
| 1615 // eeek, can't support LCD |
1612 rec->fMaskFormat = SkMask::kA8_Format; | 1616 rec->fMaskFormat = SkMask::kA8_Format; |
1613 flags |= SkScalerContext::kGenA8FromLCD_Flag; | |
1614 } else { | 1617 } else { |
1615 SkPixelGeometry geometry = deviceProperties | 1618 if (SkDeviceProperties::Geometry::kVertical_Orientation == geometry.
getOrientation()) { |
1616 ? deviceProperties->fPixelGeometry | 1619 flags |= SkScalerContext::kLCD_Vertical_Flag; |
1617 : SkSurfacePropsDefaultPixelGeometry(); | 1620 } |
1618 switch (geometry) { | 1621 if (SkDeviceProperties::Geometry::kBGR_Layout == geometry.getLayout(
)) { |
1619 case kUnknown_SkPixelGeometry: | 1622 flags |= SkScalerContext::kLCD_BGROrder_Flag; |
1620 // eeek, can't support LCD | |
1621 rec->fMaskFormat = SkMask::kA8_Format; | |
1622 flags |= SkScalerContext::kGenA8FromLCD_Flag; | |
1623 break; | |
1624 case kRGB_H_SkPixelGeometry: | |
1625 // our default, do nothing. | |
1626 break; | |
1627 case kBGR_H_SkPixelGeometry: | |
1628 flags |= SkScalerContext::kLCD_BGROrder_Flag; | |
1629 break; | |
1630 case kRGB_V_SkPixelGeometry: | |
1631 flags |= SkScalerContext::kLCD_Vertical_Flag; | |
1632 break; | |
1633 case kBGR_V_SkPixelGeometry: | |
1634 flags |= SkScalerContext::kLCD_Vertical_Flag; | |
1635 flags |= SkScalerContext::kLCD_BGROrder_Flag; | |
1636 break; | |
1637 } | 1623 } |
1638 } | 1624 } |
1639 } | 1625 } |
1640 | 1626 |
1641 if (paint.isEmbeddedBitmapText()) { | 1627 if (paint.isEmbeddedBitmapText()) { |
1642 flags |= SkScalerContext::kEmbeddedBitmapText_Flag; | 1628 flags |= SkScalerContext::kEmbeddedBitmapText_Flag; |
1643 } | 1629 } |
1644 if (paint.isSubpixelText()) { | 1630 if (paint.isSubpixelText()) { |
1645 flags |= SkScalerContext::kSubpixelPositioning_Flag; | 1631 flags |= SkScalerContext::kSubpixelPositioning_Flag; |
1646 } | 1632 } |
(...skipping 10 matching lines...) Expand all Loading... |
1657 | 1643 |
1658 // these modify fFlags, so do them after assigning fFlags | 1644 // these modify fFlags, so do them after assigning fFlags |
1659 rec->setHinting(computeHinting(paint)); | 1645 rec->setHinting(computeHinting(paint)); |
1660 | 1646 |
1661 rec->setLuminanceColor(computeLuminanceColor(paint)); | 1647 rec->setLuminanceColor(computeLuminanceColor(paint)); |
1662 | 1648 |
1663 if (NULL == deviceProperties) { | 1649 if (NULL == deviceProperties) { |
1664 rec->setDeviceGamma(SK_GAMMA_EXPONENT); | 1650 rec->setDeviceGamma(SK_GAMMA_EXPONENT); |
1665 rec->setPaintGamma(SK_GAMMA_EXPONENT); | 1651 rec->setPaintGamma(SK_GAMMA_EXPONENT); |
1666 } else { | 1652 } else { |
1667 rec->setDeviceGamma(deviceProperties->getGamma()); | 1653 rec->setDeviceGamma(deviceProperties->fGamma); |
1668 | 1654 |
1669 //For now always set the paint gamma equal to the device gamma. | 1655 //For now always set the paint gamma equal to the device gamma. |
1670 //The math in SkMaskGamma can handle them being different, | 1656 //The math in SkMaskGamma can handle them being different, |
1671 //but it requires superluminous masks when | 1657 //but it requires superluminous masks when |
1672 //Ex : deviceGamma(x) < paintGamma(x) and x is sufficiently large. | 1658 //Ex : deviceGamma(x) < paintGamma(x) and x is sufficiently large. |
1673 rec->setPaintGamma(deviceProperties->getGamma()); | 1659 rec->setPaintGamma(deviceProperties->fGamma); |
1674 } | 1660 } |
1675 | 1661 |
1676 #ifdef SK_GAMMA_CONTRAST | 1662 #ifdef SK_GAMMA_CONTRAST |
1677 rec->setContrast(SK_GAMMA_CONTRAST); | 1663 rec->setContrast(SK_GAMMA_CONTRAST); |
1678 #else | 1664 #else |
1679 /** | 1665 /** |
1680 * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise. | 1666 * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise. |
1681 * With lower values small text appears washed out (though correctly so). | 1667 * With lower values small text appears washed out (though correctly so). |
1682 * With higher values lcd fringing is worse and the smoothing effect of | 1668 * With higher values lcd fringing is worse and the smoothing effect of |
1683 * partial coverage is diminished. | 1669 * partial coverage is diminished. |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2684 F_UNREF(Looper, readDrawLooper); | 2670 F_UNREF(Looper, readDrawLooper); |
2685 F_UNREF(ImageFilter, readImageFilter); | 2671 F_UNREF(ImageFilter, readImageFilter); |
2686 F(Typeface, readTypeface); | 2672 F(Typeface, readTypeface); |
2687 #undef F | 2673 #undef F |
2688 #undef F_UNREF | 2674 #undef F_UNREF |
2689 if (dirty & kAnnotation_DirtyBit) { | 2675 if (dirty & kAnnotation_DirtyBit) { |
2690 paint->setAnnotation(SkAnnotation::Create(buffer))->unref(); | 2676 paint->setAnnotation(SkAnnotation::Create(buffer))->unref(); |
2691 } | 2677 } |
2692 SkASSERT(dirty == paint->fDirtyBits); | 2678 SkASSERT(dirty == paint->fDirtyBits); |
2693 } | 2679 } |
OLD | NEW |