| 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 "chrome/browser/ui/views/bubble/bubble_border.h" | 5 #include "chrome/browser/ui/views/bubble/bubble_border.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 gfx::Path path; | 411 gfx::Path path; |
| 412 path.incReserve(4); | 412 path.incReserve(4); |
| 413 path.moveTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); | 413 path.moveTo(SkIntToScalar(tip_x), SkIntToScalar(tip_y)); |
| 414 path.lineTo(SkIntToScalar(tip_x + shift_x), | 414 path.lineTo(SkIntToScalar(tip_x + shift_x), |
| 415 SkIntToScalar(tip_y + shift_y)); | 415 SkIntToScalar(tip_y + shift_y)); |
| 416 if (is_horizontal) | 416 if (is_horizontal) |
| 417 path.lineTo(SkIntToScalar(tip_x - shift_x), SkIntToScalar(tip_y + shift_y)); | 417 path.lineTo(SkIntToScalar(tip_x - shift_x), SkIntToScalar(tip_y + shift_y)); |
| 418 else | 418 else |
| 419 path.lineTo(SkIntToScalar(tip_x + shift_x), SkIntToScalar(tip_y - shift_y)); | 419 path.lineTo(SkIntToScalar(tip_x + shift_x), SkIntToScalar(tip_y - shift_y)); |
| 420 path.close(); | 420 path.close(); |
| 421 canvas->AsCanvasSkia()->drawPath(path, paint); | 421 canvas->AsCanvasSkia()->skia_canvas()->drawPath(path, paint); |
| 422 } | 422 } |
| 423 | 423 |
| 424 ///////////////////////// | 424 ///////////////////////// |
| 425 | 425 |
| 426 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { | 426 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| 427 // The border of this view creates an anti-aliased round-rect region for the | 427 // The border of this view creates an anti-aliased round-rect region for the |
| 428 // contents, which we need to fill with the background color. | 428 // contents, which we need to fill with the background color. |
| 429 // NOTE: This doesn't handle an arrow location of "NONE", which has square top | 429 // NOTE: This doesn't handle an arrow location of "NONE", which has square top |
| 430 // corners. | 430 // corners. |
| 431 SkPaint paint; | 431 SkPaint paint; |
| 432 paint.setAntiAlias(true); | 432 paint.setAntiAlias(true); |
| 433 paint.setStyle(SkPaint::kFill_Style); | 433 paint.setStyle(SkPaint::kFill_Style); |
| 434 paint.setColor(border_->background_color()); | 434 paint.setColor(border_->background_color()); |
| 435 gfx::Path path; | 435 gfx::Path path; |
| 436 gfx::Rect bounds(view->GetContentsBounds()); | 436 gfx::Rect bounds(view->GetContentsBounds()); |
| 437 SkRect rect; | 437 SkRect rect; |
| 438 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), | 438 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), |
| 439 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); | 439 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); |
| 440 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); | 440 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
| 441 path.addRoundRect(rect, radius, radius); | 441 path.addRoundRect(rect, radius, radius); |
| 442 canvas->AsCanvasSkia()->drawPath(path, paint); | 442 canvas->AsCanvasSkia()->skia_canvas()->drawPath(path, paint); |
| 443 } | 443 } |
| OLD | NEW |