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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 void GradientPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { | 205 void GradientPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { |
206 cc::PaintFlags flags; | 206 cc::PaintFlags flags; |
207 SkPoint p[2]; | 207 SkPoint p[2]; |
208 p[0].iset(0, 0); | 208 p[0].iset(0, 0); |
209 if (horizontal_) | 209 if (horizontal_) |
210 p[1].iset(size.width(), 0); | 210 p[1].iset(size.width(), 0); |
211 else | 211 else |
212 p[1].iset(0, size.height()); | 212 p[1].iset(0, size.height()); |
213 | 213 |
214 flags.setShader(cc::WrapSkShader(SkGradientShader::MakeLinear( | 214 flags.setShader(base::MakeUnique<cc::PaintShader>( |
215 p, colors_.get(), pos_.get(), count_, SkShader::kClamp_TileMode))); | 215 p, colors_.get(), pos_.get(), count_, SkShader::kClamp_TileMode)); |
216 flags.setStyle(cc::PaintFlags::kFill_Style); | 216 flags.setStyle(cc::PaintFlags::kFill_Style); |
217 | 217 |
218 canvas->sk_canvas()->drawRect(SkRect::MakeIWH(size.width(), size.height()), | 218 canvas->sk_canvas()->drawRect(SkRect::MakeIWH(size.width(), size.height()), |
219 flags); | 219 flags); |
220 } | 220 } |
221 | 221 |
222 // ImagePainter --------------------------------------------------------------- | 222 // ImagePainter --------------------------------------------------------------- |
223 | 223 |
224 // ImagePainter stores and paints nine images as a scalable grid. | 224 // ImagePainter stores and paints nine images as a scalable grid. |
225 class ImagePainter : public Painter { | 225 class ImagePainter : public Painter { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 canvas->DrawImageInt(*images_[LEFT], 0, 0); | 390 canvas->DrawImageInt(*images_[LEFT], 0, 0); |
391 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), | 391 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), |
392 0); | 392 0); |
393 canvas->TileImageInt( | 393 canvas->TileImageInt( |
394 *images_[CENTER], images_[LEFT]->width(), 0, | 394 *images_[CENTER], images_[LEFT]->width(), 0, |
395 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), | 395 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), |
396 images_[LEFT]->height()); | 396 images_[LEFT]->height()); |
397 } | 397 } |
398 | 398 |
399 } // namespace views | 399 } // namespace views |
OLD | NEW |