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 #ifndef SkScalerContext_DEFINED | 8 #ifndef SkScalerContext_DEFINED |
9 #define SkScalerContext_DEFINED | 9 #define SkScalerContext_DEFINED |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 SkScalar getContrast() const { | 62 SkScalar getContrast() const { |
63 return SkIntToScalar(fContrast) / ((1 << 8) - 1); | 63 return SkIntToScalar(fContrast) / ((1 << 8) - 1); |
64 } | 64 } |
65 void setContrast(SkScalar c) { | 65 void setContrast(SkScalar c) { |
66 SkASSERT(0 <= c && c <= SK_Scalar1); | 66 SkASSERT(0 <= c && c <= SK_Scalar1); |
67 fContrast = SkScalarRoundToInt(c * ((1 << 8) - 1)); | 67 fContrast = SkScalarRoundToInt(c * ((1 << 8) - 1)); |
68 } | 68 } |
69 | 69 |
70 /** | 70 /** |
| 71 * Causes the luminance color to be ignored, and the paint and device |
| 72 * gamma to be effectively 1.0 |
| 73 */ |
| 74 void ignoreGamma() { |
| 75 setLuminanceColor(SK_ColorTRANSPARENT); |
| 76 setPaintGamma(SK_Scalar1); |
| 77 setDeviceGamma(SK_Scalar1); |
| 78 } |
| 79 |
| 80 /** |
71 * Causes the luminance color and contrast to be ignored, and the | 81 * Causes the luminance color and contrast to be ignored, and the |
72 * paint and device gamma to be effectively 1.0. | 82 * paint and device gamma to be effectively 1.0. |
73 */ | 83 */ |
74 void ignorePreBlend() { | 84 void ignorePreBlend() { |
75 setLuminanceColor(SK_ColorTRANSPARENT); | 85 ignoreGamma(); |
76 setPaintGamma(SK_Scalar1); | |
77 setDeviceGamma(SK_Scalar1); | |
78 setContrast(0); | 86 setContrast(0); |
79 } | 87 } |
80 | 88 |
81 uint8_t fMaskFormat; | 89 uint8_t fMaskFormat; |
82 uint8_t fStrokeJoin : 4; | 90 uint8_t fStrokeJoin : 4; |
83 uint8_t fStrokeCap : 4; | 91 uint8_t fStrokeCap : 4; |
84 uint16_t fFlags; | 92 uint16_t fFlags; |
85 // Warning: when adding members note that the size of this structure | 93 // Warning: when adding members note that the size of this structure |
86 // must be a multiple of 4. SkDescriptor requires that its arguments be | 94 // must be a multiple of 4. SkDescriptor requires that its arguments be |
87 // multiples of four and this structure is put in an SkDescriptor in | 95 // multiples of four and this structure is put in an SkDescriptor in |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return static_cast<SkPaint::Hinting>(hint); | 368 return static_cast<SkPaint::Hinting>(hint); |
361 } | 369 } |
362 | 370 |
363 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { | 371 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { |
364 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | | 372 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | |
365 (hinting << SkScalerContext::kHinting_Shift); | 373 (hinting << SkScalerContext::kHinting_Shift); |
366 } | 374 } |
367 | 375 |
368 | 376 |
369 #endif | 377 #endif |
OLD | NEW |