| 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 "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 paint.setStyle(SkPaint::kFill_Style); | 347 paint.setStyle(SkPaint::kFill_Style); |
| 348 paint.setColor(background_color_); | 348 paint.setColor(background_color_); |
| 349 | 349 |
| 350 canvas->DrawPath(path, paint); | 350 canvas->DrawPath(path, paint); |
| 351 } | 351 } |
| 352 | 352 |
| 353 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { | 353 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| 354 if (border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER) | 354 if (border_->shadow() == BubbleBorder::NO_SHADOW_OPAQUE_BORDER) |
| 355 canvas->DrawColor(border_->background_color()); | 355 canvas->DrawColor(border_->background_color()); |
| 356 | 356 |
| 357 // Clip out the client bounds to prevent overlapping transparent widgets. | |
| 358 if (!border_->client_bounds().IsEmpty()) { | |
| 359 SkRect client_rect(gfx::RectToSkRect(border_->client_bounds())); | |
| 360 canvas->sk_canvas()->clipRect(client_rect, SkRegion::kDifference_Op); | |
| 361 } | |
| 362 | |
| 363 // Fill the contents with a round-rect region to match the border images. | 357 // Fill the contents with a round-rect region to match the border images. |
| 364 SkPaint paint; | 358 SkPaint paint; |
| 365 paint.setAntiAlias(true); | 359 paint.setAntiAlias(true); |
| 366 paint.setStyle(SkPaint::kFill_Style); | 360 paint.setStyle(SkPaint::kFill_Style); |
| 367 paint.setColor(border_->background_color()); | 361 paint.setColor(border_->background_color()); |
| 368 SkPath path; | 362 SkPath path; |
| 369 gfx::Rect bounds(view->GetLocalBounds()); | 363 gfx::Rect bounds(view->GetLocalBounds()); |
| 370 bounds.Inset(border_->GetInsets()); | 364 bounds.Inset(border_->GetInsets()); |
| 371 | 365 |
| 372 SkScalar radius = SkIntToScalar(border_->GetBorderCornerRadius()); | 366 SkScalar radius = SkIntToScalar(border_->GetBorderCornerRadius()); |
| 373 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); | 367 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); |
| 374 canvas->DrawPath(path, paint); | 368 canvas->DrawPath(path, paint); |
| 375 } | 369 } |
| 376 | 370 |
| 377 } // namespace views | 371 } // namespace views |
| OLD | NEW |