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/compositor/paint_context.h" |
12 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
13 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/rect_conversions.h" | 15 #include "ui/gfx/geometry/rect_conversions.h" |
15 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/geometry/size_conversions.h" | 17 #include "ui/gfx/geometry/size_conversions.h" |
17 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
18 #include "ui/gfx/image/image_skia_operations.h" | 19 #include "ui/gfx/image/image_skia_operations.h" |
19 #include "ui/gfx/transform.h" | 20 #include "ui/gfx/transform.h" |
20 | 21 |
21 using std::max; | 22 using std::max; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 260 } |
260 | 261 |
261 void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect, | 262 void ImageGrid::ImagePainter::SetClipRect(const gfx::Rect& clip_rect, |
262 ui::Layer* layer) { | 263 ui::Layer* layer) { |
263 if (clip_rect != clip_rect_) { | 264 if (clip_rect != clip_rect_) { |
264 clip_rect_ = clip_rect; | 265 clip_rect_ = clip_rect; |
265 layer->SchedulePaint(layer->bounds()); | 266 layer->SchedulePaint(layer->bounds()); |
266 } | 267 } |
267 } | 268 } |
268 | 269 |
269 void ImageGrid::ImagePainter::OnPaintLayer(gfx::Canvas* canvas) { | 270 void ImageGrid::ImagePainter::OnPaintLayer(const ui::PaintContext& context) { |
270 if (!clip_rect_.IsEmpty()) | 271 if (!clip_rect_.IsEmpty()) |
271 canvas->ClipRect(clip_rect_); | 272 context.canvas()->ClipRect(clip_rect_); |
272 canvas->DrawImageInt(image_, 0, 0); | 273 context.canvas()->DrawImageInt(image_, 0, 0); |
273 } | 274 } |
274 | 275 |
275 void ImageGrid::ImagePainter::OnDelegatedFrameDamage( | 276 void ImageGrid::ImagePainter::OnDelegatedFrameDamage( |
276 const gfx::Rect& damage_rect_in_dip) { | 277 const gfx::Rect& damage_rect_in_dip) { |
277 } | 278 } |
278 | 279 |
279 void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( | 280 void ImageGrid::ImagePainter::OnDeviceScaleFactorChanged( |
280 float device_scale_factor) { | 281 float device_scale_factor) { |
281 // Redrawing will take care of scale factor change. | 282 // Redrawing will take care of scale factor change. |
282 } | 283 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); | 334 layer_ptr->get()->SetBounds(gfx::Rect(0, 0, size.width(), size.height())); |
334 | 335 |
335 painter_ptr->reset(new ImagePainter(image_skia)); | 336 painter_ptr->reset(new ImagePainter(image_skia)); |
336 layer_ptr->get()->set_delegate(painter_ptr->get()); | 337 layer_ptr->get()->set_delegate(painter_ptr->get()); |
337 layer_ptr->get()->SetFillsBoundsOpaquely(false); | 338 layer_ptr->get()->SetFillsBoundsOpaquely(false); |
338 layer_ptr->get()->SetVisible(true); | 339 layer_ptr->get()->SetVisible(true); |
339 layer_->Add(layer_ptr->get()); | 340 layer_->Add(layer_ptr->get()); |
340 } | 341 } |
341 | 342 |
342 } // namespace wm | 343 } // namespace wm |
OLD | NEW |