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

Side by Side Diff: ui/gfx/color_transform.h

Issue 2697253002: color: Add support for shader generation (Closed)
Patch Set: More bits of precision Created 3 years, 10 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
« no previous file with comments | « cc/output/shader.cc ('k') | ui/gfx/color_transform.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_COLOR_TRANSFORM_H_ 5 #ifndef UI_GFX_COLOR_TRANSFORM_H_
6 #define UI_GFX_COLOR_TRANSFORM_H_ 6 #define UI_GFX_COLOR_TRANSFORM_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/gfx/color_space.h" 9 #include "ui/gfx/color_space.h"
10 #include "ui/gfx/geometry/point3_f.h" 10 #include "ui/gfx/geometry/point3_f.h"
11 #include "ui/gfx/gfx_export.h" 11 #include "ui/gfx/gfx_export.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 class GFX_EXPORT ColorTransform { 15 class GFX_EXPORT ColorTransform {
16 public: 16 public:
17 enum class Intent { INTENT_ABSOLUTE, INTENT_PERCEPTUAL, TEST_NO_OPT }; 17 enum class Intent { INTENT_ABSOLUTE, INTENT_PERCEPTUAL, TEST_NO_OPT };
18 18
19 // TriStimulus is a color coordinate in any color space. 19 // TriStimulus is a color coordinate in any color space.
20 // Channel order is XYZ, RGB or YUV. 20 // Channel order is XYZ, RGB or YUV.
21 typedef Point3F TriStim; 21 typedef Point3F TriStim;
22 22
23 ColorTransform(); 23 ColorTransform();
24 virtual ~ColorTransform(); 24 virtual ~ColorTransform();
25 virtual gfx::ColorSpace GetSrcColorSpace() const = 0;
26 virtual gfx::ColorSpace GetDstColorSpace() const = 0;
25 27
26 // Perform transformation of colors, |colors| is both input and output. 28 // Perform transformation of colors, |colors| is both input and output.
27 virtual void Transform(TriStim* colors, size_t num) = 0; 29 virtual void Transform(TriStim* colors, size_t num) const = 0;
30
31 // Return GLSL shader source that defines a function DoColorConversion that
32 // converts a vec3 according to this transform.
33 virtual bool CanGetShaderSource() const = 0;
34 virtual std::string GetShaderSource() const = 0;
35
36 // Returns true if this transform is the identity.
37 virtual bool IsIdentity() const = 0;
28 38
29 virtual size_t NumberOfStepsForTesting() const = 0; 39 virtual size_t NumberOfStepsForTesting() const = 0;
30 40
31 static std::unique_ptr<ColorTransform> NewColorTransform( 41 static std::unique_ptr<ColorTransform> NewColorTransform(
32 const ColorSpace& from, 42 const ColorSpace& from,
33 const ColorSpace& to, 43 const ColorSpace& to,
34 Intent intent); 44 Intent intent);
35 45
36 private: 46 private:
37 DISALLOW_COPY_AND_ASSIGN(ColorTransform); 47 DISALLOW_COPY_AND_ASSIGN(ColorTransform);
38 }; 48 };
39 49
40 } // namespace gfx 50 } // namespace gfx
41 51
42 #endif // UI_GFX_COLOR_TRANSFORM_H_ 52 #endif // UI_GFX_COLOR_TRANSFORM_H_
OLDNEW
« no previous file with comments | « cc/output/shader.cc ('k') | ui/gfx/color_transform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698