71 while ( (res=wait(DISPLAY_EVT, 1000))==2)
73 printf(
"res: %d\n", res);
75 printf(
"res: %d\n", res);
83 CVCDisplay::CVCDisplay(
bool doubleBuffer,
bool show_overlay): m_width(DispGetColumns), m_height(DispGetRows), m_pitch(DispGetPitch), m_doubleBuffer(doubleBuffer)
86 m_allocated_buffer = DRAMDisplayMalloc();
88 m_display_front = (U8*)((m_allocated_buffer+1023)&(~1023));
90 std::fill_n(m_display_front, m_height*m_pitch, 128);
94 m_allocated_backbuffer = DRAMDisplayMalloc();
96 m_display_back = (U8*)((m_allocated_backbuffer+1023)&(~1023));
98 std::fill_n( m_display_back, m_height*m_pitch, 128);
101 m_allocated_backbuffer = NULL;
102 m_display_back = NULL;
109 std::fill_n( (
unsigned char*)OvlGetPhysPage, OvlGetRows*OvlGetPitch, 0);
124 DRAMByteFree(m_allocated_buffer);
126 if (m_doubleBuffer) {
127 DRAMByteFree(m_allocated_backbuffer);
141 ScrSetDispPage((
int)m_display_front);
142 display_update(UPDATE_DISP);
148 ScrSetDispPage(ScrGetCaptPage);
149 display_update(UPDATE_DISP);
156 setvar(OVLY_ACTIVE,1);
163 setvar(OVLY_ACTIVE,0);
169 if (m_doubleBuffer) {
170 std::swap(m_display_front, m_display_back);
173 const unsigned char* restrict img_pixels = image->
pixels;
174 unsigned char* restrict disp_pixels = m_display_front;
176 int h = std::min(m_height, image->
height);
177 int w = std::min(m_width, image->
width);
180 for (
int row=0; row<h; row++) {
184 std::copy(img_pixels, img_pixels+w, disp_pixels);
187 img_pixels += image->
width;
188 disp_pixels += m_pitch;
192 ScrSetDispPage((
int)m_display_front);
193 display_update(UPDATE_DISP);
200 const unsigned char* restrict img_pixels = image->
pixels;
201 unsigned char* restrict ovl_pixels = (
unsigned char*)OvlGetPhysPage;
204 int h = std::min(OvlGetRows, image->
height);
205 int w = std::min(OvlGetColumns, image->
width);
206 int ovl_pitch = OvlGetPitch;
209 for (
int row=0; row<h; row++) {
210 std::copy(img_pixels, img_pixels+w, ovl_pixels);
212 img_pixels += image->
width;
213 ovl_pixels += ovl_pitch;
void enable_overlay() const
void disable_overlay() const
void make_current() const
void show(const CByteImage *image)
CVCDisplay(bool doubleBuffer, bool show_overlay=false)
void overlay(const CByteImage *ovl)
int width
The width of the image in pixels.
int height
The height of the image in pixels.
void sleep_ms(unsigned int ms)
unsigned char * pixels
The pointer to the the pixels.
void restore_default() const
void wait_for_next_frame()
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...