Chromium Code Reviews| 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 CC_RESOURCES_GRAPHIC_BUFFER_H_ | |
| 6 #define CC_RESOURCES_GRAPHIC_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 | |
| 16 namespace cc { | |
| 17 | |
| 18 // Interface for creating and accessing a zero-copy buffer such as GraphicBuffer | |
| 19 // of Android framework. | |
| 20 class GraphicBuffer { | |
|
joth
2013/04/02 19:12:11
can we make and statements about the thread safety
kaanb
2013/04/02 23:16:54
Done.
| |
| 21 public: | |
| 22 // This factory is called in ResourceProvider::CreateGraphicBuffer() to | |
|
joth
2013/04/02 19:12:11
this comment is incorrect w.r.t this patch in isol
kaanb
2013/04/02 23:16:54
Done.
| |
| 23 // create new instances. | |
| 24 typedef base::Callback<scoped_ptr<cc::GraphicBuffer>(const gfx::Size&)> | |
| 25 Factory; | |
| 26 virtual ~GraphicBuffer() {} | |
| 27 | |
| 28 // Locks the buffer for the usage specified so the client | |
| 29 // can read or write the bitmap data in |*vaddr| subsequently. | |
| 30 // Returns 0 on success, non-zero on failure. | |
| 31 virtual bool LockForRead(void** vaddr) = 0; | |
| 32 virtual bool LockForWrite(void** vaddr) = 0; | |
| 33 // Unlocks the buffer. Returns 0 on success, non-zero otherwise. | |
|
joth
2013/04/02 19:12:11
Also document:-
1/ can LockForRead be followed by
kaanb
2013/04/02 23:16:54
Actually the Lock() is somewhat of a misnomer. Loo
| |
| 34 virtual bool Unlock() = 0; | |
| 35 // Returns the size of the buffer | |
| 36 virtual gfx::Size GetSize() = 0; | |
| 37 // Returns the native pointer for the graphic buffer. | |
| 38 virtual void* GetNativeBuffer() = 0; | |
| 39 // Returns the stride for the graphic buffer. | |
| 40 virtual uint32 GetStride() = 0; | |
| 41 }; | |
| 42 | |
| 43 } // namespace cc | |
| 44 | |
| 45 #endif // CC_RESOURCES_GRAPHIC_BUFFER_H_ | |
| OLD | NEW |