| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/color_analysis.h" | 5 #include "ui/gfx/color_analysis.h" |
| 6 | 6 |
| 7 #include <limits.h> |
| 7 #include <stdint.h> | 8 #include <stdint.h> |
| 8 | 9 |
| 9 #include <algorithm> | 10 #include <algorithm> |
| 10 #include <limits> | 11 #include <limits> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
| 16 #include "third_party/skia/include/core/SkUnPreMultiply.h" | 17 #include "third_party/skia/include/core/SkUnPreMultiply.h" |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 gfx::Matrix3F covariance = ComputeColorCovariance(source_bitmap); | 576 gfx::Matrix3F covariance = ComputeColorCovariance(source_bitmap); |
| 576 gfx::Matrix3F eigenvectors = gfx::Matrix3F::Zeros(); | 577 gfx::Matrix3F eigenvectors = gfx::Matrix3F::Zeros(); |
| 577 gfx::Vector3dF eigenvals = covariance.SolveEigenproblem(&eigenvectors); | 578 gfx::Vector3dF eigenvals = covariance.SolveEigenproblem(&eigenvectors); |
| 578 gfx::Vector3dF principal = eigenvectors.get_column(0); | 579 gfx::Vector3dF principal = eigenvectors.get_column(0); |
| 579 if (eigenvals == gfx::Vector3dF() || principal == gfx::Vector3dF()) | 580 if (eigenvals == gfx::Vector3dF() || principal == gfx::Vector3dF()) |
| 580 return false; // This may happen for some edge cases. | 581 return false; // This may happen for some edge cases. |
| 581 return ApplyColorReduction(source_bitmap, principal, true, target_bitmap); | 582 return ApplyColorReduction(source_bitmap, principal, true, target_bitmap); |
| 582 } | 583 } |
| 583 | 584 |
| 584 } // color_utils | 585 } // color_utils |
| OLD | NEW |