OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
28 const gfx::GpuMemoryBufferHandle& handle, | 28 const gfx::GpuMemoryBufferHandle& handle, |
29 const gfx::Size& size, | 29 const gfx::Size& size, |
30 gfx::BufferFormat format, | 30 gfx::BufferFormat format, |
31 gfx::BufferUsage usage, | 31 gfx::BufferUsage usage, |
32 const DestructionCallback& callback); | 32 const DestructionCallback& callback); |
33 | 33 |
34 // Type-checking upcast routine. Returns an NULL on failure. | 34 // Type-checking upcast routine. Returns an NULL on failure. |
35 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); | 35 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); |
36 | 36 |
| 37 // Returns the number of planes based on the format of the buffer. |
| 38 static size_t NumberOfPlanesForGpuMemoryBufferFormat( |
| 39 gfx::BufferFormat format); |
| 40 |
37 // Returns the subsampling factor applied to the given zero-indexed |plane| of | 41 // Returns the subsampling factor applied to the given zero-indexed |plane| of |
38 // the |format| both horizontally and vertically. | 42 // the |format| both horizontally and vertically. |
39 static size_t SubsamplingFactor(gfx::BufferFormat format, int plane); | 43 static size_t SubsamplingFactor(gfx::BufferFormat format, int plane); |
40 | 44 |
41 // Returns the number of bytes used to store a row of the given zero-indexed | 45 // Returns the number of bytes used to store a row of the given zero-indexed |
42 // |plane| of |format|. | 46 // |plane| of |format|. |
43 // Note: This is an approximation and the exact size used by an implementation | 47 // Note: This is an approximation and the exact size used by an implementation |
44 // might be different. | 48 // might be different. |
45 static bool RowSizeInBytes(size_t width, | 49 static bool RowSizeInBytes(size_t width, |
46 gfx::BufferFormat format, | 50 gfx::BufferFormat format, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 bool mapped_; | 82 bool mapped_; |
79 uint32 destruction_sync_point_; | 83 uint32 destruction_sync_point_; |
80 | 84 |
81 private: | 85 private: |
82 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 86 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
83 }; | 87 }; |
84 | 88 |
85 } // namespace content | 89 } // namespace content |
86 | 90 |
87 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 91 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |