Moved mask to Style and mask related drawing to ValueViewer.

Used the same mask also for TextStyles.
To keep the text selectable (since the mask is now also used for containsPoint), the future sight cost masks needed to be updated.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1183 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-08-30 23:49:12 +00:00
parent a183ecc9a6
commit a2af3211a4
28 changed files with 105 additions and 214 deletions
+2 -4
View File
@@ -213,9 +213,8 @@ void ChoiceStyle::initImage() {
int ChoiceStyle::update(Context& ctx) {
// Don't update the choice images, leave that to invalidate()
int change = Style ::update(ctx)
| font .update(ctx) * CHANGE_OTHER
| mask .update(ctx) * CHANGE_MASK;
int change = Style::update(ctx)
| font .update(ctx) * CHANGE_OTHER;
if (!choice_images_initialized) {
// we only want to do this once because it is rather slow, other updates are handled by dependencies
choice_images_initialized = true;
@@ -283,7 +282,6 @@ IMPLEMENT_REFLECTION(ChoiceStyle) {
REFLECT_BASE(Style);
REFLECT(popup_style);
REFLECT(render_style);
REFLECT(mask);
REFLECT(combine);
REFLECT(alignment);
REFLECT(font);
-1
View File
@@ -146,7 +146,6 @@ class ChoiceStyle : public Style {
CachedScriptableImage image; ///< Image to draw (when RENDER_IMAGE)
map<String,ScriptableImage> choice_images; ///< Images for the various choices (when RENDER_IMAGE)
bool choice_images_initialized;
CachedScriptableMask mask; ///< Mask image
ImageCombine combine; ///< Combining mode for drawing the images
Alignment alignment; ///< Alignment of images
wxImageList* thumbnails; ///< Thumbnails for the choices
+1 -3
View File
@@ -62,13 +62,11 @@ IMPLEMENT_REFLECTION(ColorStyle) {
REFLECT(right_width);
REFLECT(top_width);
REFLECT(bottom_width);
REFLECT(mask);
REFLECT(combine);
}
int ColorStyle::update(Context& ctx) {
return Style::update(ctx)
| mask.update(ctx) * CHANGE_MASK;
return Style::update(ctx);
}
// ----------------------------------------------------------------------------- : ColorValue
+6 -7
View File
@@ -57,13 +57,12 @@ class ColorStyle : public Style {
ColorStyle(const ColorFieldP& field);
DECLARE_STYLE_TYPE(Color);
double radius; ///< Radius of round corners
double left_width; ///< Width of the colored region on the left side
double right_width; ///< Width of the colored region on the right side
double top_width; ///< Width of the colored region on the top side
double bottom_width; ///< Width of the colored region on the bottom side
CachedScriptableMask mask; ///< Mask image
ImageCombine combine; ///< How to combine image with the background
double radius; ///< Radius of round corners
double left_width; ///< Width of the colored region on the left side
double right_width; ///< Width of the colored region on the right side
double top_width; ///< Width of the colored region on the top side
double bottom_width; ///< Width of the colored region on the bottom side
ImageCombine combine; ///< How to combine image with the background
virtual int update(Context&);
};
-2
View File
@@ -23,13 +23,11 @@ IMPLEMENT_REFLECTION(ImageField) {
IMPLEMENT_REFLECTION(ImageStyle) {
REFLECT_BASE(Style);
REFLECT(mask);
REFLECT_N("default", default_image);
}
int ImageStyle::update(Context& ctx) {
return Style ::update(ctx)
| mask .update(ctx) * CHANGE_MASK
| default_image.update(ctx) * CHANGE_DEFAULT;
}
+1 -2
View File
@@ -35,8 +35,7 @@ class ImageStyle : public Style {
inline ImageStyle(const ImageFieldP& field) : Style(field) {}
DECLARE_STYLE_TYPE(Image);
CachedScriptableMask mask; ///< Mask image
ScriptableImage default_image; ///< Placeholder
ScriptableImage default_image; ///< Placeholder
virtual int update(Context&);
};
-1
View File
@@ -111,7 +111,6 @@ IMPLEMENT_REFLECTION(TextStyle) {
REFLECT(line_height_hard_max);
REFLECT(line_height_line_max);
REFLECT(paragraph_height);
REFLECT_N("mask", mask_filename);
REFLECT(direction);
reflect_content(tag, *this);
}
-2
View File
@@ -67,8 +67,6 @@ class TextStyle : public Style {
double line_height_hard_max; ///< Maximum line height
double line_height_line_max; ///< Maximum line height
double paragraph_height; ///< Fixed height of paragraphs
String mask_filename; ///< Filename of the mask
AlphaMask mask; ///< Mask to fit the text to (may be null)
Direction direction; ///< In what direction is text layed out?
// information from text rendering
double content_width, content_height; ///< Size of the rendered text