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

Side by Side Diff: core/cross/command_buffer/render_surface_cb.h

Issue 176026: C++ Readability (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 11 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 15 matching lines...) Expand all
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 32
33 #ifndef O3D_CORE_CROSS_COMMAND_BUFFER_RENDER_SURFACE_CB_H_ 33 #ifndef O3D_CORE_CROSS_COMMAND_BUFFER_RENDER_SURFACE_CB_H_
34 #define O3D_CORE_CROSS_COMMAND_BUFFER_RENDER_SURFACE_CB_H_ 34 #define O3D_CORE_CROSS_COMMAND_BUFFER_RENDER_SURFACE_CB_H_
35 35
36 // This file contains the definition of the CB versions of
37 // render surface sub-classes.
38
36 #include "core/cross/render_surface.h" 39 #include "core/cross/render_surface.h"
37 #include "core/cross/command_buffer/renderer_cb.h" 40 #include "core/cross/command_buffer/renderer_cb.h"
38 #include "command_buffer/common/cross/resource.h" 41 #include "command_buffer/common/cross/resource.h"
39 42
40 namespace o3d { 43 namespace o3d {
41 44
45 // The RenderSurfaceCB class represents a render surface in the core library
46 // of the client for command buffers. This class is responsible for sending
47 // calls across the command buffer to create an actual render surface resource
48 // on the server.
42 class RenderSurfaceCB : public RenderSurface { 49 class RenderSurfaceCB : public RenderSurface {
43 public: 50 public:
44 typedef SmartPointer<RenderSurfaceCB> Ref; 51 typedef SmartPointer<RenderSurfaceCB> Ref;
45 52
53 // The render surface maintains a reference to its texture and renderer but
54 // does not own them. The owner of the render surface is responsible for
55 // properly deleting any textures.
56 // Parameters:
57 // service_locator - for central lookup. Not owned by RenderSurfaceCB.
58 // width - width of the bitmap for this render surface. It must match the
59 // the width of the texture at 'mip_level'
60 // height - height of the bitmap for this render surface. It must match the
61 // the height of the texture at 'mip_level'
62 // mip_level - mip level of 'texture' for this render surface.
63 // side - which side of a cube texture the render surface represents. The
64 // 'side' parameter will not be used for a texture2d render surface.
65 // texture - the texture this render surface maps to. Not owned by
66 // RenderSurfaceCB.
67 // renderer - the renderer to render to render surface. Not owned by
68 // RenderSurfaceCB.
46 RenderSurfaceCB(ServiceLocator *service_locator, 69 RenderSurfaceCB(ServiceLocator *service_locator,
47 int width, 70 int width,
48 int height, 71 int height,
49 int mip_level, 72 int mip_level,
50 int side, 73 int side,
51 Texture *texture, 74 Texture *texture,
52 RendererCB *renderer); 75 RendererCB *renderer);
53 virtual ~RenderSurfaceCB(); 76 virtual ~RenderSurfaceCB();
54 77
78 // The CB specific implementation of GetBitmap.
79 // Returns:
80 // a reference to the underlying bitmap of the render surface.
55 virtual Bitmap::Ref PlatformSpecificGetBitmap() const { 81 virtual Bitmap::Ref PlatformSpecificGetBitmap() const {
56 // TODO(rlp): Add this functionality. 82 // TODO(rlp): Add this functionality.
57 DCHECK(false); 83 DCHECK(false);
58 return Bitmap::Ref(); 84 return Bitmap::Ref();
59 } 85 }
60 86
87 // Destroys any data structures associated with the render surface and
88 // resets any allocated IDs. This function should never be called during
89 // rendering.
61 virtual void Destroy(); 90 virtual void Destroy();
62 91
63 // Gets the render surface resource ID. 92 // Returns the render surface resource ID.
64 command_buffer::ResourceID resource_id() const { return resource_id_; } 93 command_buffer::ResourceID resource_id() const { return resource_id_; }
94
65 private: 95 private:
66 command_buffer::ResourceID resource_id_; 96 command_buffer::ResourceID resource_id_;
67 RendererCB* renderer_; 97 RendererCB *renderer_;
68 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceCB); 98 DISALLOW_COPY_AND_ASSIGN(RenderSurfaceCB);
69 }; 99 };
70 100
101 // The RenderDepthStencilSurfaceCB class represents a depth stencil surface in
102 // the core library of the client for command buffers. This class is
103 // responsible for sending calls across the command buffer to create an actual
104 // depth stencil surface resource on the server.
71 class RenderDepthStencilSurfaceCB : public RenderDepthStencilSurface { 105 class RenderDepthStencilSurfaceCB : public RenderDepthStencilSurface {
72 public: 106 public:
73 typedef SmartPointer<RenderDepthStencilSurfaceCB> Ref; 107 typedef SmartPointer<RenderDepthStencilSurfaceCB> Ref;
74 108
109 // The depth stencil surface maintains a reference to its renderer which is
110 // also what typically creates it (though not always). The depth stencil
111 // does not maintain ownership of the renderer.
112 // Parameters:
113 // service_locator - for central lookup.
114 // width - width of the bitmap for this render surface.
115 // height - height of the bitmap for this render surface.
116 // renderer - the renderer to render to render surface. Not owned by
117 // RenderDepthStencilSurfaceCB.
75 RenderDepthStencilSurfaceCB(ServiceLocator *service_locator, 118 RenderDepthStencilSurfaceCB(ServiceLocator *service_locator,
76 int width, 119 int width,
77 int height, 120 int height,
78 RendererCB *renderer); 121 RendererCB *renderer);
79 virtual ~RenderDepthStencilSurfaceCB() {} 122 virtual ~RenderDepthStencilSurfaceCB() {}
80 123
124 // Destroys any data structures associated with the render surface and
125 // resets any allocated IDs. This function should never be called during
126 // rendering.
81 virtual void Destroy(); 127 virtual void Destroy();
82 128
83 // Gets the render depth stencil surface resource ID. 129 // Returns the render depth stencil surface resource ID.
84 command_buffer::ResourceID resource_id() const { return resource_id_; } 130 command_buffer::ResourceID resource_id() const { return resource_id_; }
131
85 private: 132 private:
86 command_buffer::ResourceID resource_id_; 133 command_buffer::ResourceID resource_id_;
87 RendererCB* renderer_; 134 RendererCB *renderer_;
88 DISALLOW_COPY_AND_ASSIGN(RenderDepthStencilSurfaceCB); 135 DISALLOW_COPY_AND_ASSIGN(RenderDepthStencilSurfaceCB);
89 }; 136 };
90 137
91 } // namespace o3d 138 } // namespace o3d
92 139
93 #endif // O3D_CORE_CROSS_COMMAND_BUFFER_RENDER_SURFACE_CB_H_ 140 #endif // O3D_CORE_CROSS_COMMAND_BUFFER_RENDER_SURFACE_CB_H_
94 141
OLDNEW
« no previous file with comments | « command_buffer/service/win/d3d9/render_surface_d3d9.cc ('k') | core/cross/command_buffer/render_surface_cb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698