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

Unified Diff: ui/gfx/color_space.cc

Issue 2696603003: color: Towards ColorTransform optimizations and code generation (Closed)
Patch Set: Keep fixing the windows build 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
« no previous file with comments | « ui/gfx/color_space.h ('k') | ui/gfx/color_transform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_space.cc
diff --git a/ui/gfx/color_space.cc b/ui/gfx/color_space.cc
index e0eb7b946dab4b43cafbea8b3e03265cf2756beb..0f5a42b601841ca529d42c456df504512c708914 100644
--- a/ui/gfx/color_space.cc
+++ b/ui/gfx/color_space.cc
@@ -10,30 +10,11 @@
#include "base/synchronization/lock.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "ui/gfx/icc_profile.h"
+#include "ui/gfx/skia_color_space_util.h"
#include "ui/gfx/transform.h"
namespace gfx {
-namespace {
-
-SkColorSpaceTransferFn InvertTransferFn(SkColorSpaceTransferFn fn) {
- SkColorSpaceTransferFn fn_inv = {0};
- if (fn.fA > 0 && fn.fG > 0) {
- double a_to_the_g = pow(fn.fA, fn.fG);
- fn_inv.fA = 1.f / a_to_the_g;
- fn_inv.fB = -fn.fE / a_to_the_g;
- fn_inv.fG = 1.f / fn.fG;
- }
- fn_inv.fD = fn.fC * fn.fD + fn.fF;
- fn_inv.fE = -fn.fB / fn.fA;
- if (fn.fC != 0) {
- fn_inv.fC = 1.f / fn.fC;
- fn_inv.fF = -fn.fF / fn.fC;
- }
- return fn_inv;
-}
-};
-
ColorSpace::PrimaryID ColorSpace::PrimaryIDFromInt(int primary_id) {
if (primary_id < 0 || primary_id > static_cast<int>(PrimaryID::LAST))
return PrimaryID::UNKNOWN;
@@ -486,7 +467,7 @@ bool ColorSpace::GetTransferFunction(SkColorSpaceTransferFn* fn) const {
bool ColorSpace::GetInverseTransferFunction(SkColorSpaceTransferFn* fn) const {
if (!GetTransferFunction(fn))
return false;
- *fn = InvertTransferFn(*fn);
+ *fn = SkTransferFnInverse(*fn);
return true;
}
« no previous file with comments | « ui/gfx/color_space.h ('k') | ui/gfx/color_transform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698