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

Unified Diff: chrome/browser/chromeos/ui/focus_ring_layer.cc

Issue 1066113002: chromeos: Use a PaintRecorder to access the Canvas for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/ui/accessibility_focus_ring_layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/ui/focus_ring_layer.cc
diff --git a/chrome/browser/chromeos/ui/focus_ring_layer.cc b/chrome/browser/chromeos/ui/focus_ring_layer.cc
index c0ca65fe7990d8cb3106fe58b08e8d0013ce67ea..745eb8708f14fd773b6fc3f59eb7249a49efa2ba 100644
--- a/chrome/browser/chromeos/ui/focus_ring_layer.cc
+++ b/chrome/browser/chromeos/ui/focus_ring_layer.cc
@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
-#include "ui/compositor/paint_context.h"
+#include "ui/compositor/paint_recorder.h"
#include "ui/gfx/canvas.h"
namespace chromeos {
@@ -61,20 +61,22 @@ void FocusRingLayer::OnPaintLayer(const ui::PaintContext& context) {
if (!root_window_ || focus_ring_.IsEmpty())
return;
- gfx::Canvas* canvas = context.canvas();
- gfx::Rect bounds = focus_ring_ - layer_->bounds().OffsetFromOrigin();
+ ui::PaintRecorder recorder(context);
+
SkPaint paint;
paint.setColor(kShadowColor);
paint.setFlags(SkPaint::kAntiAlias_Flag);
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(2);
+
+ gfx::Rect bounds = focus_ring_ - layer_->bounds().OffsetFromOrigin();
int r = kShadowRadius;
for (int i = 0; i < r; i++) {
// Fade out alpha quadratically.
paint.setAlpha((kShadowAlpha * (r - i) * (r - i)) / (r * r));
gfx::Rect outsetRect = bounds;
outsetRect.Inset(-i, -i, -i, -i);
- canvas->DrawRect(outsetRect, paint);
+ recorder.canvas()->DrawRect(outsetRect, paint);
}
}
« no previous file with comments | « chrome/browser/chromeos/ui/accessibility_focus_ring_layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698