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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/color_transform.h
diff --git a/ui/gfx/color_transform.h b/ui/gfx/color_transform.h
index 1d99617716e6d7bc5156ca64263a46011b88354d..cd23aa1caaed131cf8ab7a9750aafc49c5516342 100644
--- a/ui/gfx/color_transform.h
+++ b/ui/gfx/color_transform.h
@@ -5,8 +5,8 @@
#ifndef UI_GFX_COLOR_TRANSFORM_H_
#define UI_GFX_COLOR_TRANSFORM_H_
+#include <list>
#include <memory>
-#include <stdint.h>
#include "build/build_config.h"
#include "ui/gfx/color_space.h"
@@ -18,24 +18,36 @@ namespace gfx {
class GFX_EXPORT ColorTransform {
public:
enum class Intent { INTENT_ABSOLUTE, INTENT_PERCEPTUAL, TEST_NO_OPT };
+ class Step;
// TriStimulus is a color coordinate in any color space.
// Channel order is XYZ, RGB or YUV.
typedef Point3F TriStim;
- virtual ~ColorTransform() {}
+ ~ColorTransform();
// Perform transformation of colors, |colors| is both input and output.
- virtual void transform(TriStim* colors, size_t num) = 0;
+ 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
static std::unique_ptr<ColorTransform> NewColorTransform(
const ColorSpace& from,
const ColorSpace& to,
Intent intent);
- static float ToLinearForTesting(ColorSpace::TransferID id, float v);
- static float FromLinearForTesting(ColorSpace::TransferID id, float v);
+ size_t NumberOfStepsForTesting() { return steps_.size(); }
+
+ private:
+ typedef std::list<std::unique_ptr<Step>> StepList;
+ StepList steps_;
+
+ ColorTransform(StepList);
+ static void Append(ColorSpace from,
+ const ColorSpace& to,
+ ColorTransform::Intent intent,
+ StepList* builder);
+ static void Simplify(StepList* steps);
};
+
} // namespace gfx
#endif // UI_GFX_COLOR_TRANSFORM_H_
« 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