3 #include "pixelformat.h"
4 #include "pixelstore.h"
11 PixelStore::PixelStore():
20 PixelStore PixelStore::from_image(const Graphics::Image &img)
23 unsigned stride = img.get_stride();
24 unsigned ncomp = get_component_count(pixelformat_from_graphics(img.get_format()));
25 pstore.set_canvas_size(img.get_stride()/ncomp, 0);
26 pstore.set_alignment(min(stride&~(stride-1), 8U));
30 void PixelStore::set_canvas_size(unsigned w, unsigned h)
36 void PixelStore::set_origin(unsigned x, unsigned y, unsigned z)
43 void PixelStore::set_alignment(unsigned a)
48 void PixelStore::bind() const
52 glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
53 glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, image_height);
54 glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
55 glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows);
56 glPixelStorei(GL_UNPACK_SKIP_IMAGES, skip_images);
57 glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);