| 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 "content/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 root_layer_->SetBounds(size); | 432 root_layer_->SetBounds(size); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void CompositorImpl::SetHasTransparentBackground(bool flag) { | 435 void CompositorImpl::SetHasTransparentBackground(bool flag) { |
| 436 has_transparent_background_ = flag; | 436 has_transparent_background_ = flag; |
| 437 if (host_) | 437 if (host_) |
| 438 host_->set_has_transparent_background(flag); | 438 host_->set_has_transparent_background(flag); |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool CompositorImpl::CompositeAndReadback(void *pixels, const gfx::Rect& rect) { | 441 bool CompositorImpl::CompositeAndReadback(void *pixels, const gfx::Rect& rect) { |
| 442 if (host_) | 442 return false; |
| 443 return host_->CompositeAndReadback(pixels, rect); | |
| 444 else | |
| 445 return false; | |
| 446 } | 443 } |
| 447 | 444 |
| 448 void CompositorImpl::SetNeedsComposite() { | 445 void CompositorImpl::SetNeedsComposite() { |
| 449 if (!host_.get() || needs_composite_) | 446 if (!host_.get() || needs_composite_) |
| 450 return; | 447 return; |
| 451 | 448 |
| 452 needs_composite_ = true; | 449 needs_composite_ = true; |
| 453 | 450 |
| 454 // For explicit requests we try to composite regularly on vsync. | 451 // For explicit requests we try to composite regularly on vsync. |
| 455 should_composite_on_vsync_ = true; | 452 should_composite_on_vsync_ = true; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 } | 613 } |
| 617 | 614 |
| 618 void CompositorImpl::DidCommit() { | 615 void CompositorImpl::DidCommit() { |
| 619 root_window_->OnCompositingDidCommit(); | 616 root_window_->OnCompositingDidCommit(); |
| 620 } | 617 } |
| 621 | 618 |
| 622 void CompositorImpl::AttachLayerForReadback(scoped_refptr<cc::Layer> layer) { | 619 void CompositorImpl::AttachLayerForReadback(scoped_refptr<cc::Layer> layer) { |
| 623 root_layer_->AddChild(layer); | 620 root_layer_->AddChild(layer); |
| 624 } | 621 } |
| 625 | 622 |
| 623 void CompositorImpl::RequestCopyOfOutputOnRootLayer( |
| 624 scoped_ptr<cc::CopyOutputRequest> request) { |
| 625 if (root_layer_) |
| 626 root_layer_->RequestCopyOfOutput(request.Pass()); |
| 627 } |
| 628 |
| 626 void CompositorImpl::OnVSync(base::TimeTicks frame_time, | 629 void CompositorImpl::OnVSync(base::TimeTicks frame_time, |
| 627 base::TimeDelta vsync_period) { | 630 base::TimeDelta vsync_period) { |
| 628 vsync_period_ = vsync_period; | 631 vsync_period_ = vsync_period; |
| 629 did_composite_this_frame_ = false; | 632 did_composite_this_frame_ = false; |
| 630 | 633 |
| 631 if (should_composite_on_vsync_) | 634 if (should_composite_on_vsync_) |
| 632 Composite(COMPOSITE_ON_VSYNC); | 635 Composite(COMPOSITE_ON_VSYNC); |
| 633 } | 636 } |
| 634 | 637 |
| 635 } // namespace content | 638 } // namespace content |
| OLD | NEW |