| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 void ImageGrid::Init(const gfx::Image* top_left_image, | 42 void ImageGrid::Init(const gfx::Image* top_left_image, |
| 43 const gfx::Image* top_image, | 43 const gfx::Image* top_image, |
| 44 const gfx::Image* top_right_image, | 44 const gfx::Image* top_right_image, |
| 45 const gfx::Image* left_image, | 45 const gfx::Image* left_image, |
| 46 const gfx::Image* center_image, | 46 const gfx::Image* center_image, |
| 47 const gfx::Image* right_image, | 47 const gfx::Image* right_image, |
| 48 const gfx::Image* bottom_left_image, | 48 const gfx::Image* bottom_left_image, |
| 49 const gfx::Image* bottom_image, | 49 const gfx::Image* bottom_image, |
| 50 const gfx::Image* bottom_right_image) { | 50 const gfx::Image* bottom_right_image) { |
| 51 layer_.reset(new ui::Layer(ui::Layer::LAYER_HAS_NO_TEXTURE)); | 51 layer_.reset(new ui::Layer(ui::Layer::LAYER_NOT_DRAWN)); |
| 52 | 52 |
| 53 InitImage(top_left_image, &top_left_layer_, &top_left_painter_); | 53 InitImage(top_left_image, &top_left_layer_, &top_left_painter_); |
| 54 InitImage(top_image, &top_layer_, &top_painter_); | 54 InitImage(top_image, &top_layer_, &top_painter_); |
| 55 InitImage(top_right_image, &top_right_layer_, &top_right_painter_); | 55 InitImage(top_right_image, &top_right_layer_, &top_right_painter_); |
| 56 InitImage(left_image, &left_layer_, &left_painter_); | 56 InitImage(left_image, &left_layer_, &left_painter_); |
| 57 InitImage(center_image, ¢er_layer_, ¢er_painter_); | 57 InitImage(center_image, ¢er_layer_, ¢er_painter_); |
| 58 InitImage(right_image, &right_layer_, &right_painter_); | 58 InitImage(right_image, &right_layer_, &right_painter_); |
| 59 InitImage(bottom_left_image, &bottom_left_layer_, &bottom_left_painter_); | 59 InitImage(bottom_left_image, &bottom_left_layer_, &bottom_left_painter_); |
| 60 InitImage(bottom_image, &bottom_layer_, &bottom_painter_); | 60 InitImage(bottom_image, &bottom_layer_, &bottom_painter_); |
| 61 InitImage(bottom_right_image, &bottom_right_layer_, &bottom_right_painter_); | 61 InitImage(bottom_right_image, &bottom_right_layer_, &bottom_right_painter_); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return layer->bounds().width() > size.width() || | 223 return layer->bounds().width() > size.width() || |
| 224 layer->bounds().height() > size.height(); | 224 layer->bounds().height() > size.height(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void ImageGrid::InitImage(const gfx::Image* image, | 227 void ImageGrid::InitImage(const gfx::Image* image, |
| 228 scoped_ptr<ui::Layer>* layer_ptr, | 228 scoped_ptr<ui::Layer>* layer_ptr, |
| 229 scoped_ptr<ImagePainter>* painter_ptr) { | 229 scoped_ptr<ImagePainter>* painter_ptr) { |
| 230 if (!image) | 230 if (!image) |
| 231 return; | 231 return; |
| 232 | 232 |
| 233 layer_ptr->reset(new ui::Layer(ui::Layer::LAYER_HAS_TEXTURE)); | 233 layer_ptr->reset(new ui::Layer(ui::Layer::LAYER_TEXTURED)); |
| 234 | 234 |
| 235 const gfx::Size size = GetImageSize(image); | 235 const gfx::Size size = GetImageSize(image); |
| 236 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); | 236 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); |
| 237 | 237 |
| 238 painter_ptr->reset(new ImagePainter(image)); | 238 painter_ptr->reset(new ImagePainter(image)); |
| 239 layer_ptr->get()->set_delegate(painter_ptr->get()); | 239 layer_ptr->get()->set_delegate(painter_ptr->get()); |
| 240 layer_ptr->get()->SetFillsBoundsOpaquely(false); | 240 layer_ptr->get()->SetFillsBoundsOpaquely(false); |
| 241 layer_ptr->get()->SetVisible(true); | 241 layer_ptr->get()->SetVisible(true); |
| 242 layer_->Add(layer_ptr->get()); | 242 layer_->Add(layer_ptr->get()); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace internal | 245 } // namespace internal |
| 246 } // namespace ash | 246 } // namespace ash |
| OLD | NEW |