OLD | NEW |
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 "ui/views/bubble/bubble_border.h" | 5 #include "ui/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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 break; | 205 break; |
206 | 206 |
207 case NONE: | 207 case NONE: |
208 case FLOAT: | 208 case FLOAT: |
209 // Nothing to do. | 209 // Nothing to do. |
210 break; | 210 break; |
211 } | 211 } |
212 insets->Set(top, left, bottom, right); | 212 insets->Set(top, left, bottom, right); |
213 } | 213 } |
214 | 214 |
215 int BubbleBorder::border_thickness() const { | 215 int BubbleBorder::GetBorderThickness() const { |
216 return images_->border_thickness; | 216 return images_->border_thickness; |
217 } | 217 } |
218 | 218 |
219 int BubbleBorder::SetArrowOffset(int offset, const gfx::Size& contents_size) { | 219 int BubbleBorder::SetArrowOffset(int offset, const gfx::Size& contents_size) { |
220 gfx::Size border_size(contents_size); | 220 gfx::Size border_size(contents_size); |
221 gfx::Insets insets; | 221 gfx::Insets insets; |
222 GetInsets(&insets); | 222 GetInsets(&insets); |
223 border_size.Enlarge(insets.left() + insets.right(), | 223 border_size.Enlarge(insets.left() + insets.right(), |
224 insets.top() + insets.bottom()); | 224 insets.top() + insets.bottom()); |
225 offset = std::max(arrow_offset_, | 225 offset = std::max(arrow_offset_, |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // The border of this view creates an anti-aliased round-rect region for the | 498 // The border of this view creates an anti-aliased round-rect region for the |
499 // contents, which we need to fill with the background color. | 499 // contents, which we need to fill with the background color. |
500 // NOTE: This doesn't handle an arrow location of "NONE", which has square top | 500 // NOTE: This doesn't handle an arrow location of "NONE", which has square top |
501 // corners. | 501 // corners. |
502 SkPaint paint; | 502 SkPaint paint; |
503 paint.setAntiAlias(true); | 503 paint.setAntiAlias(true); |
504 paint.setStyle(SkPaint::kFill_Style); | 504 paint.setStyle(SkPaint::kFill_Style); |
505 paint.setColor(border_->background_color()); | 505 paint.setColor(border_->background_color()); |
506 SkPath path; | 506 SkPath path; |
507 gfx::Rect bounds(view->GetContentsBounds()); | 507 gfx::Rect bounds(view->GetContentsBounds()); |
508 bounds.Inset(-border_->border_thickness(), -border_->border_thickness()); | 508 bounds.Inset(-border_->GetBorderThickness(), -border_->GetBorderThickness()); |
509 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); | 509 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
510 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); | 510 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); |
511 canvas->DrawPath(path, paint); | 511 canvas->DrawPath(path, paint); |
512 } | 512 } |
513 | 513 |
514 } // namespace views | 514 } // namespace views |
OLD | NEW |