mirror of
				https://projects.vdr-developer.org/git/vdr-plugin-skindesigner.git
				synced 2023-10-19 15:58:31 +00:00 
			
		
		
		
	Revert "drawing ellipses antialiased with Cairo"
This reverts commit 7ce445025e.
			
			
This commit is contained in:
		
							
								
								
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								HISTORY
									
									
									
									
									
								
							@@ -103,5 +103,3 @@ Version 0.0.7
 | 
				
			|||||||
- fixed bug that global double vars are not working
 | 
					- fixed bug that global double vars are not working
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Version 0.0.8
 | 
					Version 0.0.8
 | 
				
			||||||
 | 
					 | 
				
			||||||
- drawing ellipses antialiased with Cairo 
 | 
					 | 
				
			||||||
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							@@ -66,9 +66,8 @@ OBJS = $(PLUGIN).o \
 | 
				
			|||||||
       libcore/pixmapcontainer.o \
 | 
					       libcore/pixmapcontainer.o \
 | 
				
			||||||
       libcore/fontmanager.o \
 | 
					       libcore/fontmanager.o \
 | 
				
			||||||
       libcore/imagecache.o \
 | 
					       libcore/imagecache.o \
 | 
				
			||||||
       libcore/imageloader.o \
 | 
					 | 
				
			||||||
       libcore/imagecreator.o \
 | 
					 | 
				
			||||||
       libcore/helpers.o \
 | 
					       libcore/helpers.o \
 | 
				
			||||||
 | 
					       libcore/imageloader.o \
 | 
				
			||||||
       libcore/recfolderinfo.o \
 | 
					       libcore/recfolderinfo.o \
 | 
				
			||||||
       libcore/extrecinfo.o \
 | 
					       libcore/extrecinfo.o \
 | 
				
			||||||
       libcore/timers.o \
 | 
					       libcore/timers.o \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,10 +3,9 @@
 | 
				
			|||||||
#include <map>
 | 
					#include <map>
 | 
				
			||||||
#include <fstream>
 | 
					#include <fstream>
 | 
				
			||||||
#include <sys/stat.h>
 | 
					#include <sys/stat.h>
 | 
				
			||||||
#include "imagecreator.h"
 | 
					#include "imagecache.h"
 | 
				
			||||||
#include "../config.h"
 | 
					#include "../config.h"
 | 
				
			||||||
#include "helpers.h"
 | 
					#include "helpers.h"
 | 
				
			||||||
#include "imagecache.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cMutex cImageCache::mutex;
 | 
					cMutex cImageCache::mutex;
 | 
				
			||||||
