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/SkDrawLooper.h" | 10 #include "third_party/skia/include/core/SkDrawLooper.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 | 500 |
501 // Fill the contents with a round-rect region to match the border images. | 501 // Fill the contents with a round-rect region to match the border images. |
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::RectF bounds(view->GetLocalBounds()); | 507 gfx::RectF bounds(view->GetLocalBounds()); |
508 bounds.Inset(gfx::InsetsF(border_->GetInsets())); | 508 bounds.Inset(gfx::InsetsF(border_->GetInsets())); |
509 if (UseMd()) { | 509 if (UseMd()) { |
510 // The border is 1px at all scale factors. Leave room for it. | 510 // The border is 1px at all scale factors. Leave room for it. It's partially |
| 511 // transparent, so we don't want to draw any background underneath it. |
511 const SkScalar one_pixel = SkFloatToScalar(1 / canvas->image_scale()); | 512 const SkScalar one_pixel = SkFloatToScalar(1 / canvas->image_scale()); |
512 bounds.Inset(gfx::InsetsF(one_pixel)); | 513 bounds.Inset(gfx::InsetsF(one_pixel)); |
513 } | 514 } |
514 | 515 |
515 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint); | 516 canvas->DrawRoundRect(bounds, border_->GetBorderCornerRadius(), paint); |
516 } | 517 } |
517 | 518 |
518 } // namespace views | 519 } // namespace views |
OLD | NEW |