| 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" |
| 11 #include "ui/compositor/dip_util.h" | 11 #include "ui/compositor/dip_util.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "ui/gfx/rect_conversions.h" | 15 #include "ui/gfx/rect_conversions.h" |
| 16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
| 17 #include "ui/gfx/size_conversions.h" | 17 #include "ui/gfx/size_conversions.h" |
| 18 #include "ui/gfx/transform.h" | 18 #include "ui/gfx/transform.h" |
| 19 | 19 |
| 20 using std::max; | 20 using std::max; |
| 21 using std::min; | 21 using std::min; |
| 22 | 22 |
| 23 namespace views { | 23 namespace wm { |
| 24 namespace corewm { | |
| 25 | 24 |
| 26 gfx::RectF ImageGrid::TestAPI::GetTransformedLayerBounds( | 25 gfx::RectF ImageGrid::TestAPI::GetTransformedLayerBounds( |
| 27 const ui::Layer& layer) { | 26 const ui::Layer& layer) { |
| 28 gfx::RectF bounds = layer.bounds(); | 27 gfx::RectF bounds = layer.bounds(); |
| 29 layer.transform().TransformRect(&bounds); | 28 layer.transform().TransformRect(&bounds); |
| 30 return bounds; | 29 return bounds; |
| 31 } | 30 } |
| 32 | 31 |
| 33 ImageGrid::ImageGrid() | 32 ImageGrid::ImageGrid() |
| 34 : layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), | 33 : layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 296 |
| 298 void ImageGrid::ScaleHeight(gfx::Size center, | 297 void ImageGrid::ScaleHeight(gfx::Size center, |
| 299 ui::Layer* layer, | 298 ui::Layer* layer, |
| 300 gfx::Transform& transform) { | 299 gfx::Transform& transform) { |
| 301 int layer_height = ConvertSizeToPixel(layer, | 300 int layer_height = ConvertSizeToPixel(layer, |
| 302 layer->bounds().size()).height(); | 301 layer->bounds().size()).height(); |
| 303 float scale = static_cast<float>(center.height()) / layer_height; | 302 float scale = static_cast<float>(center.height()) / layer_height; |
| 304 transform.Scale(1.0, scale); | 303 transform.Scale(1.0, scale); |
| 305 } | 304 } |
| 306 | 305 |
| 307 } // namespace corewm | 306 } // namespace wm |
| 308 } // namespace views | |
| OLD | NEW |