| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 p[0].iset(0, 0); | 210 p[0].iset(0, 0); |
| 211 if (horizontal_) | 211 if (horizontal_) |
| 212 p[1].iset(size.width(), 0); | 212 p[1].iset(size.width(), 0); |
| 213 else | 213 else |
| 214 p[1].iset(0, size.height()); | 214 p[1].iset(0, size.height()); |
| 215 | 215 |
| 216 flags.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear( | 216 flags.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear( |
| 217 p, colors_.get(), pos_.get(), count_, SkShader::kClamp_TileMode))); | 217 p, colors_.get(), pos_.get(), count_, SkShader::kClamp_TileMode))); |
| 218 flags.setStyle(cc::PaintFlags::kFill_Style); | 218 flags.setStyle(cc::PaintFlags::kFill_Style); |
| 219 | 219 |
| 220 canvas->sk_canvas()->drawRectCoords(SkIntToScalar(0), SkIntToScalar(0), | 220 canvas->sk_canvas()->drawRect(SkRect::MakeIWH(size.width(), size.height()), |
| 221 SkIntToScalar(size.width()), | 221 flags); |
| 222 SkIntToScalar(size.height()), flags); | |
| 223 } | 222 } |
| 224 | 223 |
| 225 // ImagePainter --------------------------------------------------------------- | 224 // ImagePainter --------------------------------------------------------------- |
| 226 | 225 |
| 227 // ImagePainter stores and paints nine images as a scalable grid. | 226 // ImagePainter stores and paints nine images as a scalable grid. |
| 228 class ImagePainter : public Painter { | 227 class ImagePainter : public Painter { |
| 229 public: | 228 public: |
| 230 // Constructs an ImagePainter with the specified image resource ids. | 229 // Constructs an ImagePainter with the specified image resource ids. |
| 231 // See CreateImageGridPainter()'s comment regarding image ID count and order. | 230 // See CreateImageGridPainter()'s comment regarding image ID count and order. |
| 232 explicit ImagePainter(const int image_ids[]); | 231 explicit ImagePainter(const int image_ids[]); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 canvas->DrawImageInt(*images_[LEFT], 0, 0); | 394 canvas->DrawImageInt(*images_[LEFT], 0, 0); |
| 396 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), | 395 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), |
| 397 0); | 396 0); |
| 398 canvas->TileImageInt( | 397 canvas->TileImageInt( |
| 399 *images_[CENTER], images_[LEFT]->width(), 0, | 398 *images_[CENTER], images_[LEFT]->width(), 0, |
| 400 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), | 399 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), |
| 401 images_[LEFT]->height()); | 400 images_[LEFT]->height()); |
| 402 } | 401 } |
| 403 | 402 |
| 404 } // namespace views | 403 } // namespace views |
| OLD | NEW |