Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Unified Diff: ui/views/bubble/bubble_frame_view.cc

Issue 14557010: Simplify the NO_SHADOW_OPAQUE_BORDER path with addRoundRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor extra cleanup. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/bubble/bubble_frame_view.cc
diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc
index 07a8208a42cfa6c065b299e343514437f0346308..f6850e7793dd8e77d8d449efa2df134ef25733ea 100644
--- a/ui/views/bubble/bubble_frame_view.cc
+++ b/ui/views/bubble/bubble_frame_view.cc
@@ -102,38 +102,16 @@ void BubbleFrameView::GetWindowMask(const gfx::Size& size,
return;
// Use a window mask roughly matching the border in the image assets.
-
- // Stroke size in pixels of borders in image assets.
static const int kBorderStrokeSize = 1;
-
+ static const SkScalar kCornerRadius = SkIntToScalar(6);
gfx::Insets border_insets = bubble_border_->GetInsets();
- SkRect rect = {SkIntToScalar(border_insets.left() - kBorderStrokeSize),
- SkIntToScalar(border_insets.top() - kBorderStrokeSize),
- SkIntToScalar(size.width() - border_insets.right() +
- kBorderStrokeSize),
- SkIntToScalar(size.height() - border_insets.bottom() +
- kBorderStrokeSize)};
-
- // Approximate rounded corners matching the border.
- SkPoint polygon[] = {
- {rect.left() + SkIntToScalar(2), rect.top()},
- {rect.left() + SkIntToScalar(1), rect.top() + SkIntToScalar(1)},
- {rect.left(), rect.top() + SkIntToScalar(2)},
-
- {rect.left(), rect.bottom() - SkIntToScalar(3)},
- {rect.left() + SkIntToScalar(1), rect.bottom() - SkIntToScalar(2)},
- {rect.left() + SkIntToScalar(2), rect.bottom()},
-
- {rect.right() - SkIntToScalar(3), rect.bottom()},
- {rect.right() - SkIntToScalar(1), rect.bottom() - SkIntToScalar(2)},
- {rect.right(), rect.bottom() - SkIntToScalar(3)},
-
- {rect.right(), rect.top() + SkIntToScalar(2)},
- {rect.right() - SkIntToScalar(1), rect.top() + SkIntToScalar(1)},
- {rect.right() - SkIntToScalar(2), rect.top()}
- };
-
- window_mask->addPoly(polygon, sizeof(polygon)/sizeof(polygon[0]), true);
+ const SkRect rect = { SkIntToScalar(border_insets.left() - kBorderStrokeSize),
+ SkIntToScalar(border_insets.top() - kBorderStrokeSize),
+ SkIntToScalar(size.width() - border_insets.right() +
+ kBorderStrokeSize),
+ SkIntToScalar(size.height() - border_insets.bottom() +
+ kBorderStrokeSize) };
+ window_mask->addRoundRect(rect, kCornerRadius, kCornerRadius);
}
void BubbleFrameView::ResetWindowControls() {}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698