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

Unified Diff: ui/gfx/color_utils.cc

Issue 11418280: Remove unused function from color_utils. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/color_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_utils.cc
diff --git a/ui/gfx/color_utils.cc b/ui/gfx/color_utils.cc
index 027bc784bf0a18437bc6b034a9b3b3c5928ed2d8..07980d84d8c2cc37d832e3efe3e303a9afd10362 100644
--- a/ui/gfx/color_utils.cc
+++ b/ui/gfx/color_utils.cc
@@ -190,58 +190,6 @@ SkColor HSLShift(SkColor color, const HSL& shift) {
static_cast<int>(b));
}
-bool IsColorCloseToTransparent(SkAlpha alpha) {
- const int kCloseToBoundary = 64;
- return alpha < kCloseToBoundary;
-}
-
-bool IsColorCloseToGrey(int r, int g, int b) {
- const int kAverageBoundary = 15;
- int average = (r + g + b) / 3;
- return (abs(r - average) < kAverageBoundary) &&
- (abs(g - average) < kAverageBoundary) &&
- (abs(b - average) < kAverageBoundary);
-}
-
-SkColor GetAverageColorOfFavicon(SkBitmap* favicon, SkAlpha alpha) {
- int r = 0, g = 0, b = 0;
-
- SkAutoLockPixels favicon_lock(*favicon);
- SkColor* pixels = static_cast<SkColor*>(favicon->getPixels());
- if (!pixels)
- return SkColorSetARGB(alpha, 0, 0, 0);
-
- // Assume ARGB_8888 format.
- DCHECK(favicon->config() == SkBitmap::kARGB_8888_Config);
- SkColor* current_color = pixels;
-
- DCHECK(favicon->width() <= 16 && favicon->height() <= 16);
-
- int pixel_count = favicon->width() * favicon->height();
- int color_count = 0;
- for (int i = 0; i < pixel_count; ++i, ++current_color) {
- // Disregard this color if it is close to black, close to white, or close
- // to transparent since any of those pixels do not contribute much to the
- // color makeup of this icon.
- int cr = SkColorGetR(*current_color);
- int cg = SkColorGetG(*current_color);
- int cb = SkColorGetB(*current_color);
-
- if (IsColorCloseToTransparent(SkColorGetA(*current_color)) ||
- IsColorCloseToGrey(cr, cg, cb))
- continue;
-
- r += cr;
- g += cg;
- b += cb;
- ++color_count;
- }
-
- return color_count ?
- SkColorSetARGB(alpha, r / color_count, g / color_count, b / color_count) :
- SkColorSetARGB(alpha, 0, 0, 0);
-}
-
void BuildLumaHistogram(const SkBitmap& bitmap, int histogram[256]) {
SkAutoLockPixels bitmap_lock(bitmap);
if (!bitmap.getPixels())
« no previous file with comments | « ui/gfx/color_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698