| 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 "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 bounds.Inset(-GetBorderThickness(), -GetBorderThickness()); | 204 bounds.Inset(-GetBorderThickness(), -GetBorderThickness()); |
| 205 const gfx::Rect arrow_bounds = GetArrowRect(view.GetLocalBounds()); | 205 const gfx::Rect arrow_bounds = GetArrowRect(view.GetLocalBounds()); |
| 206 if (arrow_bounds.IsEmpty()) { | 206 if (arrow_bounds.IsEmpty()) { |
| 207 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); | 207 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Clip the arrow bounds out to avoid painting the overlapping edge area. | 211 // Clip the arrow bounds out to avoid painting the overlapping edge area. |
| 212 canvas->Save(); | 212 canvas->Save(); |
| 213 SkRect arrow_rect(gfx::RectToSkRect(arrow_bounds)); | 213 SkRect arrow_rect(gfx::RectToSkRect(arrow_bounds)); |
| 214 canvas->sk_canvas()->clipRect(arrow_rect, SkRegion::kDifference_Op); | 214 canvas->sk_canvas()->clipRect(arrow_rect, kDifference_SkClipOp); |
| 215 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); | 215 Painter::PaintPainterAt(canvas, images_->border_painter.get(), bounds); |
| 216 canvas->Restore(); | 216 canvas->Restore(); |
| 217 | 217 |
| 218 DrawArrow(canvas, arrow_bounds); | 218 DrawArrow(canvas, arrow_bounds); |
| 219 } | 219 } |
| 220 | 220 |
| 221 gfx::Insets BubbleBorder::GetInsets() const { | 221 gfx::Insets BubbleBorder::GetInsets() const { |
| 222 // The insets contain the stroke and shadow pixels outside the bubble fill. | 222 // The insets contain the stroke and shadow pixels outside the bubble fill. |
| 223 const int inset = GetBorderThickness(); | 223 const int inset = GetBorderThickness(); |
| 224 if ((arrow_paint_type_ == PAINT_NONE) || !has_arrow(arrow_)) | 224 if ((arrow_paint_type_ == PAINT_NONE) || !has_arrow(arrow_)) |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 paint.setStyle(SkPaint::kFill_Style); | 348 paint.setStyle(SkPaint::kFill_Style); |
| 349 paint.setColor(border_->background_color()); | 349 paint.setColor(border_->background_color()); |
| 350 SkPath path; | 350 SkPath path; |
| 351 gfx::Rect bounds(view->GetLocalBounds()); | 351 gfx::Rect bounds(view->GetLocalBounds()); |
| 352 bounds.Inset(border_->GetInsets()); | 352 bounds.Inset(border_->GetInsets()); |
| 353 | 353 |
| 354 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint); | 354 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint); |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace views | 357 } // namespace views |
| OLD | NEW |