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 "ui/gfx/compositor/layer.h" | 5 #include "ui/gfx/compositor/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 gfx::Rect draw_rect = texture_.get() ? invalid_rect_.Intersect(local_bounds) : | 271 gfx::Rect draw_rect = texture_.get() ? invalid_rect_.Intersect(local_bounds) : |
272 local_bounds; | 272 local_bounds; |
273 if (draw_rect.IsEmpty()) { | 273 if (draw_rect.IsEmpty()) { |
274 invalid_rect_ = gfx::Rect(); | 274 invalid_rect_ = gfx::Rect(); |
275 return; | 275 return; |
276 } | 276 } |
277 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvas( | 277 scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvas( |
278 draw_rect.width(), draw_rect.height(), false)); | 278 draw_rect.width(), draw_rect.height(), false)); |
279 canvas->TranslateInt(-draw_rect.x(), -draw_rect.y()); | 279 canvas->TranslateInt(-draw_rect.x(), -draw_rect.y()); |
280 delegate_->OnPaintLayer(canvas.get()); | 280 delegate_->OnPaintLayer(canvas.get()); |
281 SetCanvas(*canvas->AsCanvasSkia(), draw_rect.origin()); | 281 SetCanvas(*canvas->GetSkCanvas(), draw_rect.origin()); |
282 } | 282 } |
283 | 283 |
284 void Layer::RecomputeHole() { | 284 void Layer::RecomputeHole() { |
285 if (type_ == LAYER_HAS_NO_TEXTURE) | 285 if (type_ == LAYER_HAS_NO_TEXTURE) |
286 return; | 286 return; |
287 | 287 |
288 // Reset to default. | 288 // Reset to default. |
289 hole_rect_ = gfx::Rect(); | 289 hole_rect_ = gfx::Rect(); |
290 | 290 |
291 // 1) We cannot do any hole punching if any child has a transform. | 291 // 1) We cannot do any hole punching if any child has a transform. |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 void Layer::SetTransformFromAnimator(const Transform& transform) { | 479 void Layer::SetTransformFromAnimator(const Transform& transform) { |
480 SetTransformImmediately(transform); | 480 SetTransformImmediately(transform); |
481 } | 481 } |
482 | 482 |
483 void Layer::SetOpacityFromAnimator(float opacity) { | 483 void Layer::SetOpacityFromAnimator(float opacity) { |
484 SetOpacityImmediately(opacity); | 484 SetOpacityImmediately(opacity); |
485 } | 485 } |
486 | 486 |
487 } // namespace ui | 487 } // namespace ui |
OLD | NEW |