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

Side by Side Diff: chrome/browser/thumbnails/content_analysis_unittest.cc

Issue 1545223002: Switch to standard integer types in chrome/browser/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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 unified diff | Download patch
OLDNEW
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 <stddef.h>
8 #include <stdint.h>
9
7 #include <algorithm> 10 #include <algorithm>
8 #include <cmath> 11 #include <cmath>
9 #include <cstdlib> 12 #include <cstdlib>
10 #include <functional> 13 #include <functional>
11 #include <limits> 14 #include <limits>
12 #include <numeric> 15 #include <numeric>
13 #include <vector> 16 #include <vector>
14 17
15 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
16 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 11 matching lines...) Expand all
28 #ifndef M_PI 31 #ifndef M_PI
29 #define M_PI 3.14159265358979323846 32 #define M_PI 3.14159265358979323846
30 #endif 33 #endif
31 34
32 unsigned long ImagePixelSum(const SkBitmap& bitmap, const gfx::Rect& rect) { 35 unsigned long ImagePixelSum(const SkBitmap& bitmap, const gfx::Rect& rect) {
33 // Get the sum of pixel values in the rectangle. Applicable only to 36 // Get the sum of pixel values in the rectangle. Applicable only to
34 // monochrome bitmaps. 37 // monochrome bitmaps.
35 DCHECK_EQ(kAlpha_8_SkColorType, bitmap.colorType()); 38 DCHECK_EQ(kAlpha_8_SkColorType, bitmap.colorType());
36 unsigned long total = 0; 39 unsigned long total = 0;
37 for (int r = rect.y(); r < rect.bottom(); ++r) { 40 for (int r = rect.y(); r < rect.bottom(); ++r) {
38 const uint8* row_data = static_cast<const uint8*>( 41 const uint8_t* row_data =
39 bitmap.getPixels()) + r * bitmap.rowBytes(); 42 static_cast<const uint8_t*>(bitmap.getPixels()) + r * bitmap.rowBytes();
40 for (int c = rect.x(); c < rect.right(); ++c) 43 for (int c = rect.x(); c < rect.right(); ++c)
41 total += row_data[c]; 44 total += row_data[c];
42 } 45 }
43 46
44 return total; 47 return total;
45 } 48 }
46 49
47 bool CompareImageFragments(const SkBitmap& bitmap_left, 50 bool CompareImageFragments(const SkBitmap& bitmap_left,
48 const SkBitmap& bitmap_right, 51 const SkBitmap& bitmap_right,
49 const gfx::Size& comparison_area, 52 const gfx::Size& comparison_area,
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 679
677 int histogram[256] = {}; 680 int histogram[256] = {};
678 color_utils::BuildLumaHistogram(result, histogram); 681 color_utils::BuildLumaHistogram(result, histogram);
679 int non_zero_color_count = std::count_if( 682 int non_zero_color_count = std::count_if(
680 histogram, histogram + 256, [](int value) { return value > 0; }); 683 histogram, histogram + 256, [](int value) { return value > 0; });
681 EXPECT_GT(non_zero_color_count, 4); 684 EXPECT_GT(non_zero_color_count, 4);
682 685
683 } 686 }
684 687
685 } // namespace thumbnailing_utils 688 } // namespace thumbnailing_utils
OLDNEW
« no previous file with comments | « chrome/browser/thumbnails/content_analysis.cc ('k') | chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698