OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 SkSurfaceProps_DEFINED | 8 #ifndef SkSurfaceProps_DEFINED |
9 #define SkSurfaceProps_DEFINED | 9 #define SkSurfaceProps_DEFINED |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 * Describes properties and constraints of a given SkSurface. The rendering eng
ine can parse these | 47 * Describes properties and constraints of a given SkSurface. The rendering eng
ine can parse these |
48 * during drawing, and can sometimes optimize its performance (e.g. disabling a
n expensive | 48 * during drawing, and can sometimes optimize its performance (e.g. disabling a
n expensive |
49 * feature). | 49 * feature). |
50 */ | 50 */ |
51 class SK_API SkSurfaceProps { | 51 class SK_API SkSurfaceProps { |
52 public: | 52 public: |
53 enum Flags { | 53 enum Flags { |
54 kDisallowAntiAlias_Flag = 1 << 0, | 54 kDisallowAntiAlias_Flag = 1 << 0, |
55 kDisallowDither_Flag = 1 << 1, | 55 kDisallowDither_Flag = 1 << 1, |
56 kUseDeviceIndependentFonts_Flag = 1 << 2, | 56 kUseDeviceIndependentFonts_Flag = 1 << 2, |
57 | |
58 /** | |
59 * This flag causes sRGB inputs to the color pipeline (images and other
sRGB-tagged | |
60 * colors) to be gamma-corrected (converted to linear) before use. With
out this flag, | |
61 * texture scaling and filtering is not gamma correct, preserving the b
ehavior of Skia | |
62 * up through 2015. | |
63 * | |
64 * It is recommended to enable this flag when rendering to an sRGB or f
loating point | |
65 * surface. | |
66 */ | |
67 kGammaCorrect_Flag = 1 << 3, | |
68 }; | 57 }; |
69 /** Deprecated alias used by Chromium. Will be removed. */ | 58 /** Deprecated alias used by Chromium. Will be removed. */ |
70 static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_
Flag; | 59 static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_
Flag; |
71 | 60 |
72 SkSurfaceProps(uint32_t flags, SkPixelGeometry); | 61 SkSurfaceProps(uint32_t flags, SkPixelGeometry); |
73 | 62 |
74 enum InitType { | 63 enum InitType { |
75 kLegacyFontHost_InitType | 64 kLegacyFontHost_InitType |
76 }; | 65 }; |
77 SkSurfaceProps(InitType); | 66 SkSurfaceProps(InitType); |
78 SkSurfaceProps(uint32_t flags, InitType); | 67 SkSurfaceProps(uint32_t flags, InitType); |
79 SkSurfaceProps(const SkSurfaceProps& other); | 68 SkSurfaceProps(const SkSurfaceProps& other); |
80 | 69 |
81 uint32_t flags() const { return fFlags; } | 70 uint32_t flags() const { return fFlags; } |
82 SkPixelGeometry pixelGeometry() const { return fPixelGeometry; } | 71 SkPixelGeometry pixelGeometry() const { return fPixelGeometry; } |
83 | 72 |
84 bool isDisallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag
); } | 73 bool isDisallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag
); } |
85 bool isDisallowDither() const { return SkToBool(fFlags & kDisallowDither_Fla
g); } | 74 bool isDisallowDither() const { return SkToBool(fFlags & kDisallowDither_Fla
g); } |
86 bool isUseDeviceIndependentFonts() const { | 75 bool isUseDeviceIndependentFonts() const { |
87 return SkToBool(fFlags & kUseDeviceIndependentFonts_Flag); | 76 return SkToBool(fFlags & kUseDeviceIndependentFonts_Flag); |
88 } | 77 } |
89 bool isGammaCorrect() const { return SkToBool(fFlags & kGammaCorrect_Flag);
} | |
90 | 78 |
91 private: | 79 private: |
92 SkSurfaceProps(); | 80 SkSurfaceProps(); |
93 | 81 |
94 uint32_t fFlags; | 82 uint32_t fFlags; |
95 SkPixelGeometry fPixelGeometry; | 83 SkPixelGeometry fPixelGeometry; |
96 }; | 84 }; |
97 | 85 |
98 #endif | 86 #endif |
OLD | NEW |