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

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

Issue 382623002: SkBitmap::Config is no more, use SkColorType (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed some for chromeos and win Created 6 years, 5 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 | Annotate | Revision Log
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 <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <cstdlib> 9 #include <cstdlib>
10 #include <functional> 10 #include <functional>
(...skipping 14 matching lines...) Expand all
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.
35 DCHECK_EQ(SkBitmap::kA8_Config, bitmap.config()); 35 DCHECK_EQ(kAlpha_8_SkColorType, bitmap.colorType());
36 unsigned long total = 0; 36 unsigned long total = 0;
37 for (int r = rect.y(); r < rect.bottom(); ++r) { 37 for (int r = rect.y(); r < rect.bottom(); ++r) {
38 const uint8* row_data = static_cast<const uint8*>( 38 const uint8* row_data = static_cast<const uint8*>(
39 bitmap.getPixels()) + r * bitmap.rowBytes(); 39 bitmap.getPixels()) + r * bitmap.rowBytes();
40 for (int c = rect.x(); c < rect.right(); ++c) 40 for (int c = rect.x(); c < rect.right(); ++c)
41 total += row_data[c]; 41 total += row_data[c];
42 } 42 }
43 43
44 return total; 44 return total;
45 } 45 }
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/browser/thumbnails/content_analysis.cc ('k') | chrome/browser/ui/app_list/fast_show_pickler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698