Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Side by Side Diff: app/surface/accelerated_surface_mac.cc

Issue 3855001: Move scoped_cftyperef from base to base/mac, use the new namespace, and name ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/surface/accelerated_surface_mac.h ('k') | base/file_path.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/surface/accelerated_surface_mac.h" 5 #include "app/surface/accelerated_surface_mac.h"
6 6
7 #include "app/gfx/gl/gl_bindings.h" 7 #include "app/gfx/gl/gl_bindings.h"
8 #include "app/gfx/gl/gl_implementation.h" 8 #include "app/gfx/gl/gl_implementation.h"
9 #include "app/surface/io_surface_support_mac.h" 9 #include "app/surface/io_surface_support_mac.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "gfx/rect.h" 12 #include "gfx/rect.h"
13 13
14 AcceleratedSurface::AcceleratedSurface() 14 AcceleratedSurface::AcceleratedSurface()
15 : allocate_fbo_(false), 15 : allocate_fbo_(false),
16 texture_(0), 16 texture_(0),
17 fbo_(0), 17 fbo_(0),
18 depth_stencil_renderbuffer_(0) { 18 depth_stencil_renderbuffer_(0) {
19 } 19 }
20 20
21 bool AcceleratedSurface::Initialize(gfx::GLContext* share_context, 21 bool AcceleratedSurface::Initialize(gfx::GLContext* share_context,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 static void AddBooleanValue(CFMutableDictionaryRef dictionary, 103 static void AddBooleanValue(CFMutableDictionaryRef dictionary,
104 const CFStringRef key, 104 const CFStringRef key,
105 bool value) { 105 bool value) {
106 CFDictionaryAddValue(dictionary, key, 106 CFDictionaryAddValue(dictionary, key,
107 (value ? kCFBooleanTrue : kCFBooleanFalse)); 107 (value ? kCFBooleanTrue : kCFBooleanFalse));
108 } 108 }
109 109
110 static void AddIntegerValue(CFMutableDictionaryRef dictionary, 110 static void AddIntegerValue(CFMutableDictionaryRef dictionary,
111 const CFStringRef key, 111 const CFStringRef key,
112 int32 value) { 112 int32 value) {
113 scoped_cftyperef<CFNumberRef> number( 113 base::mac::ScopedCFTypeRef<CFNumberRef> number(
114 CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); 114 CFNumberCreate(NULL, kCFNumberSInt32Type, &value));
115 CFDictionaryAddValue(dictionary, key, number.get()); 115 CFDictionaryAddValue(dictionary, key, number.get());
116 } 116 }
117 117
118 void AcceleratedSurface::AllocateRenderBuffers(GLenum target, 118 void AcceleratedSurface::AllocateRenderBuffers(GLenum target,
119 const gfx::Size& size) { 119 const gfx::Size& size) {
120 if (!texture_) { 120 if (!texture_) {
121 // Generate the texture object. 121 // Generate the texture object.
122 glGenTextures(1, &texture_); 122 glGenTextures(1, &texture_);
123 glBindTexture(target, texture_); 123 glBindTexture(target, texture_);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } else if (!texture_) { 216 } else if (!texture_) {
217 // Generate the texture object. 217 // Generate the texture object.
218 glGenTextures(1, &texture_); 218 glGenTextures(1, &texture_);
219 glBindTexture(target, texture_); 219 glBindTexture(target, texture_);
220 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 220 glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
221 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 221 glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
222 } 222 }
223 223
224 // Allocate a new IOSurface, which is the GPU resource that can be 224 // Allocate a new IOSurface, which is the GPU resource that can be
225 // shared across processes. 225 // shared across processes.
226 scoped_cftyperef<CFMutableDictionaryRef> properties; 226 base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> properties;
227 properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault, 227 properties.reset(CFDictionaryCreateMutable(kCFAllocatorDefault,
228 0, 228 0,
229 &kCFTypeDictionaryKeyCallBacks, 229 &kCFTypeDictionaryKeyCallBacks,
230 &kCFTypeDictionaryValueCallBacks)); 230 &kCFTypeDictionaryValueCallBacks));
231 AddIntegerValue(properties, 231 AddIntegerValue(properties,
232 io_surface_support->GetKIOSurfaceWidth(), size.width()); 232 io_surface_support->GetKIOSurfaceWidth(), size.width());
233 AddIntegerValue(properties, 233 AddIntegerValue(properties,
234 io_surface_support->GetKIOSurfaceHeight(), size.height()); 234 io_surface_support->GetKIOSurfaceHeight(), size.height());
235 AddIntegerValue(properties, 235 AddIntegerValue(properties,
236 io_surface_support->GetKIOSurfaceBytesPerElement(), 4); 236 io_surface_support->GetKIOSurfaceBytesPerElement(), 4);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 321 }
322 return transport_dib_->handle(); 322 return transport_dib_->handle();
323 } 323 }
324 324
325 void AcceleratedSurface::SetTransportDIBAllocAndFree( 325 void AcceleratedSurface::SetTransportDIBAllocAndFree(
326 Callback2<size_t, TransportDIB::Handle*>::Type* allocator, 326 Callback2<size_t, TransportDIB::Handle*>::Type* allocator,
327 Callback1<TransportDIB::Id>::Type* deallocator) { 327 Callback1<TransportDIB::Id>::Type* deallocator) {
328 dib_alloc_callback_.reset(allocator); 328 dib_alloc_callback_.reset(allocator);
329 dib_free_callback_.reset(deallocator); 329 dib_free_callback_.reset(deallocator);
330 } 330 }
OLDNEW
« no previous file with comments | « app/surface/accelerated_surface_mac.h ('k') | base/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698