OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef UI_GL_PIXEL_BUFFER_H_ | |
6 #define UI_GL_PIXEL_BUFFER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/callback.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 | |
12 namespace gfx { | |
13 class Size; | |
14 | |
15 // Interface for creating and accessing a zero-copy buffer such as GraphicBuffer | |
16 // of Android framework. | |
17 // | |
18 // THREADING CONSIDERATIONS: | |
19 // | |
20 // It is legal for several different threads to map a buffer from | |
21 // read access, none of the threads are blocked. | |
22 // However, mapping a buffer simultaneously for write or read/write is | |
23 // undefined, but: | |
24 // - shall not result in termination of the process | |
25 // - shall not block the caller | |
26 // It is acceptable to return an error or to leave the buffer's content | |
27 // into an indeterminate state. | |
28 class PixelBuffer { | |
29 public: | |
30 // The factory is set by the ContentRendererClient::GetPixelBufferFactory() | |
jamesr
2013/04/04 21:05:27
I don't think it's very useful to put a comment in
kaanb
2013/04/04 22:26:18
Removed.
| |
31 // method. | |
32 typedef base::Callback<scoped_ptr<gfx::PixelBuffer>(gfx::Size)> Create; | |
33 | |
34 virtual ~PixelBuffer() {} | |
35 | |
36 // Maps the buffer so the client can write the bitmap data in |*vaddr| | |
37 // subsequently. This call may block, for instance if the h/w needs | |
38 // to finish rendering or if CPU caches need to be synchronized. | |
39 virtual void MapForWrite(void** vaddr) = 0; | |
40 | |
41 // Unmaps the buffer. Called after all changes to the buffer are | |
42 // completed. | |
43 virtual void Unmap() = 0; | |
44 | |
45 // Returns the native pointer for the pixel buffer. | |
46 virtual void* GetNativeBuffer() = 0; | |
47 | |
48 // Returns the stride for the pixel buffer. | |
49 virtual uint32 GetStride() = 0; | |
50 }; | |
51 | |
52 } // namespace gfx | |
53 | |
54 #endif // UI_GL_PIXEL_BUFFER_H_ | |
OLD | NEW |