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

Side by Side Diff: chrome/browser/ui/extensions/icon_with_badge_image_source.cc

Issue 1834293003: [Extensions UI] Tweak the constants for extension action grayscaling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/extensions/icon_with_badge_image_source.h" 5 #include "chrome/browser/ui/extensions/icon_with_badge_image_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (icon_.IsEmpty()) 131 if (icon_.IsEmpty())
132 return; 132 return;
133 133
134 gfx::ImageSkia skia = icon_.AsImageSkia(); 134 gfx::ImageSkia skia = icon_.AsImageSkia();
135 gfx::ImageSkiaRep rep = skia.GetRepresentation(canvas->image_scale()); 135 gfx::ImageSkiaRep rep = skia.GetRepresentation(canvas->image_scale());
136 if (rep.scale() != canvas->image_scale()) { 136 if (rep.scale() != canvas->image_scale()) {
137 skia.AddRepresentation(ScaleImageSkiaRep( 137 skia.AddRepresentation(ScaleImageSkiaRep(
138 rep, ExtensionAction::ActionIconSize(), canvas->image_scale())); 138 rep, ExtensionAction::ActionIconSize(), canvas->image_scale()));
139 } 139 }
140 if (grayscale_) 140 if (grayscale_)
141 skia = gfx::ImageSkiaOperations::CreateHSLShiftedImage(skia, {-1, 0, 0.6}); 141 skia = gfx::ImageSkiaOperations::CreateHSLShiftedImage(skia, {-1, 0, 0.75});
142 142
143 int x_offset = 143 int x_offset =
144 std::floor((size().width() - ExtensionAction::ActionIconSize()) / 2.0); 144 std::floor((size().width() - ExtensionAction::ActionIconSize()) / 2.0);
145 int y_offset = 145 int y_offset =
146 std::floor((size().height() - ExtensionAction::ActionIconSize()) / 2.0); 146 std::floor((size().height() - ExtensionAction::ActionIconSize()) / 2.0);
147 canvas->DrawImageInt(skia, x_offset, y_offset); 147 canvas->DrawImageInt(skia, x_offset, y_offset);
148 148
149 // Draw a badge on the provided browser action icon's canvas. 149 // Draw a badge on the provided browser action icon's canvas.
150 PaintBadge(canvas); 150 PaintBadge(canvas);
151 151
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 290
291 void IconWithBadgeImageSource::PaintBlockedActionDecoration( 291 void IconWithBadgeImageSource::PaintBlockedActionDecoration(
292 gfx::Canvas* canvas) { 292 gfx::Canvas* canvas) {
293 canvas->Save(); 293 canvas->Save();
294 gfx::ImageSkia img = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 294 gfx::ImageSkia img = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
295 IDR_BLOCKED_EXTENSION_SCRIPT); 295 IDR_BLOCKED_EXTENSION_SCRIPT);
296 canvas->DrawImageInt(img, size().width() - img.width(), 0); 296 canvas->DrawImageInt(img, size().width() - img.width(), 0);
297 canvas->Restore(); 297 canvas->Restore();
298 } 298 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698