| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 DCHECK(is_swap_buffers_pending_); | 177 DCHECK(is_swap_buffers_pending_); |
| 178 is_swap_buffers_pending_ = false; | 178 is_swap_buffers_pending_ = false; |
| 179 if (did_unschedule_) { | 179 if (did_unschedule_) { |
| 180 did_unschedule_ = false; | 180 did_unschedule_ = false; |
| 181 helper_->SetScheduled(true); | 181 helper_->SetScheduled(true); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 void ImageTransportSurfaceFBO::OnResize(gfx::Size size, | 185 void ImageTransportSurfaceFBO::OnResize(gfx::Size size, |
| 186 float scale_factor) { | 186 float scale_factor) { |
| 187 // This trace event is used in gpu_feature_browsertest.cc - the test will need | |
| 188 // to be updated if this event is changed or moved. | |
| 189 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::OnResize", | 187 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::OnResize", |
| 190 "old_width", size_.width(), "new_width", size.width()); | 188 "old_width", size_.width(), "new_width", size.width()); |
| 191 // Caching |context_| from OnMakeCurrent. It should still be current. | 189 // Caching |context_| from OnMakeCurrent. It should still be current. |
| 192 DCHECK(context_->IsCurrent(this)); | 190 DCHECK(context_->IsCurrent(this)); |
| 193 | 191 |
| 194 size_ = size; | 192 size_ = size; |
| 195 scale_factor_ = scale_factor; | 193 scale_factor_ = scale_factor; |
| 196 | 194 |
| 197 CreateFramebuffer(); | 195 CreateFramebuffer(); |
| 198 } | 196 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 has_complete_framebuffer_ = false; | 239 has_complete_framebuffer_ = false; |
| 242 } | 240 } |
| 243 | 241 |
| 244 void ImageTransportSurfaceFBO::CreateFramebuffer() { | 242 void ImageTransportSurfaceFBO::CreateFramebuffer() { |
| 245 gfx::Size new_rounded_size = storage_provider_->GetRoundedSize(size_); | 243 gfx::Size new_rounded_size = storage_provider_->GetRoundedSize(size_); |
| 246 | 244 |
| 247 // Only recreate surface when the rounded up size has changed. | 245 // Only recreate surface when the rounded up size has changed. |
| 248 if (has_complete_framebuffer_ && new_rounded_size == rounded_size_) | 246 if (has_complete_framebuffer_ && new_rounded_size == rounded_size_) |
| 249 return; | 247 return; |
| 250 | 248 |
| 251 // This trace event is used in gpu_feature_browsertest.cc - the test will need | |
| 252 // to be updated if this event is changed or moved. | |
| 253 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::CreateFramebuffer", | 249 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::CreateFramebuffer", |
| 254 "width", new_rounded_size.width(), | 250 "width", new_rounded_size.width(), |
| 255 "height", new_rounded_size.height()); | 251 "height", new_rounded_size.height()); |
| 256 | 252 |
| 257 rounded_size_ = new_rounded_size; | 253 rounded_size_ = new_rounded_size; |
| 258 | 254 |
| 259 // GL_TEXTURE_RECTANGLE_ARB is the best supported render target on | 255 // GL_TEXTURE_RECTANGLE_ARB is the best supported render target on |
| 260 // Mac OS X and is required for IOSurface interoperability. | 256 // Mac OS X and is required for IOSurface interoperability. |
| 261 GLint previous_texture_id = 0; | 257 GLint previous_texture_id = 0; |
| 262 glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, &previous_texture_id); | 258 glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, &previous_texture_id); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 return; | 325 return; |
| 330 } | 326 } |
| 331 | 327 |
| 332 has_complete_framebuffer_ = true; | 328 has_complete_framebuffer_ = true; |
| 333 | 329 |
| 334 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id); | 330 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id); |
| 335 // The FBO remains bound for this GL context. | 331 // The FBO remains bound for this GL context. |
| 336 } | 332 } |
| 337 | 333 |
| 338 } // namespace content | 334 } // namespace content |
| OLD | NEW |