@@ -301,37 +300,6 @@ cImage *cImageCache::GetSkinpart(string name, int width, int height) {
 | 
				
			|||||||
    return NULL;    
 | 
					    return NULL;    
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void cImageCache::CacheEllipse(int id, int width, int height, tColor color, int quadrant) {
 | 
					 | 
				
			||||||
    esyslog("skindesigner: caching ellipse %d, w %d, h %d, color %x, quadrant %d", id, width, height, color, quadrant);
 | 
					 | 
				
			||||||
    GetEllipse(id, width, height, color, quadrant);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cImage *cImageCache::GetEllipse(int id, int width, int height, tColor color, int quadrant) {
 | 
					 | 
				
			||||||
    if (width < 1 || width > 1920 || height < 1 || height > 1080)
 | 
					 | 
				
			||||||
        return NULL;
 | 
					 | 
				
			||||||
    cMutexLock MutexLock(&mutex);
 | 
					 | 
				
			||||||
    map<int, cImage*>::iterator hit = cairoImageCache.find(id);
 | 
					 | 
				
			||||||
    if (hit != cairoImageCache.end()) {
 | 
					 | 
				
			||||||
        return (cImage*)hit->second;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        cImageCreator ic;
 | 
					 | 
				
			||||||
        if (!ic.InitCairoImage(width, height))
 | 
					 | 
				
			||||||
            return NULL;
 | 
					 | 
				
			||||||
        ic.DrawEllipse(color, quadrant);
 | 
					 | 
				
			||||||
        cImage *ellipse = ic.GetImage();
 | 
					 | 
				
			||||||
        cairoImageCache.insert(pair<int, cImage*>(id, ellipse));
 | 
					 | 
				
			||||||
        hit = cairoImageCache.find(id);
 | 
					 | 
				
			||||||
        if (hit != cairoImageCache.end()) {
 | 
					 | 
				
			||||||
            return (cImage*)hit->second;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/****************************************************************************************
 | 
					 | 
				
			||||||
* PRIVATE FUNCTIONS
 | 
					 | 
				
			||||||
****************************************************************************************/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool cImageCache::LoadIcon(eImageType type, string name) {
 | 
					bool cImageCache::LoadIcon(eImageType type, string name) {
 | 
				
			||||||
    cString subdir("");
 | 
					    cString subdir("");
 | 
				
			||||||
    if (type == itMenuIcon)
 | 
					    if (type == itMenuIcon)
 | 
				
			||||||
@@ -393,17 +361,11 @@ void cImageCache::Clear(void) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    channelLogoCache.clear();
 | 
					    channelLogoCache.clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for(map<string, cImage*>::const_iterator it = skinPartsCache.begin(); it != skinPartsCache.end(); it++) {
 | 
					    for(map<std::string, cImage*>::const_iterator it = skinPartsCache.begin(); it != skinPartsCache.end(); it++) {
 | 
				
			||||||
        cImage *img = (cImage*)it->second;
 | 
					        cImage *img = (cImage*)it->second;
 | 
				
			||||||
        delete img;
 | 
					        delete img;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    skinPartsCache.clear();
 | 
					    skinPartsCache.clear();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    for(map<int, cImage*>::const_iterator it = cairoImageCache.begin(); it != cairoImageCache.end(); it++) {
 | 
					 | 
				
			||||||
        cImage *img = (cImage*)it->second;
 | 
					 | 
				
			||||||
        delete img;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    cairoImageCache.clear();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void cImageCache::Debug(bool full) {
 | 
					void cImageCache::Debug(bool full) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,9 +30,6 @@ public:
 | 
				
			|||||||
    //skinparts
 | 
					    //skinparts
 | 
				
			||||||
    void CacheSkinpart(string path, int width, int height);
 | 
					    void CacheSkinpart(string path, int width, int height);
 | 
				
			||||||
    cImage *GetSkinpart(string name, int width, int height);
 | 
					    cImage *GetSkinpart(string name, int width, int height);
 | 
				
			||||||
    //Cairo Images
 | 
					 | 
				
			||||||
    void CacheEllipse(int id, int width, int height, tColor color, int quadrant);
 | 
					 | 
				
			||||||
    cImage *GetEllipse(int id, int width, int height, tColor color, int quadrant);
 | 
					 | 
				
			||||||
    //helpers
 | 
					    //helpers
 | 
				
			||||||
    void Clear(void);
 | 
					    void Clear(void);
 | 
				
			||||||
    void Debug(bool full);
 | 
					    void Debug(bool full);
 | 
				
			||||||
@@ -49,7 +46,6 @@ private:
 | 
				
			|||||||
    map<string, cImage*> iconCache;
 | 
					    map<string, cImage*> iconCache;
 | 
				
			||||||
    map<string, cImage*> channelLogoCache;
 | 
					    map<string, cImage*> channelLogoCache;
 | 
				
			||||||
    map<string, cImage*> skinPartsCache;
 | 
					    map<string, cImage*> skinPartsCache;
 | 
				
			||||||
    map<int, cImage*> cairoImageCache;
 | 
					 | 
				
			||||||
    bool LoadIcon(eImageType type, string name);
 | 
					    bool LoadIcon(eImageType type, string name);
 | 
				
			||||||
    bool LoadLogo(const cChannel *channel);
 | 
					    bool LoadLogo(const cChannel *channel);
 | 
				
			||||||
    bool LoadSeparatorLogo(string name);
 | 
					    bool LoadSeparatorLogo(string name);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,202 +0,0 @@
 | 
				
			|||||||
#include "imagecreator.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cImageCreator::cImageCreator(void) {
 | 
					 | 
				
			||||||
	surface = NULL;
 | 
					 | 
				
			||||||
	cr = NULL;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cImageCreator::~cImageCreator() {
 | 
					 | 
				
			||||||
    if (cr)
 | 
					 | 
				
			||||||
	    cairo_destroy (cr);
 | 
					 | 
				
			||||||
    if (surface)
 | 
					 | 
				
			||||||
	    cairo_surface_destroy (surface);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool cImageCreator::InitCairoImage(int width, int height) {
 | 
					 | 
				
			||||||
	this->width = width;
 | 
					 | 
				
			||||||
	this->height = height;
 | 
					 | 
				
			||||||
	if (width < 1 || height < 1 || width > 1920 || height > 1080)
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
 | 
					 | 
				
			||||||
    cr = cairo_create(surface);
 | 
					 | 
				
			||||||
    cairo_set_antialias(cr, CAIRO_ANTIALIAS_BEST);
 | 
					 | 
				
			||||||
    return true;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**********************************************************************************
 | 
					 | 
				
			||||||
* Public Functions
 | 
					 | 
				
			||||||
**********************************************************************************/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
///< 0       draws the entire ellipse
 | 
					 | 
				
			||||||
///< 1..4    draws only the first, second, third or fourth quadrant, respectively
 | 
					 | 
				
			||||||
///< 5..8    draws the right, top, left or bottom half, respectively
 | 
					 | 
				
			||||||
///< -1..-4  draws the inverted part of the given quadrant
 | 
					 | 
				
			||||||
///< If Quadrants is not 0, the coordinates are those of the actual area, not
 | 
					 | 
				
			||||||
///< the full circle!
 | 
					 | 
				
			||||||
void cImageCreator::DrawEllipse(tColor color, int quadrants) {
 | 
					 | 
				
			||||||
    if (!cr || !surface)
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
	//center of the ellipse
 | 
					 | 
				
			||||||
	double x, y;
 | 
					 | 
				
			||||||
	//radius 
 | 
					 | 
				
			||||||
	double radius;
 | 
					 | 
				
			||||||
	//start and stop angle (radian)
 | 
					 | 
				
			||||||
	double arcStart, arcStop;
 | 
					 | 
				
			||||||
	//scaling factors
 | 
					 | 
				
			||||||
	double scaleX, scaleY;
 | 
					 | 
				
			||||||
	//draw inverted ellipse
 | 
					 | 
				
			||||||
	bool inverted;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	scaleX = width;
 | 
					 | 
				
			||||||
	scaleY = height;
 | 
					 | 
				
			||||||
	inverted = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch (quadrants) {
 | 
					 | 
				
			||||||
		case 0:
 | 
					 | 
				
			||||||
			x = 0.5;
 | 
					 | 
				
			||||||
			y = 0.5;
 | 
					 | 
				
			||||||
			radius = 0.5;
 | 
					 | 
				
			||||||
			arcStart = 0.0;
 | 
					 | 
				
			||||||
			arcStop = 2 * M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 1:
 | 
					 | 
				
			||||||
			x = 0.0;
 | 
					 | 
				
			||||||
			y = 1.0;
 | 
					 | 
				
			||||||
			radius = 1.0;
 | 
					 | 
				
			||||||
			arcStart = M_PI;
 | 
					 | 
				
			||||||
			arcStop = 2 * M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 2:
 | 
					 | 
				
			||||||
			x = 1.0;
 | 
					 | 
				
			||||||
			y = 1.0;
 | 
					 | 
				
			||||||
			radius = 1.0;
 | 
					 | 
				
			||||||
			arcStart = M_PI;
 | 
					 | 
				
			||||||
			arcStop = 2 * M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 3:
 | 
					 | 
				
			||||||
			x = 1.0;
 | 
					 | 
				
			||||||
			y = 0.0;
 | 
					 | 
				
			||||||
			radius = 1.0;
 | 
					 | 
				
			||||||
			arcStart = 0;
 | 
					 | 
				
			||||||
			arcStop = M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 4:
 | 
					 | 
				
			||||||
			x = 0.0;
 | 
					 | 
				
			||||||
			y = 0.0;
 | 
					 | 
				
			||||||
			radius = 1.0;
 | 
					 | 
				
			||||||
			arcStart = 0;
 | 
					 | 
				
			||||||
			arcStop = M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 5:
 | 
					 | 
				
			||||||
		    scaleX = 2 * width;
 | 
					 | 
				
			||||||
		    x = 0.0;
 | 
					 | 
				
			||||||
		    y = 0.5;
 | 
					 | 
				
			||||||
		    radius = 0.5;
 | 
					 | 
				
			||||||
		    arcStart = 0;
 | 
					 | 
				
			||||||
		    arcStop = 2* M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 6:
 | 
					 | 
				
			||||||
		    scaleY = 2 * height;
 | 
					 | 
				
			||||||
		    x = 0.5;
 | 
					 | 
				
			||||||
		    y = 0.5;
 | 
					 | 
				
			||||||
		    radius = 0.5;
 | 
					 | 
				
			||||||
		    arcStart = 0;
 | 
					 | 
				
			||||||
		    arcStop = 2* M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 7:
 | 
					 | 
				
			||||||
		    scaleX = 2 * width;
 | 
					 | 
				
			||||||
		    x = 0.5;
 | 
					 | 
				
			||||||
		    y = 0.5;
 | 
					 | 
				
			||||||
		    radius = 0.5;
 | 
					 | 
				
			||||||
		    arcStart = 0;
 | 
					 | 
				
			||||||
		    arcStop = 2* M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case 8:
 | 
					 | 
				
			||||||
		    scaleY = 2 * height;
 | 
					 | 
				
			||||||
		    x = 0.5;
 | 
					 | 
				
			||||||
		    y = 0.0;
 | 
					 | 
				
			||||||
		    radius = 0.5;
 | 
					 | 
				
			||||||
		    arcStart = 0;
 | 
					 | 
				
			||||||
		    arcStop = 2* M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case -1:
 | 
					 | 
				
			||||||
		    x = 0.0;
 | 
					 | 
				
			||||||
		    y = 1.0;
 | 
					 | 
				
			||||||
		    radius = 1.0;
 | 
					 | 
				
			||||||
		    arcStart = M_PI;
 | 
					 | 
				
			||||||
		    arcStop = 2* M_PI;
 | 
					 | 
				
			||||||
		    inverted = true;
 | 
					 | 
				
			||||||
		    break;
 | 
					 | 
				
			||||||
		case -2:
 | 
					 | 
				
			||||||
			x = 1.0;
 | 
					 | 
				
			||||||
			y = 1.0;
 | 
					 | 
				
			||||||
			radius = 1.0;
 | 
					 | 
				
			||||||
			arcStart = M_PI;
 | 
					 | 
				
			||||||
			arcStop = 2 * M_PI;
 | 
					 | 
				
			||||||
		    inverted = true;
 | 
					 | 
				
			||||||
		    break;
 | 
					 | 
				
			||||||
		case -3:
 | 
					 | 
				
			||||||
			x = 1.0;
 | 
					 | 
				
			||||||
			y = 0.0;
 | 
					 | 
				
			||||||
			radius = 1.0;
 | 
					 | 
				
			||||||
			arcStart = 0;
 | 
					 | 
				
			||||||
			arcStop = M_PI;
 | 
					 | 
				
			||||||
		    inverted = true;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		case -4:
 | 
					 | 
				
			||||||
			x = 0.0;
 | 
					 | 
				
			||||||
			y = 0.0;
 | 
					 | 
				
			||||||
			radius = 1.0;
 | 
					 | 
				
			||||||
			arcStart = 0;
 | 
					 | 
				
			||||||
			arcStop = M_PI;
 | 
					 | 
				
			||||||
		    inverted = true;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		default:
 | 
					 | 
				
			||||||
			x = 0.5;
 | 
					 | 
				
			||||||
			y = 0.5;
 | 
					 | 
				
			||||||
			radius = 0.5;
 | 
					 | 
				
			||||||
			arcStart = 0.0;
 | 
					 | 
				
			||||||
			arcStop = 2 * M_PI;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	SetColor(color);
 | 
					 | 
				
			||||||
	//Draw Background for inverted ellipses
 | 
					 | 
				
			||||||
	if (inverted) {
 | 
					 | 
				
			||||||
	    cairo_rectangle(cr, 0.0, 0.0, width, height);
 | 
					 | 
				
			||||||
	    cairo_fill (cr);
 | 
					 | 
				
			||||||
	    cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	//Draw Ellipse
 | 
					 | 
				
			||||||
	cairo_scale(cr, scaleX, scaleY);
 | 
					 | 
				
			||||||
	cairo_arc(cr, x, y, radius, arcStart, arcStop);
 | 
					 | 
				
			||||||
	cairo_fill(cr);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cImage *cImageCreator::GetImage(void) {
 | 
					 | 
				
			||||||
    if (!cr || !surface)
 | 
					 | 
				
			||||||
        NULL;
 | 
					 | 
				
			||||||
	unsigned char *data = cairo_image_surface_get_data(surface);
 | 
					 | 
				
			||||||
    cImage *image = new cImage(cSize(width, height), (tColor*)data);
 | 
					 | 
				
			||||||
    return image;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**********************************************************************************
 | 
					 | 
				
			||||||
* Private Functions
 | 
					 | 
				
			||||||
**********************************************************************************/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void cImageCreator::SetColor(tColor color) {
 | 
					 | 
				
			||||||
    if (!cr || !surface)
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
	tIndex tAlpha = (color & 0xFF000000) >> 24;
 | 
					 | 
				
			||||||
    tIndex tRed = (color & 0x00FF0000) >> 16;
 | 
					 | 
				
			||||||
    tIndex tGreen = (color & 0x0000FF00) >> 8;
 | 
					 | 
				
			||||||
    tIndex tBlue = (color & 0x000000FF);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    double a = (int)tAlpha / (double)255;
 | 
					 | 
				
			||||||
    double r = (int)tRed / (double)255;
 | 
					 | 
				
			||||||
    double g = (int)tGreen / (double)255;
 | 
					 | 
				
			||||||
    double b = (int)tBlue / (double)255;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    cairo_set_source_rgba(cr, r, g, b, a);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,26 +0,0 @@
 | 
				
			|||||||
#ifndef __IMAGECREATOR_H
 | 
					 | 
				
			||||||
#define __IMAGECREATOR_H
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <cairo.h>
 | 
					 | 
				
			||||||
#include <vdr/osd.h>
 | 
					 | 
				
			||||||
#include <string>
 | 
					 | 
				
			||||||
#include <sstream>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
using namespace std;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class cImageCreator {
 | 
					 | 
				
			||||||
private:
 | 
					 | 
				
			||||||
    int width;
 | 
					 | 
				
			||||||
    int height;
 | 
					 | 
				
			||||||
    cairo_surface_t *surface;
 | 
					 | 
				
			||||||
    cairo_t *cr;
 | 
					 | 
				
			||||||
    void SetColor(tColor color);
 | 
					 | 
				
			||||||
public:
 | 
					 | 
				
			||||||
    cImageCreator(void);
 | 
					 | 
				
			||||||
    virtual ~cImageCreator();
 | 
					 | 
				
			||||||
    bool InitCairoImage(int width, int height);
 | 
					 | 
				
			||||||
    void DrawEllipse(tColor color, int quadrants = 0);
 | 
					 | 
				
			||||||
    cImage *GetImage(void);
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif //__IMAGECREATOR_H
 | 
					 | 
				
			||||||
@@ -250,8 +250,6 @@ void cTemplate::CachePixmapImages(cTemplatePixmap *pix) {
 | 
				
			|||||||
    while(func = pix->GetNextFunction()) {
 | 
					    while(func = pix->GetNextFunction()) {
 | 
				
			||||||
        if (func->GetType() == ftDrawImage) {
 | 
					        if (func->GetType() == ftDrawImage) {
 | 
				
			||||||
            CacheImage(func);
 | 
					            CacheImage(func);
 | 
				
			||||||
        } else if (func->GetType() == ftDrawEllipse) {
 | 
					 | 
				
			||||||
            CacheEllipse(func);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -281,12 +279,3 @@ void cTemplate::CacheImage(cTemplateFunction *func) {
 | 
				
			|||||||
            break;
 | 
					            break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
void cTemplate::CacheEllipse(cTemplateFunction *func) {
 | 
					 | 
				
			||||||
    int id = func->GetId();
 | 
					 | 
				
			||||||
    int w = func->GetNumericParameter(ptWidth);
 | 
					 | 
				
			||||||
    int h = func->GetNumericParameter(ptHeight);
 | 
					 | 
				
			||||||
    tColor clr = func->GetColorParameter(ptColor);
 | 
					 | 
				
			||||||
    int quadrant = func->GetNumericParameter(ptQuadrant);
 | 
					 | 
				
			||||||
    imgCache->CacheEllipse(id, w, h, clr, quadrant);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,6 @@ private:
 | 
				
			|||||||
    eViewType viewType;
 | 
					    eViewType viewType;
 | 
				
			||||||
    void CachePixmapImages(cTemplatePixmap *pix);
 | 
					    void CachePixmapImages(cTemplatePixmap *pix);
 | 
				
			||||||
    void CacheImage(cTemplateFunction *func);
 | 
					    void CacheImage(cTemplateFunction *func);
 | 
				
			||||||
    void CacheEllipse(cTemplateFunction *func);
 | 
					 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    cGlobals *globals;
 | 
					    cGlobals *globals;
 | 
				
			||||||
    cTemplateView *rootView;
 | 
					    cTemplateView *rootView;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,10 +6,7 @@ using namespace std;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// --- cTemplateFunction -------------------------------------------------------------
 | 
					// --- cTemplateFunction -------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int cTemplateFunction::nextId = 0;
 | 
					cTemplateFunction::cTemplateFunction(eFuncType type) { 
 | 
				
			||||||
 | 
					 | 
				
			||||||
cTemplateFunction::cTemplateFunction(eFuncType type) {
 | 
					 | 
				
			||||||
    id = nextId++;
 | 
					 | 
				
			||||||
    this->type = type;
 | 
					    this->type = type;
 | 
				
			||||||
    debug = false;
 | 
					    debug = false;
 | 
				
			||||||
    containerX = 0; 
 | 
					    containerX = 0; 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,10 +102,7 @@ enum eOverflowType {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class cTemplateFunction {
 | 
					class cTemplateFunction {
 | 
				
			||||||
private:
 | 
					 | 
				
			||||||
    static int nextId;
 | 
					 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    int id;
 | 
					 | 
				
			||||||
    eFuncType type;
 | 
					    eFuncType type;
 | 
				
			||||||
    bool debug;
 | 
					    bool debug;
 | 
				
			||||||
    int containerX;                                                       //X of parent container
 | 
					    int containerX;                                                       //X of parent container
 | 
				
			||||||
@@ -188,7 +185,6 @@ public:
 | 
				
			|||||||
    //Parse parameters with dynamically set Tokens
 | 
					    //Parse parameters with dynamically set Tokens
 | 
				
			||||||
    bool ParseParameters(void);
 | 
					    bool ParseParameters(void);
 | 
				
			||||||
    //Getter Functions
 | 
					    //Getter Functions
 | 
				
			||||||
    int GetId(void) { return id; };
 | 
					 | 
				
			||||||
    eFuncType GetType(void) { return type; };
 | 
					    eFuncType GetType(void) { return type; };
 | 
				
			||||||
    bool DoDebug(void) { return debug; };
 | 
					    bool DoDebug(void) { return debug; };
 | 
				
			||||||
    string GetParameter(eParamType type);
 | 
					    string GetParameter(eParamType type);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,13 +22,19 @@
 | 
				
			|||||||
        <area x="0" y="0" width="100%" height="100%" layer="1">
 | 
					        <area x="0" y="0" width="100%" height="100%" layer="1">
 | 
				
			||||||
            <!-- top bar -->
 | 
					            <!-- top bar -->
 | 
				
			||||||
            <drawrectangle x="0" y="0" width="{areawidth}" height="10%" color="{clrBackground}" />
 | 
					            <drawrectangle x="0" y="0" width="{areawidth}" height="10%" color="{clrBackground}" />
 | 
				
			||||||
            <drawrectangle x="29%" y="10%" width="71%" height="1" color="{clrBorder}" />
 | 
					            <drawrectangle x="30%" y="{areaheight}*0.1 - 1" width="71%" height="1" color="{clrBorder}" />
 | 
				
			||||||
            <!-- menu bar -->
 | 
					            <!-- menu bar -->
 | 
				
			||||||
            <drawrectangle x="0" y="10%" width="{areawidth}*29/100" height="81%" color="{clrBackground}" />
 | 
					            <drawrectangle x="0" y="10%" width="{areawidth}*29/100" height="81%" color="{clrBackground}" />
 | 
				
			||||||
            <drawrectangle x="29%" y="10%" width="1" height="81%" color="{clrBorder}" />
 | 
					            <drawrectangle x="{areawidth}*29/100 - 1" y="12%" width="1" height="76%" color="{clrBorder}" />
 | 
				
			||||||
            <!-- bottom bar -->
 | 
					            <!-- bottom bar -->
 | 
				
			||||||
            <drawrectangle x="0" y="90%" width="{areawidth}" height="10%" color="{clrBackground}" />
 | 
					            <drawrectangle x="0" y="90%" width="{areawidth}" height="10%" color="{clrBackground}" />
 | 
				
			||||||
            <drawrectangle x="29%" y="90%" width="71%" height="1" color="{clrBorder}" />
 | 
					            <drawrectangle x="30%" y="{areaheight}*0.9 - 1" width="71%" height="1" color="{clrBorder}" />
 | 
				
			||||||
 | 
					            <!-- upper corner -->
 | 
				
			||||||
 | 
					            <drawellipse x="{areawidth}*29/100" y="{areaheight}/10" width="{areawidth}*2/100" height="{areawidth}*2/100" quadrant="-2" color="{clrBorder}" />
 | 
				
			||||||
 | 
					            <drawellipse x="{areawidth}*29/100 - 1" y="{areaheight}/10 - 1" width="{areawidth}*2/100" height="{areawidth}*2/100" quadrant="-2" color="{clrBackground}" />
 | 
				
			||||||
 | 
					            <!-- lower corner -->
 | 
				
			||||||
 | 
					            <drawellipse x="{areawidth}*29/100" y="{areaheight}*90/100 - {areawidth}*2/100" width="{areawidth}*2/100" height="{areawidth}*2/100" quadrant="-3" color="{clrBorder}" />
 | 
				
			||||||
 | 
					            <drawellipse x="{areawidth}*29/100 - 1" y="{areaheight}*90/100 - {areawidth}*2/100 + 1" width="{areawidth}*2/100" height="{areawidth}*2/100" quadrant="-3" color="{clrBackground}" />
 | 
				
			||||||
        </area>
 | 
					        </area>
 | 
				
			||||||
        <area x="0" y="0" width="100%" height="10%" layer="2">
 | 
					        <area x="0" y="0" width="100%" height="10%" layer="2">
 | 
				
			||||||
            <drawimage imagetype="skinpart" path="headertop" x="0" y="0" width="100%" height="100%"/>
 | 
					            <drawimage imagetype="skinpart" path="headertop" x="0" y="0" width="100%" height="100%"/>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -636,17 +636,14 @@ void cView::DoDrawEllipse(int num, cTemplateFunction *func, int x0, int y0) {
 | 
				
			|||||||
    y += y0;
 | 
					    y += y0;
 | 
				
			||||||
    int w = func->GetNumericParameter(ptWidth);
 | 
					    int w = func->GetNumericParameter(ptWidth);
 | 
				
			||||||
    int h = func->GetNumericParameter(ptHeight);
 | 
					    int h = func->GetNumericParameter(ptHeight);
 | 
				
			||||||
 | 
					    cRect size(x, y, w, h);
 | 
				
			||||||
    tColor clr = func->GetColorParameter(ptColor);
 | 
					    tColor clr = func->GetColorParameter(ptColor);
 | 
				
			||||||
    int quadrant = func->GetNumericParameter(ptQuadrant);
 | 
					    int quadrant = func->GetNumericParameter(ptQuadrant);
 | 
				
			||||||
    if (quadrant < -4 || quadrant > 8) {
 | 
					    if (quadrant < -4 || quadrant > 8) {
 | 
				
			||||||
        esyslog("skindesigner: wrong quadrant %d for drawellipse, allowed values are from -4 to 8", quadrant);
 | 
					        esyslog("skindesigner: wrong quadrant %d for drawellipse, allowed values are from -4 to 8", quadrant);
 | 
				
			||||||
        quadrant = 0;
 | 
					        quadrant = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    cImage *ellipse = imgCache->GetEllipse(func->GetId(), w, h, clr, quadrant);
 | 
					    DrawEllipse(num, size, clr, quadrant);
 | 
				
			||||||
    if (ellipse) {
 | 
					 | 
				
			||||||
        const cPoint point(x, y);
 | 
					 | 
				
			||||||
        DrawImage(num, point, *ellipse);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void cView::DoDrawSlope(int num, cTemplateFunction *func, int x0, int y0) {
 | 
					void cView::DoDrawSlope(int num, cTemplateFunction *func, int x0, int y0) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user