| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/gpu/image_transport_surface_overlay_mac.h" | 5 #include "content/common/gpu/image_transport_surface_overlay_mac.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
| 9 #include <OpenGL/CGLRenderers.h> | 9 #include <OpenGL/CGLRenderers.h> |
| 10 #include <OpenGL/CGLTypes.h> | 10 #include <OpenGL/CGLTypes.h> |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 if (!allocated) { | 654 if (!allocated) { |
| 655 DisplayAndClearAllPendingSwaps(); | 655 DisplayAndClearAllPendingSwaps(); |
| 656 last_swap_time_ = base::TimeTicks(); | 656 last_swap_time_ = base::TimeTicks(); |
| 657 } | 657 } |
| 658 return true; | 658 return true; |
| 659 } | 659 } |
| 660 | 660 |
| 661 bool ImageTransportSurfaceOverlayMac::ScheduleOverlayPlane( | 661 bool ImageTransportSurfaceOverlayMac::ScheduleOverlayPlane( |
| 662 int z_order, | 662 int z_order, |
| 663 gfx::OverlayTransform transform, | 663 gfx::OverlayTransform transform, |
| 664 gfx::GLImage* image, | 664 gl::GLImage* image, |
| 665 const gfx::Rect& bounds_rect, | 665 const gfx::Rect& bounds_rect, |
| 666 const gfx::RectF& crop_rect) { | 666 const gfx::RectF& crop_rect) { |
| 667 DCHECK_EQ(transform, gfx::OVERLAY_TRANSFORM_NONE); | 667 DCHECK_EQ(transform, gfx::OVERLAY_TRANSFORM_NONE); |
| 668 if (transform != gfx::OVERLAY_TRANSFORM_NONE) | 668 if (transform != gfx::OVERLAY_TRANSFORM_NONE) |
| 669 return false; | 669 return false; |
| 670 | 670 |
| 671 linked_ptr<OverlayPlane> plane(new OverlayPlane( | 671 linked_ptr<OverlayPlane> plane(new OverlayPlane( |
| 672 z_order, static_cast<gfx::GLImageIOSurface*>(image)->io_surface_id().id, | 672 z_order, static_cast<gl::GLImageIOSurface*>(image)->io_surface_id().id, |
| 673 static_cast<gfx::GLImageIOSurface*>(image)->io_surface(), | 673 static_cast<gl::GLImageIOSurface*>(image)->io_surface(), |
| 674 ConvertRectToDIPF(scale_factor_, bounds_rect), crop_rect)); | 674 ConvertRectToDIPF(scale_factor_, bounds_rect), crop_rect)); |
| 675 if (z_order == 0) | 675 if (z_order == 0) |
| 676 pending_root_plane_ = plane; | 676 pending_root_plane_ = plane; |
| 677 else | 677 else |
| 678 pending_overlay_planes_.push_back(plane); | 678 pending_overlay_planes_.push_back(plane); |
| 679 | 679 |
| 680 return true; | 680 return true; |
| 681 } | 681 } |
| 682 | 682 |
| 683 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { | 683 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 // Compute the previous vsync time. | 742 // Compute the previous vsync time. |
| 743 base::TimeTicks previous_vsync = | 743 base::TimeTicks previous_vsync = |
| 744 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + | 744 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + |
| 745 vsync_timebase_; | 745 vsync_timebase_; |
| 746 | 746 |
| 747 // Return |interval_fraction| through the next vsync. | 747 // Return |interval_fraction| through the next vsync. |
| 748 return previous_vsync + (1 + interval_fraction) * vsync_interval_; | 748 return previous_vsync + (1 + interval_fraction) * vsync_interval_; |
| 749 } | 749 } |
| 750 | 750 |
| 751 } // namespace content | 751 } // namespace content |
| OLD | NEW |