Commit b0c5dfb6 authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

Fix BubbleBorder wrong arrow for BOTTOM_LEFT and RIGHT_TOP.

BUG=136603
TEST=Verify bubble arrow is drawn correctly when arrow location is BOTTOM_LEFT and RIGHT_TOP.


Review URL: https://chromiumcodereview.appspot.com/10689145

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146155 0039d316-1c4b-4281-b951-d872f2087c98
parent 87a3a05a
...@@ -455,8 +455,10 @@ void BubbleBorder::DrawEdgeWithArrow(gfx::Canvas* canvas, ...@@ -455,8 +455,10 @@ void BubbleBorder::DrawEdgeWithArrow(gfx::Canvas* canvas,
void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas, void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas,
float tip_x, float tip_x,
float tip_y) const { float tip_y) const {
const int offset_to_next_vertex = const bool is_horizontal = is_arrow_on_horizontal(arrow_location_);
(is_arrow_on_left(arrow_location_) || is_arrow_on_top(arrow_location_)) ? const bool positive_offset = is_horizontal ?
is_arrow_on_top(arrow_location_) : is_arrow_on_left(arrow_location_);
const int offset_to_next_vertex = positive_offset ?
kArrowInteriorHeight : -kArrowInteriorHeight; kArrowInteriorHeight : -kArrowInteriorHeight;
SkPath path; SkPath path;
...@@ -464,7 +466,7 @@ void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas, ...@@ -464,7 +466,7 @@ void BubbleBorder::DrawArrowInterior(gfx::Canvas* canvas,
path.moveTo(SkDoubleToScalar(tip_x), SkDoubleToScalar(tip_y)); path.moveTo(SkDoubleToScalar(tip_x), SkDoubleToScalar(tip_y));
path.lineTo(SkDoubleToScalar(tip_x + offset_to_next_vertex), path.lineTo(SkDoubleToScalar(tip_x + offset_to_next_vertex),
SkDoubleToScalar(tip_y + offset_to_next_vertex)); SkDoubleToScalar(tip_y + offset_to_next_vertex));
if (is_arrow_on_horizontal(arrow_location_)) { if (is_horizontal) {
path.lineTo(SkDoubleToScalar(tip_x - offset_to_next_vertex), path.lineTo(SkDoubleToScalar(tip_x - offset_to_next_vertex),
SkDoubleToScalar(tip_y + offset_to_next_vertex)); SkDoubleToScalar(tip_y + offset_to_next_vertex));
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment