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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 2893083002: cc: Move SkShader construction to a single spot in PaintShader (Closed)
Patch Set: update Created 3 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
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/views/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return GetLayoutInsets(TAB).left() - 0.5f; 111 return GetLayoutInsets(TAB).left() - 0.5f;
112 } 112 }
113 113
114 void DrawHighlight(gfx::Canvas* canvas, 114 void DrawHighlight(gfx::Canvas* canvas,
115 const SkPoint& p, 115 const SkPoint& p,
116 SkScalar radius, 116 SkScalar radius,
117 SkColor color) { 117 SkColor color) {
118 const SkColor colors[2] = { color, SkColorSetA(color, 0) }; 118 const SkColor colors[2] = { color, SkColorSetA(color, 0) };
119 cc::PaintFlags flags; 119 cc::PaintFlags flags;
120 flags.setAntiAlias(true); 120 flags.setAntiAlias(true);
121 flags.setShader(cc::WrapSkShader(SkGradientShader::MakeRadial( 121 flags.setShader(base::MakeUnique<cc::PaintShader>(
122 p, radius, colors, nullptr, 2, SkShader::kClamp_TileMode))); 122 p, radius, colors, nullptr, 2, SkShader::kClamp_TileMode));
123 canvas->sk_canvas()->drawRect( 123 canvas->sk_canvas()->drawRect(
124 SkRect::MakeXYWH(p.x() - radius, p.y() - radius, radius * 2, radius * 2), 124 SkRect::MakeXYWH(p.x() - radius, p.y() - radius, radius * 2, radius * 2),
125 flags); 125 flags);
126 } 126 }
127 127
128 // Returns whether the favicon for the given URL should be colored according to 128 // Returns whether the favicon for the given URL should be colored according to
129 // the browser theme. 129 // the browser theme.
130 bool ShouldThemifyFaviconForUrl(const GURL& url) { 130 bool ShouldThemifyFaviconForUrl(const GURL& url) {
131 return url.SchemeIs(content::kChromeUIScheme) && 131 return url.SchemeIs(content::kChromeUIScheme) &&
132 url.host() != chrome::kChromeUIHelpHost && 132 url.host() != chrome::kChromeUIHelpHost &&
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 1445
1446 // Extends the area to the bottom when the crash animation is in progress. 1446 // Extends the area to the bottom when the crash animation is in progress.
1447 if (crash_icon_animation_->is_animating()) 1447 if (crash_icon_animation_->is_animating())
1448 bounds.set_height(height() - bounds.y()); 1448 bounds.set_height(height() - bounds.y());
1449 bounds.set_x(GetMirroredXForRect(bounds)); 1449 bounds.set_x(GetMirroredXForRect(bounds));
1450 SchedulePaintInRect(bounds); 1450 SchedulePaintInRect(bounds);
1451 } 1451 }
1452 1452
1453 Tab::BackgroundCache::BackgroundCache() = default; 1453 Tab::BackgroundCache::BackgroundCache() = default;
1454 Tab::BackgroundCache::~BackgroundCache() = default; 1454 Tab::BackgroundCache::~BackgroundCache() = default;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698