| 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 "chrome/browser/thumbnails/content_analysis.h" | 5 #include "chrome/browser/thumbnails/content_analysis.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <cstdlib> | 9 #include <cstdlib> |
| 10 #include <functional> | 10 #include <functional> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <numeric> | 12 #include <numeric> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
| 18 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
| 19 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 20 #include "ui/gfx/color_analysis.h" | 20 #include "ui/gfx/color_analysis.h" |
| 21 #include "ui/gfx/color_utils.h" | 21 #include "ui/gfx/color_utils.h" |
| 22 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
| 23 #include "ui/gfx/geometry/size.h" |
| 23 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
| 24 #include "ui/gfx/size.h" | |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 #ifndef M_PI | 28 #ifndef M_PI |
| 29 #define M_PI 3.14159265358979323846 | 29 #define M_PI 3.14159265358979323846 |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 unsigned long ImagePixelSum(const SkBitmap& bitmap, const gfx::Rect& rect) { | 32 unsigned long ImagePixelSum(const SkBitmap& bitmap, const gfx::Rect& rect) { |
| 33 // Get the sum of pixel values in the rectangle. Applicable only to | 33 // Get the sum of pixel values in the rectangle. Applicable only to |
| 34 // monochrome bitmaps. | 34 // monochrome bitmaps. |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 701 |
| 702 int histogram[256] = {}; | 702 int histogram[256] = {}; |
| 703 color_utils::BuildLumaHistogram(result, histogram); | 703 color_utils::BuildLumaHistogram(result, histogram); |
| 704 int non_zero_color_count = std::count_if( | 704 int non_zero_color_count = std::count_if( |
| 705 histogram, histogram + 256, std::bind2nd(std::greater<int>(), 0)); | 705 histogram, histogram + 256, std::bind2nd(std::greater<int>(), 0)); |
| 706 EXPECT_GT(non_zero_color_count, 4); | 706 EXPECT_GT(non_zero_color_count, 4); |
| 707 | 707 |
| 708 } | 708 } |
| 709 | 709 |
| 710 } // namespace thumbnailing_utils | 710 } // namespace thumbnailing_utils |
| OLD | NEW |