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

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

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/snapshot/snapshot_aura_unittest.cc ('k') | ui/surface/accelerated_surface_mac.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) 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 #ifndef UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ 5 #ifndef UI_SURFACE_ACCELERATED_SURFACE_MAC_H_
6 #define UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ 6 #define UI_SURFACE_ACCELERATED_SURFACE_MAC_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 #include <IOSurface/IOSurface.h> 9 #include <IOSurface/IOSurface.h>
10 #include <stdint.h>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/mac/scoped_cftyperef.h" 13 #include "base/mac/scoped_cftyperef.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
15 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
16 #include "ui/gl/gl_context.h" 17 #include "ui/gl/gl_context.h"
17 #include "ui/gl/gl_surface.h" 18 #include "ui/gl/gl_surface.h"
18 #include "ui/gl/gpu_preference.h" 19 #include "ui/gl/gpu_preference.h"
19 #include "ui/surface/surface_export.h" 20 #include "ui/surface/surface_export.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 gfx::GpuPreference gpu_preference); 55 gfx::GpuPreference gpu_preference);
55 // Tear down. Must be called before destructor to prevent leaks. 56 // Tear down. Must be called before destructor to prevent leaks.
56 void Destroy(); 57 void Destroy();
57 58
58 // These methods are used only once the accelerated surface is initialized. 59 // These methods are used only once the accelerated surface is initialized.
59 60
60 // Sets the accelerated surface to the given size, creating a new one if 61 // Sets the accelerated surface to the given size, creating a new one if
61 // the height or width changes. Returns a unique id of the IOSurface to 62 // the height or width changes. Returns a unique id of the IOSurface to
62 // which the surface is bound, or 0 if no changes were made or an error 63 // which the surface is bound, or 0 if no changes were made or an error
63 // occurred. MakeCurrent() will have been called on the new surface. 64 // occurred. MakeCurrent() will have been called on the new surface.
64 uint32 SetSurfaceSize(const gfx::Size& size); 65 uint32_t SetSurfaceSize(const gfx::Size& size);
65 66
66 // Returns the id of this surface's IOSurface. 67 // Returns the id of this surface's IOSurface.
67 uint32 GetSurfaceId(); 68 uint32_t GetSurfaceId();
68 69
69 // Sets the GL context to be the current one for drawing. Returns true if 70 // Sets the GL context to be the current one for drawing. Returns true if
70 // it succeeded. 71 // it succeeded.
71 bool MakeCurrent(); 72 bool MakeCurrent();
72 // Clear the surface to be transparent. Assumes the caller has already called 73 // Clear the surface to be transparent. Assumes the caller has already called
73 // MakeCurrent(). 74 // MakeCurrent().
74 void Clear(const gfx::Rect& rect); 75 void Clear(const gfx::Rect& rect);
75 // Call after making changes to the surface which require a visual update. 76 // Call after making changes to the surface which require a visual update.
76 // Makes the rendering show up in other processes. Assumes the caller has 77 // Makes the rendering show up in other processes. Assumes the caller has
77 // already called MakeCurrent(). 78 // already called MakeCurrent().
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 116
116 gfx::Size ClampToValidDimensions(const gfx::Size& size); 117 gfx::Size ClampToValidDimensions(const gfx::Size& size);
117 118
118 // The OpenGL context, and pbuffer drawable, used to transfer data 119 // The OpenGL context, and pbuffer drawable, used to transfer data
119 // to the shared region (IOSurface). 120 // to the shared region (IOSurface).
120 scoped_refptr<gfx::GLSurface> gl_surface_; 121 scoped_refptr<gfx::GLSurface> gl_surface_;
121 scoped_refptr<gfx::GLContext> gl_context_; 122 scoped_refptr<gfx::GLContext> gl_context_;
122 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; 123 base::ScopedCFTypeRef<IOSurfaceRef> io_surface_;
123 124
124 // The id of |io_surface_| or 0 if that's NULL. 125 // The id of |io_surface_| or 0 if that's NULL.
125 uint32 io_surface_id_; 126 uint32_t io_surface_id_;
126 127
127 gfx::Size surface_size_; 128 gfx::Size surface_size_;
128 // It's important to avoid allocating zero-width or zero-height 129 // It's important to avoid allocating zero-width or zero-height
129 // IOSurfaces and textures on the Mac, so we clamp each to a minimum 130 // IOSurfaces and textures on the Mac, so we clamp each to a minimum
130 // of 1. This is the real size of the surface; surface_size_ is what 131 // of 1. This is the real size of the surface; surface_size_ is what
131 // the user requested. 132 // the user requested.
132 gfx::Size real_surface_size_; 133 gfx::Size real_surface_size_;
133 // TODO(kbr): the FBO management should not be in this class at all. 134 // TODO(kbr): the FBO management should not be in this class at all.
134 // However, if it is factored out, care needs to be taken to not 135 // However, if it is factored out, care needs to be taken to not
135 // introduce another copy of the color data on the GPU; the direct 136 // introduce another copy of the color data on the GPU; the direct
136 // binding of the internal texture to the IOSurface saves a copy. 137 // binding of the internal texture to the IOSurface saves a copy.
137 bool allocate_fbo_; 138 bool allocate_fbo_;
138 // This texture object is always allocated, regardless of whether 139 // This texture object is always allocated, regardless of whether
139 // the user requests an FBO be allocated. 140 // the user requests an FBO be allocated.
140 GLuint texture_; 141 GLuint texture_;
141 // The FBO and renderbuffer are only allocated if allocate_fbo_ is 142 // The FBO and renderbuffer are only allocated if allocate_fbo_ is
142 // true. 143 // true.
143 GLuint fbo_; 144 GLuint fbo_;
144 }; 145 };
145 146
146 #endif // UI_SURFACE_ACCELERATED_SURFACE_MAC_H_ 147 #endif // UI_SURFACE_ACCELERATED_SURFACE_MAC_H_
OLDNEW
« no previous file with comments | « ui/snapshot/snapshot_aura_unittest.cc ('k') | ui/surface/accelerated_surface_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698