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

Side by Side Diff: services/ui/public/cpp/mojo_gpu_memory_buffer.h

Issue 2277293002: services/ui: Use the correct offset and stride in MojoGpuMemoryBuffer. (Closed)
Patch Set: Fix build error. Created 4 years, 3 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
« no previous file with comments | « no previous file | services/ui/public/cpp/mojo_gpu_memory_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_H_ 5 #ifndef SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_H_
6 #define SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_H_ 6 #define SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "services/ui/public/cpp/gpu_memory_buffer_impl.h" 13 #include "services/ui/public/cpp/gpu_memory_buffer_impl.h"
14 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
15 #include "ui/gfx/gpu_memory_buffer.h" 15 #include "ui/gfx/gpu_memory_buffer.h"
16 16
17 namespace ui { 17 namespace ui {
18 18
19 class MojoGpuMemoryBufferImpl : public ui::GpuMemoryBufferImpl { 19 class MojoGpuMemoryBufferImpl : public ui::GpuMemoryBufferImpl {
20 public: 20 public:
21 MojoGpuMemoryBufferImpl(const gfx::Size& size,
22 gfx::BufferFormat format,
23 std::unique_ptr<base::SharedMemory> shared_memory);
24 ~MojoGpuMemoryBufferImpl() override; 21 ~MojoGpuMemoryBufferImpl() override;
25 22
26 static std::unique_ptr<gfx::GpuMemoryBuffer> Create(const gfx::Size& size, 23 static std::unique_ptr<gfx::GpuMemoryBuffer> Create(const gfx::Size& size,
27 gfx::BufferFormat format, 24 gfx::BufferFormat format,
28 gfx::BufferUsage usage); 25 gfx::BufferUsage usage);
29 static std::unique_ptr<gfx::GpuMemoryBuffer> CreateFromHandle( 26 static std::unique_ptr<gfx::GpuMemoryBuffer> CreateFromHandle(
30 const gfx::GpuMemoryBufferHandle& handle, 27 const gfx::GpuMemoryBufferHandle& handle,
31 const gfx::Size& size, 28 const gfx::Size& size,
32 gfx::BufferFormat format, 29 gfx::BufferFormat format,
33 gfx::BufferUsage usage); 30 gfx::BufferUsage usage);
34 static MojoGpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); 31 static MojoGpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer);
35 32
36 const unsigned char* GetMemory() const; 33 const unsigned char* GetMemory() const;
37 34
38 // Overridden from gfx::GpuMemoryBuffer: 35 // Overridden from gfx::GpuMemoryBuffer:
39 bool Map() override; 36 bool Map() override;
40 void* memory(size_t plane) override; 37 void* memory(size_t plane) override;
41 void Unmap() override; 38 void Unmap() override;
42 int stride(size_t plane) const override; 39 int stride(size_t plane) const override;
43 gfx::GpuMemoryBufferHandle GetHandle() const override; 40 gfx::GpuMemoryBufferHandle GetHandle() const override;
44 41
45 // Overridden from gfx::GpuMemoryBufferImpl 42 // Overridden from gfx::GpuMemoryBufferImpl
46 gfx::GpuMemoryBufferType GetBufferType() const override; 43 gfx::GpuMemoryBufferType GetBufferType() const override;
47 44
48 private: 45 private:
46 MojoGpuMemoryBufferImpl(const gfx::Size& size,
sky 2016/08/25 17:00:22 Move definition to match new position.
Peng 2016/08/25 17:41:25 Done.
47 gfx::BufferFormat format,
48 std::unique_ptr<base::SharedMemory> shared_memory,
49 size_t offset,
50 int stride);
51
49 std::unique_ptr<base::SharedMemory> shared_memory_; 52 std::unique_ptr<base::SharedMemory> shared_memory_;
53 size_t offset_;
sky 2016/08/25 17:00:22 Make const if you can.
Peng 2016/08/25 17:41:25 Done.
54 int stride_;
50 55
51 DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferImpl); 56 DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferImpl);
52 }; 57 };
53 58
54 } // namespace ui 59 } // namespace ui
55 60
56 #endif // SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_H_ 61 #endif // SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/public/cpp/mojo_gpu_memory_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698