mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
first compiling and theoretically correct version of Push2 canvas display.
Not tested with device at this point
This commit is contained in:
parent
2810e5619a
commit
7c9f3acc60
19 changed files with 1204 additions and 507 deletions
95
libs/surfaces/push2/canvas.h
Normal file
95
libs/surfaces/push2/canvas.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
Copyright (C) 2016 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __ardour_push2_canvas_h__
|
||||
#define __ardour_push2_canvas_h__
|
||||
|
||||
#include <cairomm/refptr.h>
|
||||
#include <glibmm/threads.h>
|
||||
|
||||
#include "canvas/canvas.h"
|
||||
|
||||
namespace Cairo {
|
||||
class ImageSurface;
|
||||
class Context;
|
||||
class Region;
|
||||
}
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class Push2;
|
||||
|
||||
/* A canvas which renders to the Push2 display */
|
||||
|
||||
class Push2Canvas : public ArdourCanvas::Canvas
|
||||
{
|
||||
public:
|
||||
Push2Canvas (Push2& p2, int cols, int rows);
|
||||
~Push2Canvas();
|
||||
|
||||
void request_redraw ();
|
||||
void request_redraw (ArdourCanvas::Rect const &);
|
||||
bool vblank ();
|
||||
|
||||
void splash ();
|
||||
|
||||
Cairo::RefPtr<Cairo::Context> image_context() { return context; }
|
||||
|
||||
int rows() const { return _rows; }
|
||||
int cols() const { return _cols; }
|
||||
|
||||
static double inter_button_spacing() { return 120.0; }
|
||||
|
||||
ArdourCanvas::Coord width() const { return cols(); }
|
||||
ArdourCanvas::Coord height() const { return rows(); }
|
||||
void request_size (ArdourCanvas::Duple);
|
||||
ArdourCanvas::Rect visible_area () const;
|
||||
|
||||
/* API that does nothing since we have no input events */
|
||||
void ungrab () {}
|
||||
void grab (ArdourCanvas::Item*) {}
|
||||
void focus (ArdourCanvas::Item*) {}
|
||||
void unfocus (ArdourCanvas::Item*) {}
|
||||
void re_enter() {}
|
||||
void pick_current_item (int) {}
|
||||
void pick_current_item (ArdourCanvas::Duple const &, int) {}
|
||||
bool get_mouse_position (ArdourCanvas::Duple&) const { return false; }
|
||||
|
||||
private:
|
||||
Push2& p2;
|
||||
int _cols;
|
||||
int _rows;
|
||||
|
||||
static const int pixels_per_row;
|
||||
int pixel_area () const { return _rows * pixels_per_row; }
|
||||
|
||||
uint8_t frame_header[16];
|
||||
uint16_t* device_frame_buffer;
|
||||
|
||||
Cairo::RefPtr<Cairo::ImageSurface> frame_buffer;
|
||||
Cairo::RefPtr<Cairo::Context> context;
|
||||
Cairo::RefPtr<Cairo::Region> expose_region;
|
||||
|
||||
bool expose ();
|
||||
int blit_to_device_frame_buffer ();
|
||||
};
|
||||
|
||||
} /* namespace ArdourSurface */
|
||||
|
||||
#endif /* __ardour_push2_canvas_h__ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue