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 | |
41 // Returns the subsampling factor applied to the given zero-indexed |plane| of | 37 // Returns the subsampling factor applied to the given zero-indexed |plane| of |
42 // the |format| both horizontally and vertically. | 38 // the |format| both horizontally and vertically. |
43 static size_t SubsamplingFactor(gfx::BufferFormat format, int plane); | 39 static size_t SubsamplingFactor(gfx::BufferFormat format, int plane); |
44 | 40 |
45 // Returns the number of bytes used to store a row of the given zero-indexed | 41 // Returns the number of bytes used to store a row of the given zero-indexed |
46 // |plane| of |format|. | 42 // |plane| of |format|. |
47 // Note: This is an approximation and the exact size used by an implementation | 43 // Note: This is an approximation and the exact size used by an implementation |
48 // might be different. | 44 // might be different. |
49 static bool RowSizeInBytes(size_t width, | 45 static bool RowSizeInBytes(size_t width, |
50 gfx::BufferFormat format, | 46 gfx::BufferFormat format, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 bool mapped_; | 78 bool mapped_; |
83 uint32 destruction_sync_point_; | 79 uint32 destruction_sync_point_; |
84 | 80 |
85 private: | 81 private: |
86 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 82 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
87 }; | 83 }; |
88 | 84 |
89 } // namespace content | 85 } // namespace content |
90 | 86 |
91 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 87 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |