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

Side by Side Diff: src/core/SkScalerContext.h

Issue 1866293003: Decouple contrast boost from fake gamma. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
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 #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
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
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
OLDNEW
« src/core/SkPaint.cpp ('K') | « src/core/SkPaint.cpp ('k') | src/gpu/text/GrAtlasTextBlob.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698