diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 16:29:21 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-01 16:29:21 +0000 |
commit | b9857bdd37282ba346cbb2ccb52b67175ef490c0 (patch) | |
tree | 373a6f5904ab4e71c7b407a26512267f0c7b109c /ui/views/bubble | |
parent | 414d57a780c0f774a9e5c2a893f5189b88b43b6e (diff) | |
download | chromium_src-b9857bdd37282ba346cbb2ccb52b67175ef490c0.zip chromium_src-b9857bdd37282ba346cbb2ccb52b67175ef490c0.tar.gz chromium_src-b9857bdd37282ba346cbb2ccb52b67175ef490c0.tar.bz2 |
ui: Let skia do the conversion work for us by using the integer version of set() function.
R=pkasting@chromium.org
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9544001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/bubble')
-rw-r--r-- | ui/views/bubble/bubble_border.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/ui/views/bubble/bubble_border.cc b/ui/views/bubble/bubble_border.cc index 51f4ce2..372c24f 100644 --- a/ui/views/bubble/bubble_border.cc +++ b/ui/views/bubble/bubble_border.cc @@ -12,7 +12,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/canvas_skia.h" -#include "ui/gfx/path.h" +#include "ui/gfx/skia_util.h" namespace views { @@ -480,7 +480,7 @@ void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas, SkPaint paint; paint.setStyle(SkPaint::kFill_Style); paint.setColor(background_color_); - gfx::Path path; + SkPath path; path.incReserve(4); path.moveTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); path.lineTo(SkIntToScalar(tip_x + shift_x), @@ -498,11 +498,7 @@ void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas, void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { // Clip out the client bounds to prevent overlapping transparent widgets. if (!border_->client_bounds().IsEmpty()) { - SkRect client_rect; - client_rect.set(SkIntToScalar(border_->client_bounds().x()), - SkIntToScalar(border_->client_bounds().y()), - SkIntToScalar(border_->client_bounds().right()), - SkIntToScalar(border_->client_bounds().bottom())); + SkRect client_rect(gfx::RectToSkRect(border_->client_bounds())); canvas->GetSkCanvas()->clipRect(client_rect, SkRegion::kDifference_Op); } @@ -514,14 +510,11 @@ void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { paint.setAntiAlias(true); paint.setStyle(SkPaint::kFill_Style); paint.setColor(border_->background_color()); - gfx::Path path; + SkPath path; gfx::Rect bounds(view->GetContentsBounds()); - SkRect rect; - rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), - SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); - rect.inset(-border_->border_thickness(), -border_->border_thickness()); + bounds.Inset(-border_->border_thickness(), -border_->border_thickness()); SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); - path.addRoundRect(rect, radius, radius); + path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); canvas->GetSkCanvas()->drawPath(path, paint); } |