| 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> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "third_party/skia/include/core/SkPaint.h" | 10 #include "third_party/skia/include/core/SkPaint.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 bool BubbleBorder::GetArrowPath(const gfx::Rect& view_bounds, | 228 bool BubbleBorder::GetArrowPath(const gfx::Rect& view_bounds, |
| 229 gfx::Path* path) const { | 229 gfx::Path* path) const { |
| 230 if (!has_arrow(arrow_) || arrow_paint_type_ != PAINT_NORMAL) | 230 if (!has_arrow(arrow_) || arrow_paint_type_ != PAINT_NORMAL) |
| 231 return false; | 231 return false; |
| 232 | 232 |
| 233 GetArrowPathFromArrowBounds(GetArrowRect(view_bounds), path); | 233 GetArrowPathFromArrowBounds(GetArrowRect(view_bounds), path); |
| 234 return true; | 234 return true; |
| 235 } | 235 } |
| 236 | 236 |
| 237 void BubbleBorder::SetBorderInteriorThickness(int border_interior_thickness) { |
| 238 images_->border_interior_thickness = border_interior_thickness; |
| 239 if (!has_arrow(arrow_) || arrow_paint_type_ != PAINT_NORMAL) |
| 240 images_->border_thickness = border_interior_thickness; |
| 241 } |
| 242 |
| 237 void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) { | 243 void BubbleBorder::Paint(const views::View& view, gfx::Canvas* canvas) { |
| 238 gfx::Rect bounds(view.GetContentsBounds()); | 244 gfx::Rect bounds(view.GetContentsBounds()); |
| 239 bounds.Inset(-GetBorderThickness(), -GetBorderThickness()); | 245 bounds.Inset(-GetBorderThickness(), -GetBorderThickness()); |
| 240 const gfx::Rect arrow_bounds = GetArrowRect(view.GetLocalBounds()); | 246 const gfx::Rect arrow_bounds = GetArrowRect(view.GetLocalBounds()); |
| 241 if (arrow_bounds.IsEmpty()) { | 247 if (arrow_bounds.IsEmpty()) { |
| 242 if (images_->border_painter) | 248 if (images_->border_painter) |
| 243 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); | 249 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); |
| 244 return; | 250 return; |
| 245 } | 251 } |
| 246 if (!images_->border_painter) { | 252 if (!images_->border_painter) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 paint.setStyle(SkPaint::kFill_Style); | 410 paint.setStyle(SkPaint::kFill_Style); |
| 405 paint.setColor(border_->background_color()); | 411 paint.setColor(border_->background_color()); |
| 406 SkPath path; | 412 SkPath path; |
| 407 gfx::Rect bounds(view->GetLocalBounds()); | 413 gfx::Rect bounds(view->GetLocalBounds()); |
| 408 bounds.Inset(border_->GetInsets()); | 414 bounds.Inset(border_->GetInsets()); |
| 409 | 415 |
| 410 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint); | 416 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint); |
| 411 } | 417 } |
| 412 | 418 |
| 413 } // namespace views | 419 } // namespace views |
| OLD | NEW |