| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "third_party/skia/include/effects/SkGradientShader.h" | 9 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return new ImagePainter(image, insets); | 265 return new ImagePainter(image, insets); |
| 266 } | 266 } |
| 267 | 267 |
| 268 // static | 268 // static |
| 269 Painter* Painter::CreateImageGridPainter(const int image_ids[]) { | 269 Painter* Painter::CreateImageGridPainter(const int image_ids[]) { |
| 270 return new ImagePainter(image_ids); | 270 return new ImagePainter(image_ids); |
| 271 } | 271 } |
| 272 | 272 |
| 273 // static | 273 // static |
| 274 scoped_ptr<Painter> Painter::CreateDashedFocusPainter() { | 274 scoped_ptr<Painter> Painter::CreateDashedFocusPainter() { |
| 275 return scoped_ptr<Painter>(new DashedFocusPainter(gfx::Insets())).Pass(); | 275 return make_scoped_ptr(new DashedFocusPainter(gfx::Insets())); |
| 276 } | 276 } |
| 277 | 277 |
| 278 // static | 278 // static |
| 279 scoped_ptr<Painter> Painter::CreateDashedFocusPainterWithInsets( | 279 scoped_ptr<Painter> Painter::CreateDashedFocusPainterWithInsets( |
| 280 const gfx::Insets& insets) { | 280 const gfx::Insets& insets) { |
| 281 return scoped_ptr<Painter>(new DashedFocusPainter(insets)).Pass(); | 281 return make_scoped_ptr(new DashedFocusPainter(insets)); |
| 282 } | 282 } |
| 283 | 283 |
| 284 // static | 284 // static |
| 285 scoped_ptr<Painter> Painter::CreateSolidFocusPainter( | 285 scoped_ptr<Painter> Painter::CreateSolidFocusPainter( |
| 286 SkColor color, | 286 SkColor color, |
| 287 const gfx::Insets& insets) { | 287 const gfx::Insets& insets) { |
| 288 return scoped_ptr<Painter>(new SolidFocusPainter(color, insets)).Pass(); | 288 return make_scoped_ptr(new SolidFocusPainter(color, insets)); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // HorizontalPainter ---------------------------------------------------------- | 291 // HorizontalPainter ---------------------------------------------------------- |
| 292 | 292 |
| 293 HorizontalPainter::HorizontalPainter(const int image_resource_names[]) { | 293 HorizontalPainter::HorizontalPainter(const int image_resource_names[]) { |
| 294 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 294 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 295 for (int i = 0; i < 3; ++i) | 295 for (int i = 0; i < 3; ++i) |
| 296 images_[i] = rb.GetImageNamed(image_resource_names[i]).ToImageSkia(); | 296 images_[i] = rb.GetImageNamed(image_resource_names[i]).ToImageSkia(); |
| 297 DCHECK_EQ(images_[LEFT]->height(), images_[CENTER]->height()); | 297 DCHECK_EQ(images_[LEFT]->height(), images_[CENTER]->height()); |
| 298 DCHECK_EQ(images_[LEFT]->height(), images_[RIGHT]->height()); | 298 DCHECK_EQ(images_[LEFT]->height(), images_[RIGHT]->height()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 314 canvas->DrawImageInt(*images_[LEFT], 0, 0); | 314 canvas->DrawImageInt(*images_[LEFT], 0, 0); |
| 315 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), | 315 canvas->DrawImageInt(*images_[RIGHT], size.width() - images_[RIGHT]->width(), |
| 316 0); | 316 0); |
| 317 canvas->TileImageInt( | 317 canvas->TileImageInt( |
| 318 *images_[CENTER], images_[LEFT]->width(), 0, | 318 *images_[CENTER], images_[LEFT]->width(), 0, |
| 319 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), | 319 size.width() - images_[LEFT]->width() - images_[RIGHT]->width(), |
| 320 images_[LEFT]->height()); | 320 images_[LEFT]->height()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace views | 323 } // namespace views |
| OLD | NEW |