| 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/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_cftyperef.h" | 7 #include "base/mac/scoped_cftyperef.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/common/gpu/gpu_command_buffer_stub.h" | 9 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void UnrefIOSurface(); | 75 void UnrefIOSurface(); |
| 76 void CreateIOSurface(); | 76 void CreateIOSurface(); |
| 77 | 77 |
| 78 // Tracks the current buffer allocation state. | 78 // Tracks the current buffer allocation state. |
| 79 bool backbuffer_suggested_allocation_; | 79 bool backbuffer_suggested_allocation_; |
| 80 bool frontbuffer_suggested_allocation_; | 80 bool frontbuffer_suggested_allocation_; |
| 81 | 81 |
| 82 uint32 fbo_id_; | 82 uint32 fbo_id_; |
| 83 GLuint texture_id_; | 83 GLuint texture_id_; |
| 84 | 84 |
| 85 base::mac::ScopedCFTypeRef<CFTypeRef> io_surface_; | 85 base::ScopedCFTypeRef<CFTypeRef> io_surface_; |
| 86 | 86 |
| 87 // The id of |io_surface_| or 0 if that's NULL. | 87 // The id of |io_surface_| or 0 if that's NULL. |
| 88 uint64 io_surface_handle_; | 88 uint64 io_surface_handle_; |
| 89 | 89 |
| 90 // Weak pointer to the context that this was last made current to. | 90 // Weak pointer to the context that this was last made current to. |
| 91 gfx::GLContext* context_; | 91 gfx::GLContext* context_; |
| 92 | 92 |
| 93 gfx::Size size_; | 93 gfx::Size size_; |
| 94 gfx::Size rounded_size_; | 94 gfx::Size rounded_size_; |
| 95 float scale_factor_; | 95 float scale_factor_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 113 void AddBooleanValue(CFMutableDictionaryRef dictionary, | 113 void AddBooleanValue(CFMutableDictionaryRef dictionary, |
| 114 const CFStringRef key, | 114 const CFStringRef key, |
| 115 bool value) { | 115 bool value) { |
| 116 CFDictionaryAddValue(dictionary, key, | 116 CFDictionaryAddValue(dictionary, key, |
| 117 (value ? kCFBooleanTrue : kCFBooleanFalse)); | 117 (value ? kCFBooleanTrue : kCFBooleanFalse)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void AddIntegerValue(CFMutableDictionaryRef dictionary, | 120 void AddIntegerValue(CFMutableDictionaryRef dictionary, |
| 121 const CFStringRef key, | 121 const CFStringRef key, |
| 122 int32 value) { | 122 int32 value) { |
| 123 base::mac::ScopedCFTypeRef<CFNumberRef> number( | 123 base::ScopedCFTypeRef<CFNumberRef> number( |
| 124 CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); | 124 CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); |
| 125 CFDictionaryAddValue(dictionary, key, number.get()); | 125 CFDictionaryAddValue(dictionary, key, number.get()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 IOSurfaceImageTransportSurface::IOSurfaceImageTransportSurface( | 128 IOSurfaceImageTransportSurface::IOSurfaceImageTransportSurface( |
| 129 GpuChannelManager* manager, | 129 GpuChannelManager* manager, |
| 130 GpuCommandBufferStub* stub, | 130 GpuCommandBufferStub* stub, |
| 131 gfx::PluginWindowHandle handle) | 131 gfx::PluginWindowHandle handle) |
| 132 : gfx::NoOpGLSurfaceCGL(gfx::Size(1, 1)), | 132 : gfx::NoOpGLSurfaceCGL(gfx::Size(1, 1)), |
| 133 backbuffer_suggested_allocation_(true), | 133 backbuffer_suggested_allocation_(true), |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 392 glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 393 | 393 |
| 394 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, | 394 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, |
| 395 GL_COLOR_ATTACHMENT0_EXT, | 395 GL_COLOR_ATTACHMENT0_EXT, |
| 396 target, | 396 target, |
| 397 texture_id_, | 397 texture_id_, |
| 398 0); | 398 0); |
| 399 | 399 |
| 400 // Allocate a new IOSurface, which is the GPU resource that can be | 400 // Allocate a new IOSurface, which is the GPU resource that can be |
| 401 // shared across processes. | 401 // shared across processes. |
| 402 base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> properties; | 402 base::ScopedCFTypeRef<CFMutableDictionaryRef> properties; |
| 403 properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault, | 403 properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault, |
| 404 0, | 404 0, |
| 405 &kCFTypeDictionaryKeyCallBacks, | 405 &kCFTypeDictionaryKeyCallBacks, |
| 406 &kCFTypeDictionaryValueCallBacks)); | 406 &kCFTypeDictionaryValueCallBacks)); |
| 407 AddIntegerValue(properties, | 407 AddIntegerValue(properties, |
| 408 io_surface_support->GetKIOSurfaceWidth(), | 408 io_surface_support->GetKIOSurfaceWidth(), |
| 409 rounded_size_.width()); | 409 rounded_size_.width()); |
| 410 AddIntegerValue(properties, | 410 AddIntegerValue(properties, |
| 411 io_surface_support->GetKIOSurfaceHeight(), | 411 io_surface_support->GetKIOSurfaceHeight(), |
| 412 rounded_size_.height()); | 412 rounded_size_.height()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 manager, stub, surface.get(), false)); | 501 manager, stub, surface.get(), false)); |
| 502 } | 502 } |
| 503 } | 503 } |
| 504 | 504 |
| 505 // static | 505 // static |
| 506 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 506 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
| 507 g_allow_os_mesa = allow; | 507 g_allow_os_mesa = allow; |
| 508 } | 508 } |
| 509 | 509 |
| 510 } // namespace content | 510 } // namespace content |
| OLD | NEW |