| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/bubble/bubble_border.h" | 5 #include "views/bubble/bubble_border.h" |
| 6 | 6 |
| 7 #include <algorithm> // for std::max | 7 #include <algorithm> // for std::max |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 gfx::Path path; | 416 gfx::Path path; |
| 417 path.incReserve(4); | 417 path.incReserve(4); |
| 418 path.moveTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); | 418 path.moveTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); |
| 419 path.lineTo(SkIntToScalar(tip_x + shift_x), | 419 path.lineTo(SkIntToScalar(tip_x + shift_x), |
| 420 SkIntToScalar(tip_y + shift_y)); | 420 SkIntToScalar(tip_y + shift_y)); |
| 421 if (is_horizontal) | 421 if (is_horizontal) |
| 422 path.lineTo(SkIntToScalar(tip_x - shift_x), SkIntToScalar(tip_y + shift_y)); | 422 path.lineTo(SkIntToScalar(tip_x - shift_x), SkIntToScalar(tip_y + shift_y)); |
| 423 else | 423 else |
| 424 path.lineTo(SkIntToScalar(tip_x + shift_x), SkIntToScalar(tip_y - shift_y)); | 424 path.lineTo(SkIntToScalar(tip_x + shift_x), SkIntToScalar(tip_y - shift_y)); |
| 425 path.close(); | 425 path.close(); |
| 426 canvas->AsCanvasSkia()->drawPath(path, paint); | 426 canvas->GetSkCanvas()->drawPath(path, paint); |
| 427 } | 427 } |
| 428 | 428 |
| 429 ///////////////////////// | 429 ///////////////////////// |
| 430 | 430 |
| 431 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { | 431 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| 432 // The border of this view creates an anti-aliased round-rect region for the | 432 // The border of this view creates an anti-aliased round-rect region for the |
| 433 // contents, which we need to fill with the background color. | 433 // contents, which we need to fill with the background color. |
| 434 // NOTE: This doesn't handle an arrow location of "NONE", which has square top | 434 // NOTE: This doesn't handle an arrow location of "NONE", which has square top |
| 435 // corners. | 435 // corners. |
| 436 SkPaint paint; | 436 SkPaint paint; |
| 437 paint.setAntiAlias(true); | 437 paint.setAntiAlias(true); |
| 438 paint.setStyle(SkPaint::kFill_Style); | 438 paint.setStyle(SkPaint::kFill_Style); |
| 439 paint.setColor(border_->background_color()); | 439 paint.setColor(border_->background_color()); |
| 440 gfx::Path path; | 440 gfx::Path path; |
| 441 gfx::Rect bounds(view->GetContentsBounds()); | 441 gfx::Rect bounds(view->GetContentsBounds()); |
| 442 SkRect rect; | 442 SkRect rect; |
| 443 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), | 443 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), |
| 444 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); | 444 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); |
| 445 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); | 445 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
| 446 path.addRoundRect(rect, radius, radius); | 446 path.addRoundRect(rect, radius, radius); |
| 447 canvas->AsCanvasSkia()->drawPath(path, paint); | 447 canvas->GetSkCanvas()->drawPath(path, paint); |
| 448 } | 448 } |
| 449 | 449 |
| 450 } // namespace views | 450 } // namespace views |
| OLD | NEW |