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

Unified Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 1761183002: color_utils cleanup: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/bookmark_app_helper.cc
diff --git a/chrome/browser/extensions/bookmark_app_helper.cc b/chrome/browser/extensions/bookmark_app_helper.cc
index ccae49f4e9621269835de97fdc0fbc2e3862272d..1455d1f8bd52252278ed15be8ff16fab34c142e3 100644
--- a/chrome/browser/extensions/bookmark_app_helper.cc
+++ b/chrome/browser/extensions/bookmark_app_helper.cc
@@ -93,7 +93,7 @@ class GeneratedIconImageSource : public gfx::CanvasImageSource {
private:
// gfx::CanvasImageSource overrides:
void Draw(gfx::Canvas* canvas) override {
- const unsigned char kLuminanceThreshold = 190;
+ const uint8_t kLumaThreshold = 190;
const int icon_size = output_size_ * 3 / 4;
const int icon_inset = output_size_ / 8;
const size_t border_radius = output_size_ / 16;
@@ -117,12 +117,12 @@ class GeneratedIconImageSource : public gfx::CanvasImageSource {
// The text rect's size needs to be odd to center the text correctly.
gfx::Rect text_rect(icon_inset, icon_inset, icon_size + 1, icon_size + 1);
// Draw the letter onto the rounded rect. The letter's color depends on the
- // luminance of |color|.
- unsigned char luminance = color_utils::GetLuminanceForColor(color_);
+ // luma of |color|.
+ const uint8_t luma = color_utils::Luma(color_);
canvas->DrawStringRectWithFlags(
base::string16(1, std::toupper(letter_)),
gfx::FontList(gfx::Font(font_name, font_size)),
- luminance > kLuminanceThreshold ? SK_ColorBLACK : SK_ColorWHITE,
+ (luma > kLumaThreshold) ? SK_ColorBLACK : SK_ColorWHITE,
text_rect,
gfx::Canvas::TEXT_ALIGN_CENTER);
}

Powered by Google App Engine
This is Rietveld 408576698