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

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

Issue 2697253002: color: Add support for shader generation (Closed)
Patch Set: Rebase 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
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 25
26 // Perform transformation of colors, |colors| is both input and output. 26 // Perform transformation of colors, |colors| is both input and output.
27 virtual void Transform(TriStim* colors, size_t num) = 0; 27 virtual void Transform(TriStim* colors, size_t num) = 0;
28 28
29 // Return GLSL shader source that defines a function DoColorConversion that
30 // converts a vec3 according to this transform.
31 virtual bool CanGetShaderSource() const = 0;
32 virtual std::string GetShaderSource() const = 0;
33
34 // Returns true if this transform is the identity.
35 virtual bool IsIdentity() const = 0;
36
29 virtual size_t NumberOfStepsForTesting() const = 0; 37 virtual size_t NumberOfStepsForTesting() const = 0;
30 38
31 static std::unique_ptr<ColorTransform> NewColorTransform( 39 static std::unique_ptr<ColorTransform> NewColorTransform(
32 const ColorSpace& from, 40 const ColorSpace& from,
33 const ColorSpace& to, 41 const ColorSpace& to,
34 Intent intent); 42 Intent intent);
35 43
36 private: 44 private:
37 DISALLOW_COPY_AND_ASSIGN(ColorTransform); 45 DISALLOW_COPY_AND_ASSIGN(ColorTransform);
38 }; 46 };
39 47
40 } // namespace gfx 48 } // namespace gfx
41 49
42 #endif // UI_GFX_COLOR_TRANSFORM_H_ 50 #endif // UI_GFX_COLOR_TRANSFORM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698