mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-01 01:20:25 +00:00
Merge branch 'master' of git@github.com:aseprite/aseprite.git
This commit is contained in:
commit
4b083030f1
@ -33,13 +33,14 @@ protected:
|
||||
|
||||
private:
|
||||
Action m_action;
|
||||
int m_percentage;
|
||||
render::Zoom m_zoom;
|
||||
};
|
||||
|
||||
ZoomCommand::ZoomCommand()
|
||||
: Command("Zoom",
|
||||
"Zoom",
|
||||
CmdUIOnlyFlag)
|
||||
, m_zoom(1, 1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -52,7 +53,8 @@ void ZoomCommand::onLoadParams(const Params& params)
|
||||
|
||||
std::string percentage = params.get("percentage");
|
||||
if (!percentage.empty()) {
|
||||
m_percentage = std::strtol(percentage.c_str(), NULL, 10);
|
||||
m_zoom = render::Zoom::fromScale(
|
||||
std::strtod(percentage.c_str(), NULL) / 100.0);
|
||||
m_action = Set;
|
||||
}
|
||||
}
|
||||
@ -74,7 +76,7 @@ void ZoomCommand::onExecute(Context* context)
|
||||
zoom.out();
|
||||
break;
|
||||
case Set:
|
||||
zoom = render::Zoom::fromScale(double(m_percentage) / 100.0);
|
||||
zoom = m_zoom;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -93,7 +95,7 @@ std::string ZoomCommand::onGetFriendlyName() const
|
||||
text += " out";
|
||||
break;
|
||||
case Set:
|
||||
text += " " + base::convert_to<std::string>(m_percentage) + "%";
|
||||
text += " " + base::convert_to<std::string>(int(100.0*m_zoom.scale())) + "%";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ bool GifFormat::onSave(FileOp* fop)
|
||||
PixelFormat sprite_format = sprite->pixelFormat();
|
||||
bool interlaced = gif_options->interlaced();
|
||||
int loop = (gif_options->loop() ? 0: -1);
|
||||
bool has_background = (sprite->backgroundLayer() ? true: false);
|
||||
bool has_background = (sprite->backgroundLayer() && sprite->backgroundLayer()->isVisible());
|
||||
int background_color = (sprite_format == IMAGE_INDEXED ? sprite->transparentColor(): 0);
|
||||
int transparent_index = (has_background ? -1: sprite->transparentColor());
|
||||
|
||||
|
@ -414,10 +414,11 @@ bool PngFormat::onSave(FileOp* fop)
|
||||
|
||||
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
|
||||
|
||||
// If the sprite does not have a background layer, we include the
|
||||
// alpha information of palette entries to indicate which is the
|
||||
// transparent color.
|
||||
if (fop->document->sprite()->backgroundLayer() == NULL) {
|
||||
// If the sprite does not have a (visible) background layer, we
|
||||
// include the alpha information of palette entries to indicate
|
||||
// which is the transparent color.
|
||||
if (fop->document->sprite()->backgroundLayer() == NULL ||
|
||||
!fop->document->sprite()->backgroundLayer()->isVisible()) {
|
||||
int mask_entry = fop->document->sprite()->transparentColor();
|
||||
int num_trans = mask_entry+1;
|
||||
png_bytep trans = (png_bytep)png_malloc(png_ptr, num_trans);
|
||||
|
@ -150,8 +150,10 @@ bool Sprite::needAlpha() const
|
||||
{
|
||||
switch (m_format) {
|
||||
case IMAGE_RGB:
|
||||
case IMAGE_GRAYSCALE:
|
||||
return (backgroundLayer() == NULL);
|
||||
case IMAGE_GRAYSCALE: {
|
||||
Layer* bg = backgroundLayer();
|
||||
return (!bg || !bg->isVisible());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user