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 21 matching lines...) Expand all Loading... |
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 // Calculates the number of bytes that an implementation must use to store | 36 // Calculates the number of bytes that an implementation must use to store |
37 // one row of pixel data. | 37 // one row of pixel data. |
38 static bool StrideInBytes(size_t width, | 38 static bool StrideInBytes(size_t width, |
39 Format format, | 39 Format format, |
40 size_t* stride_in_bytes); | 40 size_t* stride_in_bytes); |
41 | 41 |
| 42 // Returns the number of planes based on the format of the buffer. |
| 43 static size_t NumberOfPlanesForGpuMemoryBufferFormat( |
| 44 gfx::GpuMemoryBuffer::Format format); |
| 45 |
42 // Overridden from gfx::GpuMemoryBuffer: | 46 // Overridden from gfx::GpuMemoryBuffer: |
43 bool IsMapped() const override; | 47 bool IsMapped() const override; |
44 Format GetFormat() const override; | 48 Format GetFormat() const override; |
45 ClientBuffer AsClientBuffer() override; | 49 ClientBuffer AsClientBuffer() override; |
46 | 50 |
47 void set_destruction_sync_point(uint32 sync_point) { | 51 void set_destruction_sync_point(uint32 sync_point) { |
48 destruction_sync_point_ = sync_point; | 52 destruction_sync_point_ = sync_point; |
49 } | 53 } |
50 | 54 |
51 protected: | 55 protected: |
52 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 56 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, |
53 const gfx::Size& size, | 57 const gfx::Size& size, |
54 Format format, | 58 Format format, |
55 const DestructionCallback& callback); | 59 const DestructionCallback& callback); |
56 | 60 |
57 const gfx::GpuMemoryBufferId id_; | 61 const gfx::GpuMemoryBufferId id_; |
58 const gfx::Size size_; | 62 const gfx::Size size_; |
59 const Format format_; | 63 const Format format_; |
60 const DestructionCallback callback_; | 64 const DestructionCallback callback_; |
61 bool mapped_; | 65 bool mapped_; |
62 uint32 destruction_sync_point_; | 66 uint32 destruction_sync_point_; |
63 | 67 |
64 private: | 68 private: |
65 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 69 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
66 }; | 70 }; |
67 | 71 |
68 } // namespace content | 72 } // namespace content |
69 | 73 |
70 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 74 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |