| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/painter.h" | 5 #include "ui/views/painter.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 SolidRoundRectPainter::~SolidRoundRectPainter() {} | 58 SolidRoundRectPainter::~SolidRoundRectPainter() {} |
| 59 | 59 |
| 60 gfx::Size SolidRoundRectPainter::GetMinimumSize() const { | 60 gfx::Size SolidRoundRectPainter::GetMinimumSize() const { |
| 61 return gfx::Size(); | 61 return gfx::Size(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void SolidRoundRectPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { | 64 void SolidRoundRectPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { |
| 65 gfx::ScopedCanvas scoped_canvas(canvas); | 65 gfx::ScopedCanvas scoped_canvas(canvas); |
| 66 const float scale = canvas->UndoDeviceScaleFactor(); | 66 const float scale = canvas->UndoDeviceScaleFactor(); |
| 67 | 67 |
| 68 gfx::RectF border_rect_f((gfx::SizeF(size))); | 68 gfx::RectF border_rect_f(gfx::ScaleToEnclosingRect(gfx::Rect(size), scale)); |
| 69 border_rect_f.Scale(scale); | |
| 70 const SkScalar scaled_corner_radius = SkFloatToScalar(radius_ * scale); | 69 const SkScalar scaled_corner_radius = SkFloatToScalar(radius_ * scale); |
| 71 | 70 |
| 72 SkPaint paint; | 71 SkPaint paint; |
| 73 paint.setAntiAlias(true); | 72 paint.setAntiAlias(true); |
| 74 paint.setStyle(SkPaint::kFill_Style); | 73 paint.setStyle(SkPaint::kFill_Style); |
| 75 paint.setColor(bg_color_); | 74 paint.setColor(bg_color_); |
| 76 canvas->DrawRoundRect(border_rect_f, scaled_corner_radius, paint); | 75 canvas->DrawRoundRect(border_rect_f, scaled_corner_radius, paint); |
| 77 | 76 |
| 78 border_rect_f.Inset(gfx::InsetsF(0.5f)); | 77 border_rect_f.Inset(gfx::InsetsF(0.5f)); |
| 79 paint.setStyle(SkPaint::kStroke_Style); | 78 paint.setStyle(SkPaint::kStroke_Style); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 canvas->DrawImageInt(*images_[LEFT], 0, 0); | 385 canvas->DrawImageInt(*images_[LEFT], 0, 0); |
| 387 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), | 386 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), |
| 388 0); | 387 0); |
| 389 canvas->TileImageInt( | 388 canvas->TileImageInt( |
| 390 *images_[CENTER], images_[LEFT]->width(), 0, | 389 *images_[CENTER], images_[LEFT]->width(), 0, |
| 391 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), | 390 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), |
| 392 images_[LEFT]->height()); | 391 images_[LEFT]->height()); |
| 393 } | 392 } |
| 394 | 393 |
| 395 } // namespace views | 394 } // namespace views |
| OLD | NEW |