OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_fbo_mac.h" | 5 #include "content/common/gpu/image_transport_surface_fbo_mac.h" |
6 | 6 |
7 #include "content/common/gpu/gpu_messages.h" | 7 #include "content/common/gpu/gpu_messages.h" |
8 #include "content/common/gpu/image_transport_surface_calayer_mac.h" | 8 #include "content/common/gpu/image_transport_surface_calayer_mac.h" |
9 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" | 9 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" |
10 #include "ui/base/cocoa/remote_layer_api.h" | 10 #include "ui/base/cocoa/remote_layer_api.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 float scale_factor) { | 131 float scale_factor) { |
132 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 132 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
133 params.surface_handle = surface_handle; | 133 params.surface_handle = surface_handle; |
134 params.size = pixel_size; | 134 params.size = pixel_size; |
135 params.scale_factor = scale_factor; | 135 params.scale_factor = scale_factor; |
136 params.latency_info.swap(latency_info_); | 136 params.latency_info.swap(latency_info_); |
137 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 137 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
138 is_swap_buffers_send_pending_ = false; | 138 is_swap_buffers_send_pending_ = false; |
139 } | 139 } |
140 | 140 |
| 141 void ImageTransportSurfaceFBO::SetRendererID(int renderer_id) { |
| 142 if (renderer_id) |
| 143 context_->share_group()->SetRendererID(renderer_id); |
| 144 } |
| 145 |
141 bool ImageTransportSurfaceFBO::PostSubBuffer( | 146 bool ImageTransportSurfaceFBO::PostSubBuffer( |
142 int x, int y, int width, int height) { | 147 int x, int y, int width, int height) { |
143 // Mac does not support sub-buffer swaps. | 148 // Mac does not support sub-buffer swaps. |
144 NOTREACHED(); | 149 NOTREACHED(); |
145 return false; | 150 return false; |
146 } | 151 } |
147 | 152 |
148 bool ImageTransportSurfaceFBO::SupportsPostSubBuffer() { | 153 bool ImageTransportSurfaceFBO::SupportsPostSubBuffer() { |
149 return true; | 154 return true; |
150 } | 155 } |
151 | 156 |
152 gfx::Size ImageTransportSurfaceFBO::GetSize() { | 157 gfx::Size ImageTransportSurfaceFBO::GetSize() { |
153 return size_; | 158 return size_; |
154 } | 159 } |
155 | 160 |
156 void* ImageTransportSurfaceFBO::GetHandle() { | 161 void* ImageTransportSurfaceFBO::GetHandle() { |
157 return NULL; | 162 return NULL; |
158 } | 163 } |
159 | 164 |
160 void* ImageTransportSurfaceFBO::GetDisplay() { | 165 void* ImageTransportSurfaceFBO::GetDisplay() { |
161 return NULL; | 166 return NULL; |
162 } | 167 } |
163 | 168 |
164 void ImageTransportSurfaceFBO::OnBufferPresented( | 169 void ImageTransportSurfaceFBO::OnBufferPresented( |
165 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 170 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |
166 context_->share_group()->SetRendererID(params.renderer_id); | 171 SetRendererID(params.renderer_id); |
167 storage_provider_->SwapBuffersAckedByBrowser(params.disable_throttling); | 172 storage_provider_->SwapBuffersAckedByBrowser(params.disable_throttling); |
168 } | 173 } |
169 | 174 |
170 void ImageTransportSurfaceFBO::OnResize(gfx::Size size, | 175 void ImageTransportSurfaceFBO::OnResize(gfx::Size size, |
171 float scale_factor) { | 176 float scale_factor) { |
172 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::OnResize", | 177 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::OnResize", |
173 "old_width", size_.width(), "new_width", size.width()); | 178 "old_width", size_.width(), "new_width", size.width()); |
174 // Caching |context_| from OnMakeCurrent. It should still be current. | 179 // Caching |context_| from OnMakeCurrent. It should still be current. |
175 DCHECK(context_->IsCurrent(this)); | 180 DCHECK(context_->IsCurrent(this)); |
176 | 181 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 return; | 315 return; |
311 } | 316 } |
312 | 317 |
313 has_complete_framebuffer_ = true; | 318 has_complete_framebuffer_ = true; |
314 | 319 |
315 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id); | 320 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id); |
316 // The FBO remains bound for this GL context. | 321 // The FBO remains bound for this GL context. |
317 } | 322 } |
318 | 323 |
319 } // namespace content | 324 } // namespace content |
OLD | NEW |