Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/core/SkPaint.cpp

Issue 551463004: introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add new file Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkDeviceProperties.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
1613 if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == re c->fMaskFormat) { 1610 if (SkMask::kLCD16_Format == rec->fMaskFormat || SkMask::kLCD32_Format == re c->fMaskFormat) {
1614 if (!geometry.isOrientationKnown() || !geometry.isLayoutKnown() || tooBi gForLCD(*rec)) { 1611 if (tooBigForLCD(*rec)) {
1615 // eeek, can't support LCD
1616 rec->fMaskFormat = SkMask::kA8_Format; 1612 rec->fMaskFormat = SkMask::kA8_Format;
1613 flags |= SkScalerContext::kGenA8FromLCD_Flag;
1617 } else { 1614 } else {
1618 if (SkDeviceProperties::Geometry::kVertical_Orientation == geometry. getOrientation()) { 1615 SkPixelGeometry geometry = deviceProperties
1619 flags |= SkScalerContext::kLCD_Vertical_Flag; 1616 ? deviceProperties->fPixelGeometry
1620 } 1617 : SkSurfacePropsDefaultPixelGeometry();
1621 if (SkDeviceProperties::Geometry::kBGR_Layout == geometry.getLayout( )) { 1618 switch (geometry) {
1622 flags |= SkScalerContext::kLCD_BGROrder_Flag; 1619 case kUnknown_SkPixelGeometry:
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;
1623 } 1637 }
1624 } 1638 }
1625 } 1639 }
1626 1640
1627 if (paint.isEmbeddedBitmapText()) { 1641 if (paint.isEmbeddedBitmapText()) {
1628 flags |= SkScalerContext::kEmbeddedBitmapText_Flag; 1642 flags |= SkScalerContext::kEmbeddedBitmapText_Flag;
1629 } 1643 }
1630 if (paint.isSubpixelText()) { 1644 if (paint.isSubpixelText()) {
1631 flags |= SkScalerContext::kSubpixelPositioning_Flag; 1645 flags |= SkScalerContext::kSubpixelPositioning_Flag;
1632 } 1646 }
(...skipping 10 matching lines...) Expand all
1643 1657
1644 // these modify fFlags, so do them after assigning fFlags 1658 // these modify fFlags, so do them after assigning fFlags
1645 rec->setHinting(computeHinting(paint)); 1659 rec->setHinting(computeHinting(paint));
1646 1660
1647 rec->setLuminanceColor(computeLuminanceColor(paint)); 1661 rec->setLuminanceColor(computeLuminanceColor(paint));
1648 1662
1649 if (NULL == deviceProperties) { 1663 if (NULL == deviceProperties) {
1650 rec->setDeviceGamma(SK_GAMMA_EXPONENT); 1664 rec->setDeviceGamma(SK_GAMMA_EXPONENT);
1651 rec->setPaintGamma(SK_GAMMA_EXPONENT); 1665 rec->setPaintGamma(SK_GAMMA_EXPONENT);
1652 } else { 1666 } else {
1653 rec->setDeviceGamma(deviceProperties->fGamma); 1667 rec->setDeviceGamma(deviceProperties->getGamma());
1654 1668
1655 //For now always set the paint gamma equal to the device gamma. 1669 //For now always set the paint gamma equal to the device gamma.
1656 //The math in SkMaskGamma can handle them being different, 1670 //The math in SkMaskGamma can handle them being different,
1657 //but it requires superluminous masks when 1671 //but it requires superluminous masks when
1658 //Ex : deviceGamma(x) < paintGamma(x) and x is sufficiently large. 1672 //Ex : deviceGamma(x) < paintGamma(x) and x is sufficiently large.
1659 rec->setPaintGamma(deviceProperties->fGamma); 1673 rec->setPaintGamma(deviceProperties->getGamma());
1660 } 1674 }
1661 1675
1662 #ifdef SK_GAMMA_CONTRAST 1676 #ifdef SK_GAMMA_CONTRAST
1663 rec->setContrast(SK_GAMMA_CONTRAST); 1677 rec->setContrast(SK_GAMMA_CONTRAST);
1664 #else 1678 #else
1665 /** 1679 /**
1666 * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise. 1680 * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise.
1667 * With lower values small text appears washed out (though correctly so). 1681 * With lower values small text appears washed out (though correctly so).
1668 * With higher values lcd fringing is worse and the smoothing effect of 1682 * With higher values lcd fringing is worse and the smoothing effect of
1669 * partial coverage is diminished. 1683 * partial coverage is diminished.
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 F_UNREF(Looper, readDrawLooper); 2684 F_UNREF(Looper, readDrawLooper);
2671 F_UNREF(ImageFilter, readImageFilter); 2685 F_UNREF(ImageFilter, readImageFilter);
2672 F(Typeface, readTypeface); 2686 F(Typeface, readTypeface);
2673 #undef F 2687 #undef F
2674 #undef F_UNREF 2688 #undef F_UNREF
2675 if (dirty & kAnnotation_DirtyBit) { 2689 if (dirty & kAnnotation_DirtyBit) {
2676 paint->setAnnotation(SkAnnotation::Create(buffer))->unref(); 2690 paint->setAnnotation(SkAnnotation::Create(buffer))->unref();
2677 } 2691 }
2678 SkASSERT(dirty == paint->fDirtyBits); 2692 SkASSERT(dirty == paint->fDirtyBits);
2679 } 2693 }
OLDNEW
« no previous file with comments | « src/core/SkDeviceProperties.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698