OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/bubble/bubble_border.h" | 5 #include "views/bubble/bubble_border.h" |
6 | 6 |
7 #include <algorithm> // for std::max | 7 #include <algorithm> // for std::max |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 int offset_y = | 193 int offset_y = |
194 (std::max(left_arrow_->height(), right_arrow_->height()) / 2) + | 194 (std::max(left_arrow_->height(), right_arrow_->height()) / 2) + |
195 std::max(std::max(top_left_->height(), top_right_->height()), | 195 std::max(std::max(top_left_->height(), top_right_->height()), |
196 std::max(bottom_left_->height(), bottom_right_->height())); | 196 std::max(bottom_left_->height(), bottom_right_->height())); |
197 arrow_offset_ = std::max(offset_x, offset_y); | 197 arrow_offset_ = std::max(offset_x, offset_y); |
198 | 198 |
199 initialized = true; | 199 initialized = true; |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
| 203 BubbleBorder::~BubbleBorder() {} |
| 204 |
203 void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const { | 205 void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) const { |
204 // Convenience shorthand variables. | 206 // Convenience shorthand variables. |
205 const int tl_width = top_left_->width(); | 207 const int tl_width = top_left_->width(); |
206 const int tl_height = top_left_->height(); | 208 const int tl_height = top_left_->height(); |
207 const int t_height = top_->height(); | 209 const int t_height = top_->height(); |
208 const int tr_width = top_right_->width(); | 210 const int tr_width = top_right_->width(); |
209 const int tr_height = top_right_->height(); | 211 const int tr_height = top_right_->height(); |
210 const int l_width = left_->width(); | 212 const int l_width = left_->width(); |
211 const int r_width = right_->width(); | 213 const int r_width = right_->width(); |
212 const int br_width = bottom_right_->width(); | 214 const int br_width = bottom_right_->width(); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 gfx::Rect bounds(view->GetContentsBounds()); | 443 gfx::Rect bounds(view->GetContentsBounds()); |
442 SkRect rect; | 444 SkRect rect; |
443 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), | 445 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), |
444 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); | 446 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); |
445 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); | 447 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
446 path.addRoundRect(rect, radius, radius); | 448 path.addRoundRect(rect, radius, radius); |
447 canvas->GetSkCanvas()->drawPath(path, paint); | 449 canvas->GetSkCanvas()->drawPath(path, paint); |
448 } | 450 } |
449 | 451 |
450 } // namespace views | 452 } // namespace views |
OLD | NEW |