| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/views/bubble_border.h" | 5 #include "chrome/browser/views/bubble_border.h" |
| 6 | 6 |
| 7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
| 8 #include "app/gfx/path.h" | 8 #include "app/gfx/path.h" |
| 9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 canvas->TileImageInt(*top_, tl_width, border_top, | 258 canvas->TileImageInt(*top_, tl_width, border_top, |
| 259 width - tl_width - tr_width, t_height); | 259 width - tl_width - tr_width, t_height); |
| 260 } | 260 } |
| 261 | 261 |
| 262 // Bottom edge, if not already drawn | 262 // Bottom edge, if not already drawn |
| 263 if (should_draw_bottom_edge) { | 263 if (should_draw_bottom_edge) { |
| 264 canvas->TileImageInt(*bottom_, bl_width, bottom, | 264 canvas->TileImageInt(*bottom_, bl_width, bottom, |
| 265 width - bl_width - br_width, b_height); | 265 width - bl_width - br_width, b_height); |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 |
| 269 ///////////////////////// |
| 270 |
| 271 void BubbleBackground::Paint(gfx::Canvas* canvas, views::View* view) const { |
| 272 // The border of this view creates an anti-aliased round-rect region for the |
| 273 // contents, which we need to fill with the background color. |
| 274 SkPaint paint; |
| 275 paint.setAntiAlias(true); |
| 276 paint.setStyle(SkPaint::kFill_Style); |
| 277 paint.setColor(border_->background_color()); |
| 278 gfx::Path path; |
| 279 gfx::Rect bounds(view->GetLocalBounds(false)); |
| 280 SkRect rect; |
| 281 rect.set(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()), |
| 282 SkIntToScalar(bounds.right()), SkIntToScalar(bounds.bottom())); |
| 283 SkScalar radius = SkIntToScalar(BubbleBorder::GetCornerRadius()); |
| 284 path.addRoundRect(rect, radius, radius); |
| 285 canvas->drawPath(path, paint); |
| 286 } |
| OLD | NEW |