| 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 "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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 layer->SchedulePaint(layer->bounds()); | 223 layer->SchedulePaint(layer->bounds()); |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) { | 227 void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) { |
| 228 if (!clip_rect_.IsEmpty()) | 228 if (!clip_rect_.IsEmpty()) |
| 229 canvas->ClipRect(clip_rect_); | 229 canvas->ClipRect(clip_rect_); |
| 230 canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0); | 230 canvas->DrawBitmapInt(*(image_->ToSkBitmap()), 0, 0); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( |
| 234 float device_scale_factor) { |
| 235 // Redrawing will take care of scale factor change. |
| 236 } |
| 237 |
| 233 // static | 238 // static |
| 234 gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) { | 239 gfx::Size ImageGrid::GetImageSize(const gfx::Image* image) { |
| 235 return image ? | 240 return image ? |
| 236 gfx::Size(image->ToSkBitmap()->width(), image->ToSkBitmap()->height()) : | 241 gfx::Size(image->ToSkBitmap()->width(), image->ToSkBitmap()->height()) : |
| 237 gfx::Size(); | 242 gfx::Size(); |
| 238 } | 243 } |
| 239 | 244 |
| 240 // static | 245 // static |
| 241 bool ImageGrid::LayerExceedsSize(const ui::Layer* layer, | 246 bool ImageGrid::LayerExceedsSize(const ui::Layer* layer, |
| 242 const gfx::Size& size) { | 247 const gfx::Size& size) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 265 | 270 |
| 266 painter_ptr->reset(new ImagePainter(image)); | 271 painter_ptr->reset(new ImagePainter(image)); |
| 267 layer_ptr->get()->set_delegate(painter_ptr->get()); | 272 layer_ptr->get()->set_delegate(painter_ptr->get()); |
| 268 layer_ptr->get()->SetFillsBoundsOpaquely(false); | 273 layer_ptr->get()->SetFillsBoundsOpaquely(false); |
| 269 layer_ptr->get()->SetVisible(true); | 274 layer_ptr->get()->SetVisible(true); |
| 270 layer_->Add(layer_ptr->get()); | 275 layer_->Add(layer_ptr->get()); |
| 271 } | 276 } |
| 272 | 277 |
| 273 } // namespace internal | 278 } // namespace internal |
| 274 } // namespace ash | 279 } // namespace ash |
| OLD | NEW |