Committer:
Midimetric
Date:
Thu Dec 30 16:49:46 2010 +0000
Revision:
2:d6e572640dcc
Parent:
0:601fd83c75e0
Child:
5:1c78c0b4f513
- Font structure: compacted size reduce overall bin by 8K
- Flush() overrides allows to update part of the screen only

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Midimetric 0:601fd83c75e0 1 #include "doggy.h"
Midimetric 0:601fd83c75e0 2
Midimetric 0:601fd83c75e0 3 void DogMLCD::LineH( int x0, int y, int x1, doggy_op raster )
Midimetric 0:601fd83c75e0 4 {
Midimetric 0:601fd83c75e0 5 if( y & 0xFFC0 ) return; // line is out of screen
Midimetric 0:601fd83c75e0 6 BOUND( x0, 0, 127 )
Midimetric 0:601fd83c75e0 7 BOUND( x1, 0, 127 )
Midimetric 0:601fd83c75e0 8 ORDER( x0, x1 )
Midimetric 0:601fd83c75e0 9
Midimetric 0:601fd83c75e0 10 int n = x1 - x0 + 1;
Midimetric 0:601fd83c75e0 11 char* p = b_ + (( y & 0x38 ) << 4) + x0;
Midimetric 0:601fd83c75e0 12 if( raster == poke )
Midimetric 0:601fd83c75e0 13 {
Midimetric 0:601fd83c75e0 14 char b = DOGMLCD_on[ y & 7 ];
Midimetric 0:601fd83c75e0 15 while( n-- )
Midimetric 0:601fd83c75e0 16 *p++ |= b;
Midimetric 0:601fd83c75e0 17 }
Midimetric 0:601fd83c75e0 18 else if( raster == wipe )
Midimetric 0:601fd83c75e0 19 {
Midimetric 0:601fd83c75e0 20 char b = DOGMLCD_off[ y & 7 ];
Midimetric 0:601fd83c75e0 21 while( n-- )
Midimetric 0:601fd83c75e0 22 *p++ &= b;
Midimetric 0:601fd83c75e0 23 }
Midimetric 0:601fd83c75e0 24 else
Midimetric 0:601fd83c75e0 25 {
Midimetric 0:601fd83c75e0 26 char b = DOGMLCD_on[ y & 7 ];
Midimetric 0:601fd83c75e0 27 while( n-- )
Midimetric 0:601fd83c75e0 28 *p++ ^= b;
Midimetric 0:601fd83c75e0 29 }
Midimetric 0:601fd83c75e0 30 }
Midimetric 0:601fd83c75e0 31 void DogMLCD::LineV( int x, int y0, int y1, doggy_op raster )
Midimetric 0:601fd83c75e0 32 {
Midimetric 0:601fd83c75e0 33 if( x & 0xFF80 ) return; // line is out of screen
Midimetric 0:601fd83c75e0 34 BOUND( y0, 0, 63 )
Midimetric 0:601fd83c75e0 35 BOUND( y1, 0, 63 )
Midimetric 0:601fd83c75e0 36 ORDER( y0, y1 )
Midimetric 0:601fd83c75e0 37 RasterOp op = ((RasterOp[]){ &DogMLCD::Poke, &DogMLCD::Wipe, &DogMLCD::Inv })[raster];
Midimetric 0:601fd83c75e0 38 for( int y = y0 ; y <= y1 ; y++ )
Midimetric 0:601fd83c75e0 39 (this->*op)( x, y );
Midimetric 0:601fd83c75e0 40 }
Midimetric 0:601fd83c75e0 41 void DogMLCD::Frame( int x0, int y0, int x1, int y1, doggy_op raster )
Midimetric 0:601fd83c75e0 42 {
Midimetric 0:601fd83c75e0 43 ORDER( x0, x1 )
Midimetric 0:601fd83c75e0 44 ORDER( y0, y1 )
Midimetric 0:601fd83c75e0 45
Midimetric 0:601fd83c75e0 46 LineH( x0, y0, x1, raster );
Midimetric 0:601fd83c75e0 47 if( y1 > y0 ) LineH( x0, y1, x1, raster );
Midimetric 0:601fd83c75e0 48
Midimetric 0:601fd83c75e0 49 y0++; // don't overlap at angles
Midimetric 0:601fd83c75e0 50 y1--;
Midimetric 0:601fd83c75e0 51 if( y1 >= y0 ) // don't overlap if horizontal lines where adjacent
Midimetric 0:601fd83c75e0 52 {
Midimetric 0:601fd83c75e0 53 LineV( x0, y0, y1, raster );
Midimetric 0:601fd83c75e0 54 if( x1 > x0 ) LineV( x1, y0, y1, raster );
Midimetric 0:601fd83c75e0 55 }
Midimetric 0:601fd83c75e0 56 }
Midimetric 2:d6e572640dcc 57 void DogMLCD::Rect( int x0, int y0, int x1, int y1, const unsigned char* p, doggy_op raster )
Midimetric 0:601fd83c75e0 58 {
Midimetric 0:601fd83c75e0 59 BOUND( x0, 0, 127 )
Midimetric 0:601fd83c75e0 60 BOUND( x1, 0, 127 )
Midimetric 0:601fd83c75e0 61 BOUND( y0, 0, 63 )
Midimetric 0:601fd83c75e0 62 BOUND( y1, 0, 63 )
Midimetric 0:601fd83c75e0 63 ORDER( x0, x1 )
Midimetric 0:601fd83c75e0 64 ORDER( y0, y1 )
Midimetric 2:d6e572640dcc 65 RasterOp op = ((RasterOp[]){ &DogMLCD::Poke, &DogMLCD::Wipe, &DogMLCD::Inv })[raster];
Midimetric 0:601fd83c75e0 66 for( int x = x0 ; x <= x1 ; x++ )
Midimetric 0:601fd83c75e0 67 for( int y = y0 ; y <= y1 ; y++ )
Midimetric 0:601fd83c75e0 68 if( p[x & 7] & ( 1 << ( y & 7 ) ) )
Midimetric 2:d6e572640dcc 69 (this->*op)( x, y );
Midimetric 0:601fd83c75e0 70 }