mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
Added some assertions
This commit is contained in:
@@ -84,6 +84,7 @@ Image BlankImage::generate(const Options& opt) const {
|
|||||||
int w = max(1, opt.width >= 0 ? opt.width : opt.height);
|
int w = max(1, opt.width >= 0 ? opt.width : opt.height);
|
||||||
int h = max(1, opt.height >= 0 ? opt.height : opt.width);
|
int h = max(1, opt.height >= 0 ? opt.height : opt.width);
|
||||||
Image img(w, h);
|
Image img(w, h);
|
||||||
|
assert(img.Ok());
|
||||||
img.InitAlpha();
|
img.InitAlpha();
|
||||||
memset(img.GetAlpha(), 0, w * h);
|
memset(img.GetAlpha(), 0, w * h);
|
||||||
return img;
|
return img;
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ void AlphaMask::convexHull(vector<wxPoint>& points) const {
|
|||||||
|
|
||||||
Image AlphaMask::colorImage(const Color& color) const {
|
Image AlphaMask::colorImage(const Color& color) const {
|
||||||
Image image(size.x, size.y);
|
Image image(size.x, size.y);
|
||||||
|
assert(image.Ok());
|
||||||
fill_image(image, color);
|
fill_image(image, color);
|
||||||
setAlpha(image);
|
setAlpha(image);
|
||||||
return image;
|
return image;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ void draw_choice_viewer(RotatedDC& dc, ValueViewer& viewer, ChoiceStyle& style,
|
|||||||
dc.DrawPreRotatedBitmap(bitmap,rect);
|
dc.DrawPreRotatedBitmap(bitmap,rect);
|
||||||
} else {
|
} else {
|
||||||
// use combine mode
|
// use combine mode
|
||||||
|
assert(image.Ok());
|
||||||
dc.DrawPreRotatedImage(image,rect,combine);
|
dc.DrawPreRotatedImage(image,rect,combine);
|
||||||
}
|
}
|
||||||
margin = size.width + 2;
|
margin = size.width + 2;
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ template <> void GetDefaultMember::handle(const ScriptableImage& s) {
|
|||||||
void CachedScriptableImage::generateCached(const GeneratedImage::Options& options,
|
void CachedScriptableImage::generateCached(const GeneratedImage::Options& options,
|
||||||
CachedScriptableMask* mask,
|
CachedScriptableMask* mask,
|
||||||
ImageCombine* combine, wxBitmap* bitmap, wxImage* image, RealSize* size) {
|
ImageCombine* combine, wxBitmap* bitmap, wxImage* image, RealSize* size) {
|
||||||
|
assert(image && bitmap);
|
||||||
// ready?
|
// ready?
|
||||||
if (!isReady()) {
|
if (!isReady()) {
|
||||||
// error, return blank image
|
// error, return blank image
|
||||||
@@ -137,6 +138,7 @@ void CachedScriptableImage::generateCached(const GeneratedImage::Options& option
|
|||||||
const_cast<GeneratedImage::Options&>(options).angle = 0;
|
const_cast<GeneratedImage::Options&>(options).angle = 0;
|
||||||
// generate
|
// generate
|
||||||
cached_i = generate(options);
|
cached_i = generate(options);
|
||||||
|
assert(cached_i.Ok());
|
||||||
const_cast<GeneratedImage::Options&>(options).angle = cached_angle = a;
|
const_cast<GeneratedImage::Options&>(options).angle = cached_angle = a;
|
||||||
*size = cached_size = RealSize(options.width, options.height);
|
*size = cached_size = RealSize(options.width, options.height);
|
||||||
if (mask) {
|
if (mask) {
|
||||||
@@ -157,6 +159,7 @@ void CachedScriptableImage::generateCached(const GeneratedImage::Options& option
|
|||||||
} else {
|
} else {
|
||||||
*image = cached_i;
|
*image = cached_i;
|
||||||
}
|
}
|
||||||
|
assert(image->Ok() || bitmap->Ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CachedScriptableImage::update(Context& ctx) {
|
bool CachedScriptableImage::update(Context& ctx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user