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 <CoreGraphics/CoreGraphics.h> | 8 #include <CoreGraphics/CoreGraphics.h> |
9 #include <IOSurface/IOSurface.h> | 9 #include <IOSurface/IOSurface.h> |
10 #include <OpenGL/CGLRenderers.h> | 10 #include <OpenGL/CGLRenderers.h> |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 pending_overlay_planes_.push_back(plane); | 753 pending_overlay_planes_.push_back(plane); |
754 | 754 |
755 return true; | 755 return true; |
756 } | 756 } |
757 | 757 |
758 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer( | 758 bool ImageTransportSurfaceOverlayMac::ScheduleCALayer( |
759 gl::GLImage* contents_image, | 759 gl::GLImage* contents_image, |
760 const gfx::RectF& contents_rect, | 760 const gfx::RectF& contents_rect, |
761 float opacity, | 761 float opacity, |
762 unsigned background_color, | 762 unsigned background_color, |
763 const gfx::SizeF& bounds_size, | 763 unsigned edge_aa_mask, |
| 764 const gfx::RectF& bounds_rect, |
| 765 bool is_clipped, |
| 766 const gfx::RectF& clip_rect, |
764 const gfx::Transform& transform) { | 767 const gfx::Transform& transform) { |
765 // Extract the IOSurface, if this layer is not just a solid color. | 768 // Extract the IOSurface, if this layer is not just a solid color. |
766 int io_surface_id = 0; | 769 int io_surface_id = 0; |
767 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; | 770 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; |
768 if (contents_image) { | 771 if (contents_image) { |
769 io_surface_id = | 772 io_surface_id = |
770 static_cast<gl::GLImageIOSurface*>(contents_image)->io_surface_id().id; | 773 static_cast<gl::GLImageIOSurface*>(contents_image)->io_surface_id().id; |
771 io_surface = | 774 io_surface = |
772 static_cast<gl::GLImageIOSurface*>(contents_image)->io_surface(); | 775 static_cast<gl::GLImageIOSurface*>(contents_image)->io_surface(); |
773 } | 776 } |
774 | 777 |
775 // Convert the RGBA SkColor to an sRGB CGColorRef. | 778 // Convert the RGBA SkColor to an sRGB CGColorRef. |
776 CGFloat rgba_color_components[4] = { | 779 CGFloat rgba_color_components[4] = { |
777 SkColorGetR(background_color) / 255., | 780 SkColorGetR(background_color) / 255., |
778 SkColorGetG(background_color) / 255., | 781 SkColorGetG(background_color) / 255., |
779 SkColorGetB(background_color) / 255., | 782 SkColorGetB(background_color) / 255., |
780 SkColorGetA(background_color) / 255., | 783 SkColorGetA(background_color) / 255., |
781 }; | 784 }; |
782 base::ScopedCFTypeRef<CGColorRef> srgb_background_color(CGColorCreate( | 785 base::ScopedCFTypeRef<CGColorRef> srgb_background_color(CGColorCreate( |
783 CGColorSpaceCreateWithName(kCGColorSpaceSRGB), rgba_color_components)); | 786 CGColorSpaceCreateWithName(kCGColorSpaceSRGB), rgba_color_components)); |
784 | 787 |
785 pending_overlay_planes_.push_back(OverlayPlane::CreateWithTransform( | 788 pending_overlay_planes_.push_back(OverlayPlane::CreateWithTransform( |
786 next_ca_layer_z_order_++, io_surface_id, io_surface, contents_rect, | 789 next_ca_layer_z_order_++, io_surface_id, io_surface, contents_rect, |
787 opacity, srgb_background_color, bounds_size, transform)); | 790 opacity, srgb_background_color, bounds_rect.size(), transform)); |
788 return true; | 791 return true; |
789 } | 792 } |
790 | 793 |
791 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { | 794 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { |
792 return true; | 795 return true; |
793 } | 796 } |
794 | 797 |
795 void ImageTransportSurfaceOverlayMac::OnBufferPresented( | 798 void ImageTransportSurfaceOverlayMac::OnBufferPresented( |
796 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 799 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |
797 vsync_timebase_ = params.vsync_timebase; | 800 vsync_timebase_ = params.vsync_timebase; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 // Compute the previous vsync time. | 854 // Compute the previous vsync time. |
852 base::TimeTicks previous_vsync = | 855 base::TimeTicks previous_vsync = |
853 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + | 856 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + |
854 vsync_timebase_; | 857 vsync_timebase_; |
855 | 858 |
856 // Return |interval_fraction| through the next vsync. | 859 // Return |interval_fraction| through the next vsync. |
857 return previous_vsync + (1 + interval_fraction) * vsync_interval_; | 860 return previous_vsync + (1 + interval_fraction) * vsync_interval_; |
858 } | 861 } |
859 | 862 |
860 } // namespace content | 863 } // namespace content |
OLD | NEW |