Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl.h

Issue 1062853002: Add gfx::GpuMemoryBuffer::YUV_420 and GpuMemoryBufferImplSharedMemory support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reveman@ comments. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(
38 gfx::GpuMemoryBuffer::Format format);
39
36 // Calculates the number of bytes that an implementation must use to store 40 // Calculates the number of bytes that an implementation must use to store
37 // one row of pixel data. 41 // one row of pixel data.
38 static bool StrideInBytes(size_t width, 42 static bool StrideInBytes(size_t width,
39 Format format, 43 Format format,
44 int plane,
40 size_t* stride_in_bytes); 45 size_t* stride_in_bytes);
41 46
42 // Returns the number of planes based on the format of the buffer. 47 // Returns the subsampling factor applied to the given zero-indexed |plane| of
43 static size_t NumberOfPlanesForGpuMemoryBufferFormat( 48 // the |format| both horizontally and vertically.
44 gfx::GpuMemoryBuffer::Format format); 49 static size_t SubsamplingFactor(gfx::GpuMemoryBuffer::Format format,
50 int plane);
51
52 // Calculates the number of bytes that an implementation must use to store
53 // all the planes of a given |format|.
54 static bool BufferSizeInBytes(const gfx::Size& size,
reveman 2015/04/07 20:33:44 nit: can you move this function to GpuMemoryBuffer
emircan 2015/04/07 21:28:45 I had it there originally, but then moved it here
55 gfx::GpuMemoryBuffer::Format format,
56 size_t* size_in_bytes);
45 57
46 // Overridden from gfx::GpuMemoryBuffer: 58 // Overridden from gfx::GpuMemoryBuffer:
47 bool IsMapped() const override; 59 bool IsMapped() const override;
48 Format GetFormat() const override; 60 Format GetFormat() const override;
49 ClientBuffer AsClientBuffer() override; 61 ClientBuffer AsClientBuffer() override;
50 62
51 void set_destruction_sync_point(uint32 sync_point) { 63 void set_destruction_sync_point(uint32 sync_point) {
52 destruction_sync_point_ = sync_point; 64 destruction_sync_point_ = sync_point;
53 } 65 }
54 66
(...skipping 10 matching lines...) Expand all
65 bool mapped_; 77 bool mapped_;
66 uint32 destruction_sync_point_; 78 uint32 destruction_sync_point_;
67 79
68 private: 80 private:
69 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); 81 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
70 }; 82 };
71 83
72 } // namespace content 84 } // namespace content
73 85
74 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 86 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698