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

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

Issue 2696603003: color: Towards ColorTransform optimizations and code generation (Closed)
Patch Set: Remove unneeded refactor 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 <list>
8 #include <memory> 9 #include <memory>
9 #include <stdint.h>
10 10
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "ui/gfx/color_space.h" 12 #include "ui/gfx/color_space.h"
13 #include "ui/gfx/geometry/point3_f.h" 13 #include "ui/gfx/geometry/point3_f.h"
14 #include "ui/gfx/gfx_export.h" 14 #include "ui/gfx/gfx_export.h"
15 15
16 namespace gfx { 16 namespace gfx {
17 17
18 class GFX_EXPORT ColorTransform { 18 class GFX_EXPORT ColorTransform {
19 public: 19 public:
20 enum class Intent { INTENT_ABSOLUTE, INTENT_PERCEPTUAL, TEST_NO_OPT }; 20 enum class Intent { INTENT_ABSOLUTE, INTENT_PERCEPTUAL, TEST_NO_OPT };
21 class Step;
21 22
22 // TriStimulus is a color coordinate in any color space. 23 // TriStimulus is a color coordinate in any color space.
23 // Channel order is XYZ, RGB or YUV. 24 // Channel order is XYZ, RGB or YUV.
24 typedef Point3F TriStim; 25 typedef Point3F TriStim;
25 26
26 virtual ~ColorTransform() {} 27 ~ColorTransform();
27 28
28 // Perform transformation of colors, |colors| is both input and output. 29 // Perform transformation of colors, |colors| is both input and output.
29 virtual void transform(TriStim* colors, size_t num) = 0; 30 void transform(TriStim* colors, size_t num);
hubbe 2017/02/13 22:03:18 I'm not a big fan of this, because it makes it imp
30 31
31 static std::unique_ptr<ColorTransform> NewColorTransform( 32 static std::unique_ptr<ColorTransform> NewColorTransform(
32 const ColorSpace& from, 33 const ColorSpace& from,
33 const ColorSpace& to, 34 const ColorSpace& to,
34 Intent intent); 35 Intent intent);
35 36
36 static float ToLinearForTesting(ColorSpace::TransferID id, float v); 37 size_t NumberOfStepsForTesting() { return steps_.size(); }
37 static float FromLinearForTesting(ColorSpace::TransferID id, float v); 38
39 private:
40 typedef std::list<std::unique_ptr<Step>> StepList;
41 StepList steps_;
42
43 ColorTransform(StepList);
44 static void Append(ColorSpace from,
45 const ColorSpace& to,
46 ColorTransform::Intent intent,
47 StepList* builder);
48 static void Simplify(StepList* steps);
38 }; 49 };
50
39 } // namespace gfx 51 } // namespace gfx
40 52
41 #endif // UI_GFX_COLOR_TRANSFORM_H_ 53 #endif // UI_GFX_COLOR_TRANSFORM_H_
OLDNEW
« no previous file with comments | « ui/gfx/color_space.cc ('k') | ui/gfx/color_transform.cc » ('j') | ui/gfx/color_transform.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698