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

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

Issue 1550483002: Switch to standard integer types in ui/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@int-ui-events
Patch Set: Created 4 years, 12 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
« no previous file with comments | « ui/surface/accelerated_surface_mac.h ('k') | ui/surface/transport_dib.h » ('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) 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 "ui/surface/accelerated_surface_mac.h" 5 #include "ui/surface/accelerated_surface_mac.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
9 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 static void AddBooleanValue(CFMutableDictionaryRef dictionary, 110 static void AddBooleanValue(CFMutableDictionaryRef dictionary,
111 const CFStringRef key, 111 const CFStringRef key,
112 bool value) { 112 bool value) {
113 CFDictionaryAddValue(dictionary, key, 113 CFDictionaryAddValue(dictionary, key,
114 (value ? kCFBooleanTrue : kCFBooleanFalse)); 114 (value ? kCFBooleanTrue : kCFBooleanFalse));
115 } 115 }
116 116
117 static void AddIntegerValue(CFMutableDictionaryRef dictionary, 117 static void AddIntegerValue(CFMutableDictionaryRef dictionary,
118 const CFStringRef key, 118 const CFStringRef key,
119 int32 value) { 119 int32_t value) {
120 base::ScopedCFTypeRef<CFNumberRef> number( 120 base::ScopedCFTypeRef<CFNumberRef> number(
121 CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); 121 CFNumberCreate(NULL, kCFNumberSInt32Type, &value));
122 CFDictionaryAddValue(dictionary, key, number.get()); 122 CFDictionaryAddValue(dictionary, key, number.get());
123 } 123 }
124 124
125 // Creates a new OpenGL texture object bound to the given texture target. 125 // Creates a new OpenGL texture object bound to the given texture target.
126 // Caller owns the returned texture. 126 // Caller owns the returned texture.
127 static GLuint CreateTexture(GLenum target) { 127 static GLuint CreateTexture(GLenum target) {
128 GLuint texture = 0; 128 GLuint texture = 0;
129 glGenTextures(1, &texture); 129 glGenTextures(1, &texture);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void AcceleratedSurface::Clear(const gfx::Rect& rect) { 174 void AcceleratedSurface::Clear(const gfx::Rect& rect) {
175 DCHECK(gl_context_->IsCurrent(gl_surface_.get())); 175 DCHECK(gl_context_->IsCurrent(gl_surface_.get()));
176 glClearColor(0, 0, 0, 0); 176 glClearColor(0, 0, 0, 0);
177 glViewport(0, 0, rect.width(), rect.height()); 177 glViewport(0, 0, rect.width(), rect.height());
178 glMatrixMode(GL_PROJECTION); 178 glMatrixMode(GL_PROJECTION);
179 glLoadIdentity(); 179 glLoadIdentity();
180 glOrtho(0, rect.width(), 0, rect.height(), -1, 1); 180 glOrtho(0, rect.width(), 0, rect.height(), -1, 1);
181 glClear(GL_COLOR_BUFFER_BIT); 181 glClear(GL_COLOR_BUFFER_BIT);
182 } 182 }
183 183
184 uint32 AcceleratedSurface::SetSurfaceSize(const gfx::Size& size) { 184 uint32_t AcceleratedSurface::SetSurfaceSize(const gfx::Size& size) {
185 if (surface_size_ == size) { 185 if (surface_size_ == size) {
186 // Return 0 to indicate to the caller that no new backing store 186 // Return 0 to indicate to the caller that no new backing store
187 // allocation occurred. 187 // allocation occurred.
188 return 0; 188 return 0;
189 } 189 }
190 190
191 // Only support IO surfaces if the GL implementation is the native desktop GL. 191 // Only support IO surfaces if the GL implementation is the native desktop GL.
192 // IO surfaces will not work with, for example, OSMesa software renderer 192 // IO surfaces will not work with, for example, OSMesa software renderer
193 // GL contexts. 193 // GL contexts.
194 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) 194 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // intended to send back a mach port from IOSurfaceCreateMachPort 254 // intended to send back a mach port from IOSurfaceCreateMachPort
255 // but it looks like Chrome IPC would need to be modified to 255 // but it looks like Chrome IPC would need to be modified to
256 // properly send mach ports between processes. For the time being we 256 // properly send mach ports between processes. For the time being we
257 // make our IOSurfaces global and send back their identifiers. On 257 // make our IOSurfaces global and send back their identifiers. On
258 // the browser process side the identifier is reconstituted into an 258 // the browser process side the identifier is reconstituted into an
259 // IOSurface for on-screen rendering. 259 // IOSurface for on-screen rendering.
260 io_surface_id_ = IOSurfaceGetID(io_surface_); 260 io_surface_id_ = IOSurfaceGetID(io_surface_);
261 return io_surface_id_; 261 return io_surface_id_;
262 } 262 }
263 263
264 uint32 AcceleratedSurface::GetSurfaceId() { 264 uint32_t AcceleratedSurface::GetSurfaceId() {
265 return io_surface_id_; 265 return io_surface_id_;
266 } 266 }
OLDNEW
« no previous file with comments | « ui/surface/accelerated_surface_mac.h ('k') | ui/surface/transport_dib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698