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 15 matching lines...) Expand all Loading... |
26 // thread as this function was called on and instance was created on. | 26 // thread as this function was called on and instance was created on. |
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 Format format, | 30 Format format, |
31 const DestructionCallback& callback); | 31 const DestructionCallback& callback); |
32 | 32 |
33 // Type-checking upcast routine. Returns an NULL on failure. | 33 // Type-checking upcast routine. Returns an NULL on failure. |
34 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); | 34 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); |
35 | 35 |
| 36 // Returns the number of planes based on the format of the buffer. |
| 37 static size_t NumberOfPlanesForGpuMemoryBufferFormat(Format format); |
| 38 |
36 // Calculates the number of bytes that an implementation must use to store | 39 // Calculates the number of bytes that an implementation must use to store |
37 // one row of pixel data. | 40 // one row of pixel data. |
38 static bool StrideInBytes(size_t width, | 41 static bool StrideInBytes(size_t width, |
39 Format format, | 42 Format format, |
| 43 int plane, |
40 size_t* stride_in_bytes); | 44 size_t* stride_in_bytes); |
41 | 45 |
42 // Returns the number of planes based on the format of the buffer. | 46 // Returns the subsampling factor applied to the given zero-indexed |plane| of |
43 static size_t NumberOfPlanesForGpuMemoryBufferFormat( | 47 // the |format| both horizontally and vertically. |
44 gfx::GpuMemoryBuffer::Format format); | 48 static size_t SubsamplingFactor(Format format, int plane); |
45 | 49 |
46 // Overridden from gfx::GpuMemoryBuffer: | 50 // Overridden from gfx::GpuMemoryBuffer: |
47 bool IsMapped() const override; | 51 bool IsMapped() const override; |
48 Format GetFormat() const override; | 52 Format GetFormat() const override; |
49 ClientBuffer AsClientBuffer() override; | 53 ClientBuffer AsClientBuffer() override; |
50 | 54 |
51 void set_destruction_sync_point(uint32 sync_point) { | 55 void set_destruction_sync_point(uint32 sync_point) { |
52 destruction_sync_point_ = sync_point; | 56 destruction_sync_point_ = sync_point; |
53 } | 57 } |
54 | 58 |
(...skipping 10 matching lines...) Expand all Loading... |
65 bool mapped_; | 69 bool mapped_; |
66 uint32 destruction_sync_point_; | 70 uint32 destruction_sync_point_; |
67 | 71 |
68 private: | 72 private: |
69 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 73 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
70 }; | 74 }; |
71 | 75 |
72 } // namespace content | 76 } // namespace content |
73 | 77 |
74 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 78 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |