mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 21:06:59 -04:00
Eliminated most build errors (gcc,linux,wxGTK).
What is left is mostly:
- warning: converting double to int
-> add a cast/to_int or ignore
- wrong initialization order in ctor
-> just swap the order to match the class
- errors about wxCursors
-> add a function loadResourceCursor
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@183 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -122,7 +122,7 @@ AColor LinearGradientSymbolFilter::color(double x, double y, SymbolSet point) co
|
||||
}
|
||||
|
||||
double LinearGradientSymbolFilter::t(double x, double y) const {
|
||||
double t= abs( (x - center_x) * (end_x - center_x) + (y - center_y) * (end_y - center_y)) / len;
|
||||
double t= fabs( (x - center_x) * (end_x - center_x) + (y - center_y) * (end_y - center_y)) / len;
|
||||
return min(1.,max(0.,t));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@ struct CharInfo {
|
||||
/// A section of text that can be rendered using a TextViewer
|
||||
class TextElement {
|
||||
public:
|
||||
/// What section of the input string is this element?
|
||||
size_t start, end;
|
||||
/// The text of which a subsection is drawn
|
||||
String text;
|
||||
/// What section of the input string is this element?
|
||||
size_t start, end;
|
||||
|
||||
inline TextElement(const String& text, size_t start ,size_t end) : text(text), start(start), end(end) {}
|
||||
virtual ~TextElement() {}
|
||||
|
||||
@@ -43,7 +43,7 @@ void ColorValueViewer::draw(RotatedDC& dc) {
|
||||
style().top_width < style().height && style().bottom_width < style().height;
|
||||
if (clip) {
|
||||
// clip away the inside of the rectangle
|
||||
wxRegion r = dc.tr(style().getRect());
|
||||
wxRegion r = dc.tr(style().getRect()).toRect();
|
||||
r.Subtract(dc.tr(RealRect(
|
||||
style().left + style().left_width,
|
||||
style().top + style().top_width,
|
||||
|
||||
@@ -22,7 +22,7 @@ void ImageValueViewer::draw(RotatedDC& dc) {
|
||||
InputStreamP image_file = getSet().openIn(value().filename);
|
||||
Image image;
|
||||
if (image.LoadFile(*image_file)) {
|
||||
image.Rescale(dc.trS(style().width), dc.trS(style().height));
|
||||
image.Rescale((int)dc.trS(style().width), (int)dc.trS(style().height));
|
||||
// apply mask to image
|
||||
loadMask(dc);
|
||||
if (alpha_mask) alpha_mask->setAlpha(image);
|
||||
@@ -34,7 +34,7 @@ void ImageValueViewer::draw(RotatedDC& dc) {
|
||||
}
|
||||
// if there is no image, generate a placeholder, only if there is enough room for it
|
||||
if (!bitmap.Ok() && style().width > 40) {
|
||||
bitmap = imagePlaceholder(dc, dc.trS(style().width), dc.trS(style().height), viewer.drawEditing());
|
||||
bitmap = imagePlaceholder(dc, (int)dc.trS(style().width), (int)dc.trS(style().height), viewer.drawEditing());
|
||||
loadMask(dc);
|
||||
if (alpha_mask) alpha_mask->setAlpha(bitmap);
|
||||
}
|
||||
@@ -45,15 +45,15 @@ void ImageValueViewer::draw(RotatedDC& dc) {
|
||||
}
|
||||
|
||||
bool ImageValueViewer::containsPoint(const RealPoint& p) const {
|
||||
int x = p.x - style().left;
|
||||
int y = p.y - style().top;
|
||||
if (x < 0 || y < 0 || x >= (int)style().width || y >= (int)style().height) {
|
||||
double x = p.x - style().left;
|
||||
double y = p.y - style().top;
|
||||
if (x < 0 || y < 0 || x >= style().width || y >= style().height) {
|
||||
return false; // outside rectangle
|
||||
}
|
||||
// check against mask
|
||||
if (!style().mask_filename().empty()) {
|
||||
loadMask(viewer.getRotation());
|
||||
return !alpha_mask || !alpha_mask->isTransparent(x, y);
|
||||
return !alpha_mask || !alpha_mask->isTransparent((int)x, (int)y);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@@ -70,12 +70,13 @@ void ImageValueViewer::onStyleChange() {
|
||||
|
||||
void ImageValueViewer::loadMask(const Rotation& rot) const {
|
||||
if (style().mask_filename().empty()) return; // no mask
|
||||
if (alpha_mask && alpha_mask->size == wxSize(rot.trS(style().width), rot.trS(style().height))) return; // mask loaded and right size
|
||||
int w = rot.trS(style().width), h = rot.trS(style().height);
|
||||
if (alpha_mask && alpha_mask->size == wxSize(w,h)) return; // mask loaded and right size
|
||||
// (re) load the mask
|
||||
Image image;
|
||||
InputStreamP image_file = viewer.stylesheet->openIn(style().mask_filename);
|
||||
if (image.LoadFile(*image_file)) {
|
||||
Image resampled(rot.trS(style().width), rot.trS(style().height));
|
||||
Image resampled(w,h);
|
||||
resample(image, resampled);
|
||||
alpha_mask = new_shared1<AlphaMask>(resampled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user