| 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/wm/core/image_grid.h" | 5 #include "ui/wm/core/image_grid.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "third_party/skia/include/core/SkXfermode.h" | 10 #include "third_party/skia/include/core/SkXfermode.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( | 284 void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( |
| 285 float device_scale_factor) { | 285 float device_scale_factor) { |
| 286 // Redrawing will take care of scale factor change. | 286 // Redrawing will take care of scale factor change. |
| 287 } | 287 } |
| 288 | 288 |
| 289 base::Closure ImageGrid::ImagePainter::PrepareForLayerBoundsChange() { | 289 base::Closure ImageGrid::ImagePainter::PrepareForLayerBoundsChange() { |
| 290 return base::Closure(); | 290 return base::Closure(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 void ImageGrid::SetImage(const gfx::Image* image, | 293 void ImageGrid::SetImage(const gfx::Image* image, |
| 294 scoped_ptr<ui::Layer>* layer_ptr, | 294 std::unique_ptr<ui::Layer>* layer_ptr, |
| 295 scoped_ptr<ImagePainter>* painter_ptr, | 295 std::unique_ptr<ImagePainter>* painter_ptr, |
| 296 ImageType type) { | 296 ImageType type) { |
| 297 // Minimum width (for HORIZONTAL) or height (for VERTICAL) of the | 297 // Minimum width (for HORIZONTAL) or height (for VERTICAL) of the |
| 298 // |image| so that layers are scaled property if the device scale | 298 // |image| so that layers are scaled property if the device scale |
| 299 // factor is non integral. | 299 // factor is non integral. |
| 300 const int kMinimumSize = 20; | 300 const int kMinimumSize = 20; |
| 301 | 301 |
| 302 // Clean out old layers and painters. | 302 // Clean out old layers and painters. |
| 303 layer_ptr->reset(); | 303 layer_ptr->reset(); |
| 304 painter_ptr->reset(); | 304 painter_ptr->reset(); |
| 305 | 305 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 336 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); | 336 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); |
| 337 | 337 |
| 338 painter_ptr->reset(new ImagePainter(image_skia)); | 338 painter_ptr->reset(new ImagePainter(image_skia)); |
| 339 layer_ptr->get()->set_delegate(painter_ptr->get()); | 339 layer_ptr->get()->set_delegate(painter_ptr->get()); |
| 340 layer_ptr->get()->SetFillsBoundsOpaquely(false); | 340 layer_ptr->get()->SetFillsBoundsOpaquely(false); |
| 341 layer_ptr->get()->SetVisible(true); | 341 layer_ptr->get()->SetVisible(true); |
| 342 layer_->Add(layer_ptr->get()); | 342 layer_->Add(layer_ptr->get()); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace wm | 345 } // namespace wm |
| OLD | NEW |