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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 content_bounds.width() + left_image_width_ + right_image_width_, | 252 content_bounds.width() + left_image_width_ + right_image_width_, |
253 content_bounds.height() + top_image_height_ + | 253 content_bounds.height() + top_image_height_ + |
254 bottom_image_height_)); | 254 bottom_image_height_)); |
255 layer_->SetBounds( | 255 layer_->SetBounds( |
256 gfx::Rect(content_bounds.x() - left_image_width_, | 256 gfx::Rect(content_bounds.x() - left_image_width_, |
257 content_bounds.y() - top_image_height_, | 257 content_bounds.y() - top_image_height_, |
258 layer_->bounds().width(), | 258 layer_->bounds().width(), |
259 layer_->bounds().height())); | 259 layer_->bounds().height())); |
260 } | 260 } |
261 | 261 |
| 262 ImageGrid::ImagePainter::ImagePainter(const gfx::ImageSkia& image) |
| 263 : image_(image) {} |
| 264 |
262 void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect, | 265 void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect, |
263 ui::Layer* layer) { | 266 ui::Layer* layer) { |
264 if (clip_rect != clip_rect_) { | 267 if (clip_rect != clip_rect_) { |
265 clip_rect_ = clip_rect; | 268 clip_rect_ = clip_rect; |
266 layer->SchedulePaint(layer->bounds()); | 269 layer->SchedulePaint(layer->bounds()); |
267 } | 270 } |
268 } | 271 } |
269 | 272 |
270 void ImageGrid::ImagePainter::OnPaintLayer(const ui::PaintContext& context) { | 273 void ImageGrid::ImagePainter::OnPaintLayer(const ui::PaintContext& context) { |
271 gfx::Size bounding_size(clip_rect_.right(), clip_rect_.bottom()); | 274 gfx::Size bounding_size(clip_rect_.right(), clip_rect_.bottom()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); | 339 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); |
337 | 340 |
338 painter_ptr->reset(new ImagePainter(image_skia)); | 341 painter_ptr->reset(new ImagePainter(image_skia)); |
339 layer_ptr->get()->set_delegate(painter_ptr->get()); | 342 layer_ptr->get()->set_delegate(painter_ptr->get()); |
340 layer_ptr->get()->SetFillsBoundsOpaquely(false); | 343 layer_ptr->get()->SetFillsBoundsOpaquely(false); |
341 layer_ptr->get()->SetVisible(true); | 344 layer_ptr->get()->SetVisible(true); |
342 layer_->Add(layer_ptr->get()); | 345 layer_->Add(layer_ptr->get()); |
343 } | 346 } |
344 | 347 |
345 } // namespace wm | 348 } // namespace wm |
OLD | NEW |