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

Side by Side Diff: ash/common/system/tray/tray_background_view.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 | « ash/common/system/toast/toast_overlay.cc ('k') | ash/common/system/tray/tray_details_view.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 (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 "ash/common/system/tray/tray_background_view.h" 5 #include "ash/common/system/tray/tray_background_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 alpha_(0) {} 120 alpha_(0) {}
121 121
122 ~TrayBackground() override {} 122 ~TrayBackground() override {}
123 123
124 void set_alpha(int alpha) { alpha_ = alpha; } 124 void set_alpha(int alpha) { alpha_ = alpha; }
125 125
126 private: 126 private:
127 WmShelf* GetShelf() const { return tray_background_view_->shelf(); } 127 WmShelf* GetShelf() const { return tray_background_view_->shelf(); }
128 128
129 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const { 129 void PaintMaterial(gfx::Canvas* canvas, views::View* view) const {
130 SkPaint background_paint; 130 cc::PaintFlags background_paint;
131 background_paint.setFlags(SkPaint::kAntiAlias_Flag); 131 background_paint.setFlags(cc::PaintFlags::kAntiAlias_Flag);
132 background_paint.setColor(SkColorSetA(kShelfBaseColor, alpha_)); 132 background_paint.setColor(SkColorSetA(kShelfBaseColor, alpha_));
133 gfx::Insets insets = 133 gfx::Insets insets =
134 GetMirroredBackgroundInsets(GetShelf()->GetAlignment()); 134 GetMirroredBackgroundInsets(GetShelf()->GetAlignment());
135 gfx::Rect bounds = view->GetLocalBounds(); 135 gfx::Rect bounds = view->GetLocalBounds();
136 bounds.Inset(insets); 136 bounds.Inset(insets);
137 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, background_paint); 137 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, background_paint);
138 138
139 if (draws_active_ && tray_background_view_->is_active()) { 139 if (draws_active_ && tray_background_view_->is_active()) {
140 SkPaint highlight_paint; 140 cc::PaintFlags highlight_paint;
141 highlight_paint.setFlags(SkPaint::kAntiAlias_Flag); 141 highlight_paint.setFlags(cc::PaintFlags::kAntiAlias_Flag);
142 highlight_paint.setColor(kShelfButtonActivatedHighlightColor); 142 highlight_paint.setColor(kShelfButtonActivatedHighlightColor);
143 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, highlight_paint); 143 canvas->DrawRoundRect(bounds, kTrayRoundedBorderRadius, highlight_paint);
144 } 144 }
145 } 145 }
146 146
147 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const { 147 void PaintNonMaterial(gfx::Canvas* canvas, views::View* view) const {
148 const static int kImageTypeDefault = 0; 148 const static int kImageTypeDefault = 0;
149 // TODO(estade): leftover type which should be removed along with the rest 149 // TODO(estade): leftover type which should be removed along with the rest
150 // of pre-MD code. 150 // of pre-MD code.
151 // const static int kImageTypeOnBlack = 1; 151 // const static int kImageTypeOnBlack = 1;
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_); 593 const bool horizontal_shelf = IsHorizontalAlignment(shelf_alignment_);
594 const gfx::Rect local_bounds = GetLocalBounds(); 594 const gfx::Rect local_bounds = GetLocalBounds();
595 const int height = kTrayItemSize; 595 const int height = kTrayItemSize;
596 const int x = 596 const int x =
597 horizontal_shelf 597 horizontal_shelf
598 ? (base::i18n::IsRTL() ? 0 : (local_bounds.width() - kSeparatorWidth)) 598 ? (base::i18n::IsRTL() ? 0 : (local_bounds.width() - kSeparatorWidth))
599 : (local_bounds.height() - kSeparatorWidth); 599 : (local_bounds.height() - kSeparatorWidth);
600 const int y = (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2; 600 const int y = (GetShelfConstant(SHELF_SIZE) - kTrayItemSize) / 2;
601 gfx::ScopedCanvas scoped_canvas(canvas); 601 gfx::ScopedCanvas scoped_canvas(canvas);
602 const float scale = canvas->UndoDeviceScaleFactor(); 602 const float scale = canvas->UndoDeviceScaleFactor();
603 SkPaint paint; 603 cc::PaintFlags paint;
604 paint.setColor(kSeparatorColor); 604 paint.setColor(kSeparatorColor);
605 paint.setAntiAlias(true); 605 paint.setAntiAlias(true);
606 606
607 const gfx::Rect bounds = horizontal_shelf 607 const gfx::Rect bounds = horizontal_shelf
608 ? gfx::Rect(x, y, kSeparatorWidth, height) 608 ? gfx::Rect(x, y, kSeparatorWidth, height)
609 : gfx::Rect(y, x, height, kSeparatorWidth); 609 : gfx::Rect(y, x, height, kSeparatorWidth);
610 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 610 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
611 gfx::PointF line_start = 611 gfx::PointF line_start =
612 horizontal_shelf 612 horizontal_shelf
613 ? (base::i18n::IsRTL() ? rect.origin() : rect.top_right()) 613 ? (base::i18n::IsRTL() ? rect.origin() : rect.top_right())
(...skipping 19 matching lines...) Expand all
633 } 633 }
634 634
635 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const { 635 gfx::Rect TrayBackgroundView::GetBackgroundBounds() const {
636 gfx::Insets insets = GetBackgroundInsets(); 636 gfx::Insets insets = GetBackgroundInsets();
637 gfx::Rect bounds = GetLocalBounds(); 637 gfx::Rect bounds = GetLocalBounds();
638 bounds.Inset(insets); 638 bounds.Inset(insets);
639 return bounds; 639 return bounds;
640 } 640 }
641 641
642 } // namespace ash 642 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/toast/toast_overlay.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698