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

Side by Side Diff: chrome/browser/chromeos/ui/focus_ring_layer.cc

Issue 2717943002: Fix cc/paint skia type mismatches (Closed)
Patch Set: Rebase Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/ui/focus_ring_layer.h" 5 #include "chrome/browser/chromeos/ui/focus_ring_layer.h"
6 6
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 #include "ui/compositor/compositor_animation_observer.h" 8 #include "ui/compositor/compositor_animation_observer.h"
9 #include "ui/compositor/layer.h" 9 #include "ui/compositor/layer.h"
10 #include "ui/compositor/paint_recorder.h" 10 #include "ui/compositor/paint_recorder.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 compositor_->AddAnimationObserver(this); 83 compositor_->AddAnimationObserver(this);
84 } 84 }
85 } 85 }
86 86
87 void FocusRingLayer::OnPaintLayer(const ui::PaintContext& context) { 87 void FocusRingLayer::OnPaintLayer(const ui::PaintContext& context) {
88 if (!root_window_ || focus_ring_.IsEmpty()) 88 if (!root_window_ || focus_ring_.IsEmpty())
89 return; 89 return;
90 90
91 ui::PaintRecorder recorder(context, layer_->size()); 91 ui::PaintRecorder recorder(context, layer_->size());
92 92
93 SkPaint paint; 93 cc::PaintFlags flags;
94 paint.setColor(kShadowColor); 94 flags.setAntiAlias(true);
95 paint.setFlags(SkPaint::kAntiAlias_Flag); 95 flags.setColor(kShadowColor);
96 paint.setStyle(SkPaint::kStroke_Style); 96 flags.setStyle(cc::PaintFlags::kStroke_Style);
97 paint.setStrokeWidth(2); 97 flags.setStrokeWidth(2);
98 98
99 gfx::Rect bounds = focus_ring_ - layer_->bounds().OffsetFromOrigin(); 99 gfx::Rect bounds = focus_ring_ - layer_->bounds().OffsetFromOrigin();
100 int r = kShadowRadius; 100 int r = kShadowRadius;
101 for (int i = 0; i < r; i++) { 101 for (int i = 0; i < r; i++) {
102 // Fade out alpha quadratically. 102 // Fade out alpha quadratically.
103 paint.setAlpha((kShadowAlpha * (r - i) * (r - i)) / (r * r)); 103 flags.setAlpha((kShadowAlpha * (r - i) * (r - i)) / (r * r));
104 gfx::Rect outsetRect = bounds; 104 gfx::Rect outsetRect = bounds;
105 outsetRect.Inset(-i, -i, -i, -i); 105 outsetRect.Inset(-i, -i, -i, -i);
106 recorder.canvas()->DrawRect(outsetRect, paint); 106 recorder.canvas()->DrawRect(outsetRect, flags);
107 } 107 }
108 } 108 }
109 109
110 void FocusRingLayer::OnDelegatedFrameDamage( 110 void FocusRingLayer::OnDelegatedFrameDamage(
111 const gfx::Rect& damage_rect_in_dip) { 111 const gfx::Rect& damage_rect_in_dip) {
112 } 112 }
113 113
114 void FocusRingLayer::OnDeviceScaleFactorChanged(float device_scale_factor) { 114 void FocusRingLayer::OnDeviceScaleFactorChanged(float device_scale_factor) {
115 if (delegate_) 115 if (delegate_)
116 delegate_->OnDeviceScaleFactorChanged(); 116 delegate_->OnDeviceScaleFactorChanged();
117 } 117 }
118 118
119 void FocusRingLayer::OnAnimationStep(base::TimeTicks timestamp) { 119 void FocusRingLayer::OnAnimationStep(base::TimeTicks timestamp) {
120 delegate_->OnAnimationStep(timestamp); 120 delegate_->OnAnimationStep(timestamp);
121 } 121 }
122 122
123 void FocusRingLayer::OnCompositingShuttingDown(ui::Compositor* compositor) { 123 void FocusRingLayer::OnCompositingShuttingDown(ui::Compositor* compositor) {
124 if (compositor == compositor_) { 124 if (compositor == compositor_) {
125 compositor->RemoveAnimationObserver(this); 125 compositor->RemoveAnimationObserver(this);
126 compositor_ = nullptr; 126 compositor_ = nullptr;
127 } 127 }
128 } 128 }
129 129
130 } // namespace chromeos 130 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698