~alan-griffiths/mir/fix-1654023

« back to all changes in this revision

Viewing changes to include/platform/mir/graphics/buffer.h

  • Committer: Daniel van Vugt
  • Date: 2015-04-28 07:54:10 UTC
  • mfrom: (2517 development-branch)
  • mto: This revision was merged to the branch mainline in revision 2673.
  • Revision ID: daniel.van.vugt@canonical.com-20150428075410-rwskshfuar7voesp
Merge latest trunk and fix conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Alan Griffiths <alan@octopull.co.uk>
17
17
 */
18
18
 
19
 
#ifndef MIR_COMPOSITOR_BUFFER_H_
20
 
#define MIR_COMPOSITOR_BUFFER_H_
 
19
#ifndef MIR_GRAPHICS_BUFFER_H_
 
20
#define MIR_GRAPHICS_BUFFER_H_
21
21
 
22
22
#include "mir/graphics/native_buffer.h"
23
23
#include "mir/graphics/buffer_id.h"
25
25
#include "mir_toolkit/common.h"
26
26
 
27
27
#include <memory>
 
28
#include <functional>
28
29
 
29
30
namespace mir
30
31
{
42
43
    virtual geometry::Stride stride() const = 0;
43
44
    virtual MirPixelFormat pixel_format() const = 0;
44
45
    virtual void gl_bind_to_texture() = 0;
 
46
    //FIXME: correct mg::Buffer::write, it requires that the user does too much to use it correctly,
 
47
    //       (ie, it forces them to figure out what size is proper, alloc a buffer, fill it, and then
 
48
    //       copy the data into the buffer)
45
49
    virtual void write(unsigned char const* pixels, size_t size) = 0;
 
50
    virtual void read(std::function<void(unsigned char const*)> const& do_with_pixels) = 0;
46
51
 
47
52
protected:
48
53
    Buffer() = default;
50
55
 
51
56
}
52
57
}
53
 
#endif // MIR_COMPOSITOR_BUFFER_H_
 
58
#endif // MIR_GRAPHICS_BUFFER_H_