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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 and contrast to be ignored, and the | 71 * Causes the luminance color and contrast to be ignored, and the |
72 * paint and device gamma to be effectively 1.0. | 72 * paint and device gamma to be effectively 1.0. |
73 */ | 73 */ |
74 void ignorePreBlend() { | 74 void ignorePreBlend(bool keepContrast) { |
75 setLuminanceColor(SK_ColorTRANSPARENT); | 75 setLuminanceColor(SK_ColorTRANSPARENT); |
76 setPaintGamma(SK_Scalar1); | 76 setPaintGamma(SK_Scalar1); |
77 setDeviceGamma(SK_Scalar1); | 77 setDeviceGamma(SK_Scalar1); |
78 setContrast(0); | 78 if (!keepContrast) { |
| 79 setContrast(0); |
| 80 } |
79 } | 81 } |
80 | 82 |
81 uint8_t fMaskFormat; | 83 uint8_t fMaskFormat; |
82 uint8_t fStrokeJoin : 4; | 84 uint8_t fStrokeJoin : 4; |
83 uint8_t fStrokeCap : 4; | 85 uint8_t fStrokeCap : 4; |
84 uint16_t fFlags; | 86 uint16_t fFlags; |
85 // Warning: when adding members note that the size of this structure | 87 // Warning: when adding members note that the size of this structure |
86 // must be a multiple of 4. SkDescriptor requires that its arguments be | 88 // 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 | 89 // multiples of four and this structure is put in an SkDescriptor in |
88 // SkPaint::MakeRec. | 90 // SkPaint::MakeRec. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return static_cast<SkPaint::Hinting>(hint); | 362 return static_cast<SkPaint::Hinting>(hint); |
361 } | 363 } |
362 | 364 |
363 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { | 365 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { |
364 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | | 366 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | |
365 (hinting << SkScalerContext::kHinting_Shift); | 367 (hinting << SkScalerContext::kHinting_Shift); |
366 } | 368 } |
367 | 369 |
368 | 370 |
369 #endif | 371 #endif |
OLD | NEW |