| 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 "ash/wm/image_grid.h" | 5 #include "ash/wm/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/gfx/canvas.h" | 11 #include "ui/gfx/canvas.h" |
| 12 #include "ui/gfx/image/image.h" | 12 #include "ui/gfx/image/image.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 #include "ui/gfx/transform.h" | 14 #include "ui/gfx/transform.h" |
| 15 | 15 |
| 16 using std::max; | 16 using std::max; |
| 17 using std::min; | 17 using std::min; |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 namespace internal { | 20 namespace internal { |
| 21 | 21 |
| 22 gfx::Rect ImageGrid::TestAPI::GetTransformedLayerBounds( | 22 gfx::Rect ImageGrid::TestAPI::GetTransformedLayerBounds( |
| 23 const ui::Layer& layer) { | 23 const ui::Layer& layer) { |
| 24 gfx::Rect bounds = layer.bounds(); | 24 gfx::RectF bounds = layer.bounds(); |
| 25 layer.transform().TransformRect(&bounds); | 25 layer.transform().TransformRect(&bounds); |
| 26 return bounds; | 26 return gfx::ToEnclosingRect(bounds); |
| 27 } | 27 } |
| 28 | 28 |
| 29 ImageGrid::ImageGrid() | 29 ImageGrid::ImageGrid() |
| 30 : layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), | 30 : layer_(new ui::Layer(ui::LAYER_NOT_DRAWN)), |
| 31 top_image_height_(0), | 31 top_image_height_(0), |
| 32 bottom_image_height_(0), | 32 bottom_image_height_(0), |
| 33 left_image_width_(0), | 33 left_image_width_(0), |
| 34 right_image_width_(0), | 34 right_image_width_(0), |
| 35 base_top_row_height_(0), | 35 base_top_row_height_(0), |
| 36 base_bottom_row_height_(0), | 36 base_bottom_row_height_(0), |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 274 |
| 275 painter_ptr->reset(new ImagePainter(image)); | 275 painter_ptr->reset(new ImagePainter(image)); |
| 276 layer_ptr->get()->set_delegate(painter_ptr->get()); | 276 layer_ptr->get()->set_delegate(painter_ptr->get()); |
| 277 layer_ptr->get()->SetFillsBoundsOpaquely(false); | 277 layer_ptr->get()->SetFillsBoundsOpaquely(false); |
| 278 layer_ptr->get()->SetVisible(true); | 278 layer_ptr->get()->SetVisible(true); |
| 279 layer_->Add(layer_ptr->get()); | 279 layer_->Add(layer_ptr->get()); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace internal | 282 } // namespace internal |
| 283 } // namespace ash | 283 } // namespace ash |
| OLD | NEW |