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

Side by Side Diff: ui/views/shadow_border.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 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 | « ui/views/round_rect_painter.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/shadow_border.h" 5 #include "ui/views/shadow_border.h"
6 6
7 #include "third_party/skia/include/core/SkDrawLooper.h" 7 #include "third_party/skia/include/core/SkDrawLooper.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/geometry/insets.h" 9 #include "ui/gfx/geometry/insets.h"
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
(...skipping 17 matching lines...) Expand all
28 shadow_value_(shadow), 28 shadow_value_(shadow),
29 insets_(GetInsetsFromShadowValue(shadow)) { 29 insets_(GetInsetsFromShadowValue(shadow)) {
30 } 30 }
31 31
32 ShadowBorder::~ShadowBorder() { 32 ShadowBorder::~ShadowBorder() {
33 } 33 }
34 34
35 // TODO(sidharthms): Re-painting a shadow looper on every paint call may yield 35 // TODO(sidharthms): Re-painting a shadow looper on every paint call may yield
36 // poor performance. Ideally we should be caching the border to bitmaps. 36 // poor performance. Ideally we should be caching the border to bitmaps.
37 void ShadowBorder::Paint(const views::View& view, gfx::Canvas* canvas) { 37 void ShadowBorder::Paint(const views::View& view, gfx::Canvas* canvas) {
38 SkPaint paint; 38 cc::PaintFlags paint;
39 std::vector<gfx::ShadowValue> shadows; 39 std::vector<gfx::ShadowValue> shadows;
40 shadows.push_back(shadow_value_); 40 shadows.push_back(shadow_value_);
41 paint.setLooper(gfx::CreateShadowDrawLooper(shadows)); 41 paint.setLooper(gfx::CreateShadowDrawLooper(shadows));
42 paint.setColor(SK_ColorTRANSPARENT); 42 paint.setColor(SK_ColorTRANSPARENT);
43 paint.setStrokeJoin(SkPaint::kRound_Join); 43 paint.setStrokeJoin(cc::PaintFlags::kRound_Join);
44 gfx::Rect bounds(view.size()); 44 gfx::Rect bounds(view.size());
45 bounds.Inset(-gfx::ShadowValue::GetMargin(shadows)); 45 bounds.Inset(-gfx::ShadowValue::GetMargin(shadows));
46 canvas->DrawRect(bounds, paint); 46 canvas->DrawRect(bounds, paint);
47 } 47 }
48 48
49 gfx::Insets ShadowBorder::GetInsets() const { 49 gfx::Insets ShadowBorder::GetInsets() const {
50 return insets_; 50 return insets_;
51 } 51 }
52 52
53 gfx::Size ShadowBorder::GetMinimumSize() const { 53 gfx::Size ShadowBorder::GetMinimumSize() const {
54 return gfx::Size(shadow_value_.blur(), shadow_value_.blur()); 54 return gfx::Size(shadow_value_.blur(), shadow_value_.blur());
55 } 55 }
56 56
57 } // namespace views 57 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/round_rect_painter.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698