OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "ui/gfx/skia_color_space_util.h" | 5 #include "ui/gfx/skia_color_space_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 fn->fA = 1; | 417 fn->fA = 1; |
418 fn->fB = 0; | 418 fn->fB = 0; |
419 fn->fC = 1; | 419 fn->fC = 1; |
420 fn->fD = 0; | 420 fn->fD = 0; |
421 fn->fE = 0; | 421 fn->fE = 0; |
422 fn->fF = 0; | 422 fn->fF = 0; |
423 fn->fG = 1; | 423 fn->fG = 1; |
424 return false; | 424 return false; |
425 } | 425 } |
426 | 426 |
427 bool GFX_EXPORT SkApproximateTransferFn(sk_sp<SkICC> sk_icc, | 427 bool SkApproximateTransferFn(sk_sp<SkICC> sk_icc, |
428 float* max_error, | 428 float* max_error, |
429 SkColorSpaceTransferFn* fn) { | 429 SkColorSpaceTransferFn* fn) { |
430 SkICC::Tables tables; | 430 SkICC::Tables tables; |
431 bool got_tables = sk_icc->rawTransferFnData(&tables); | 431 bool got_tables = sk_icc->rawTransferFnData(&tables); |
432 if (!got_tables) | 432 if (!got_tables) |
433 return false; | 433 return false; |
434 | 434 |
435 // Merge all channels' tables into a single array. | 435 // Merge all channels' tables into a single array. |
436 SkICC::Channel* channels[3] = {&tables.fGreen, &tables.fRed, &tables.fBlue}; | 436 SkICC::Channel* channels[3] = {&tables.fGreen, &tables.fRed, &tables.fBlue}; |
437 std::vector<float> x; | 437 std::vector<float> x; |
438 std::vector<float> t; | 438 std::vector<float> t; |
439 for (size_t c = 0; c < 3; ++c) { | 439 for (size_t c = 0; c < 3; ++c) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 float identity_value = i == j ? 1 : 0; | 471 float identity_value = i == j ? 1 : 0; |
472 float value = m.get(i, j); | 472 float value = m.get(i, j); |
473 if (std::abs(identity_value - value) > kEpsilon) | 473 if (std::abs(identity_value - value) > kEpsilon) |
474 return false; | 474 return false; |
475 } | 475 } |
476 } | 476 } |
477 return true; | 477 return true; |
478 } | 478 } |
479 | 479 |
480 } // namespace gfx | 480 } // namespace gfx |
OLD | NEW |