Mir
pixel_source.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2016 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17  */
18 
19 #ifndef MIR_RENDERER_SW_PIXEL_SOURCE_H_
20 #define MIR_RENDERER_SW_PIXEL_SOURCE_H_
21 
22 #include <stddef.h>
23 #include <functional>
25 
26 namespace mir
27 {
28 namespace renderer
29 {
30 namespace software
31 {
32 
34 {
35 public:
36  virtual ~PixelSource() = default;
37 
38  //functions have legacy issues with their signatures.
39  //FIXME: correct write, it requires that the user does too much to use it correctly,
40  // (ie, it forces them to figure out what size is proper, alloc a buffer, fill it, and then
41  // copy the data into the buffer)
42  virtual void write(unsigned char const* pixels, size_t size) = 0;
43  //FIXME: correct read, it doesn't give size or format information about the pixels.
44  virtual void read(std::function<void(unsigned char const*)> const& do_with_pixels) = 0;
45  virtual geometry::Stride stride() const = 0;
46 
47 protected:
48  PixelSource() = default;
49  PixelSource(PixelSource const&) = delete;
50  PixelSource& operator=(PixelSource const&) = delete;
51 };
52 
53 }
54 }
55 }
56 
57 #endif /* MIR_RENDERER_SW_PIXEL_SOURCE_H_ */
Definition: as_render_target.h:27
virtual geometry::Stride stride() const =0
virtual void read(std::function< void(unsigned char const *)> const &do_with_pixels)=0
Definition: pixel_source.h:33
PixelSource & operator=(PixelSource const &)=delete
Definition: dimensions.h:36
virtual void write(unsigned char const *pixels, size_t size)=0

Copyright © 2012-2016 Canonical Ltd.
Generated on Tue Oct 31 05:57:28 UTC 2017