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

Side by Side Diff: include/core/SkSurfaceProps.h

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase 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 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
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 kAllowSRGBInputs_Flag = 1 << 3,
57 }; 68 };
58 /** Deprecated alias used by Chromium. Will be removed. */ 69 /** Deprecated alias used by Chromium. Will be removed. */
59 static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_ Flag; 70 static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_ Flag;
60 71
61 SkSurfaceProps(uint32_t flags, SkPixelGeometry); 72 SkSurfaceProps(uint32_t flags, SkPixelGeometry);
62 73
63 enum InitType { 74 enum InitType {
64 kLegacyFontHost_InitType 75 kLegacyFontHost_InitType
65 }; 76 };
66 SkSurfaceProps(InitType); 77 SkSurfaceProps(InitType);
67 SkSurfaceProps(uint32_t flags, InitType); 78 SkSurfaceProps(uint32_t flags, InitType);
68 SkSurfaceProps(const SkSurfaceProps& other); 79 SkSurfaceProps(const SkSurfaceProps& other);
69 80
70 uint32_t flags() const { return fFlags; } 81 uint32_t flags() const { return fFlags; }
71 SkPixelGeometry pixelGeometry() const { return fPixelGeometry; } 82 SkPixelGeometry pixelGeometry() const { return fPixelGeometry; }
72 83
73 bool isDisallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag ); } 84 bool isDisallowAA() const { return SkToBool(fFlags & kDisallowAntiAlias_Flag ); }
74 bool isDisallowDither() const { return SkToBool(fFlags & kDisallowDither_Fla g); } 85 bool isDisallowDither() const { return SkToBool(fFlags & kDisallowDither_Fla g); }
75 bool isUseDeviceIndependentFonts() const { 86 bool isUseDeviceIndependentFonts() const {
76 return SkToBool(fFlags & kUseDeviceIndependentFonts_Flag); 87 return SkToBool(fFlags & kUseDeviceIndependentFonts_Flag);
77 } 88 }
89 bool allowSRGBInputs() const { return SkToBool(fFlags & kAllowSRGBInputs_Fla g); }
78 90
79 private: 91 private:
80 SkSurfaceProps(); 92 SkSurfaceProps();
81 93
82 uint32_t fFlags; 94 uint32_t fFlags;
83 SkPixelGeometry fPixelGeometry; 95 SkPixelGeometry fPixelGeometry;
84 }; 96 };
85 97
86 #endif 98 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698