Chromium Code Reviews| 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; |
| 48 size_t GetNumberOfPlanes() const override; | |
| 44 Format GetFormat() const override; | 49 Format GetFormat() const override; |
| 45 ClientBuffer AsClientBuffer() override; | 50 ClientBuffer AsClientBuffer() override; |
| 46 | 51 |
| 47 void set_destruction_sync_point(uint32 sync_point) { | 52 void set_destruction_sync_point(uint32 sync_point) { |
| 48 destruction_sync_point_ = sync_point; | 53 destruction_sync_point_ = sync_point; |
| 49 } | 54 } |
| 50 | 55 |
| 51 protected: | 56 protected: |
| 52 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 57 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, |
| 53 const gfx::Size& size, | 58 const gfx::Size& size, |
| 54 Format format, | 59 Format format, |
| 55 const DestructionCallback& callback); | 60 const DestructionCallback& callback); |
| 56 | 61 |
| 57 const gfx::GpuMemoryBufferId id_; | 62 const gfx::GpuMemoryBufferId id_; |
| 58 const gfx::Size size_; | 63 const gfx::Size size_; |
| 59 const Format format_; | 64 const Format format_; |
| 65 const size_t num_planes_; | |
| 60 const DestructionCallback callback_; | 66 const DestructionCallback callback_; |
| 61 bool mapped_; | 67 bool mapped_; |
| 62 uint32 destruction_sync_point_; | 68 uint32 destruction_sync_point_; |
| 63 | 69 |
| 64 private: | 70 private: |
| 71 | |
|
reveman
2015/03/24 20:13:59
nit: no need to add this line
emircan
2015/03/24 21:43:44
Done.
| |
| 65 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 72 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
| 66 }; | 73 }; |
| 67 | 74 |
| 68 } // namespace content | 75 } // namespace content |
| 69 | 76 |
| 70 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 77 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
| OLD | NEW |