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

Side by Side Diff: ui/app_list/views/tile_item_view.cc

Issue 289283004: Add ability to constrain dominant color selection to a HSL range. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make bounds inclusive, add saturation test Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/app_list/views/tile_item_view.h" 5 #include "ui/app_list/views/tile_item_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/app_list/app_list_constants.h" 8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/app_list_item.h" 9 #include "ui/app_list/app_list_item.h"
10 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 SetVisible(false); 98 SetVisible(false);
99 icon_->SetImage(NULL); 99 icon_->SetImage(NULL);
100 title_->SetText(base::string16()); 100 title_->SetText(base::string16());
101 return; 101 return;
102 } 102 }
103 103
104 SetVisible(true); 104 SetVisible(true);
105 icon_->SetImage(item_->icon()); 105 icon_->SetImage(item_->icon());
106 title_->SetText(base::UTF8ToUTF16(item_->name())); 106 title_->SetText(base::UTF8ToUTF16(item_->name()));
107 107
108 background_->set_strip_color( 108 color_utils::GridSampler sampler;
109 color_utils::CalculateKMeanColorOfBitmap(*item_->icon().bitmap())); 109 background_->set_strip_color(color_utils::CalculateKMeanColorOfPNG(
Matt Giuca 2014/05/22 05:03:52 Ew, please don't convert to a PNG just to get arou
calamity 2014/05/22 07:36:36 Added overload in precursor CL.
110 gfx::Image(item_->icon()).As1xPNGBytes(),
111 color_utils::HSL{-1, 0.3, 0.2},
112 color_utils::HSL{-1, 1, 0.8},
113 &sampler));
110 } 114 }
111 115
112 gfx::Size TileItemView::GetPreferredSize() { 116 gfx::Size TileItemView::GetPreferredSize() {
113 return gfx::Size(kTileSize, kTileSize); 117 return gfx::Size(kTileSize, kTileSize);
114 } 118 }
115 119
116 void TileItemView::ButtonPressed(views::Button* sender, 120 void TileItemView::ButtonPressed(views::Button* sender,
117 const ui::Event& event) { 121 const ui::Event& event) {
118 item_->Activate(event.flags()); 122 item_->Activate(event.flags());
119 } 123 }
120 124
121 } // namespace app_list 125 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698