mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-04 13:59:46 +00:00
Remove JLists from Sprite class.
This commit is contained in:
parent
da193338af
commit
e885fcd3a1
@ -287,7 +287,6 @@ static bool save_ASE(FileOp *fop)
|
|||||||
Sprite *sprite = fop->sprite;
|
Sprite *sprite = fop->sprite;
|
||||||
ASE_Header header;
|
ASE_Header header;
|
||||||
ASE_FrameHeader frame_header;
|
ASE_FrameHeader frame_header;
|
||||||
JLink link;
|
|
||||||
int frame;
|
int frame;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
@ -323,10 +322,10 @@ static bool save_ASE(FileOp *fop)
|
|||||||
for (; it != end; ++it)
|
for (; it != end; ++it)
|
||||||
ase_file_write_layers(f, *it);
|
ase_file_write_layers(f, *it);
|
||||||
|
|
||||||
/* write masks */
|
// Write all masks.
|
||||||
JList masks = sprite->getMasksRepository();
|
MasksList masks = sprite->getMasksRepository();
|
||||||
JI_LIST_FOR_EACH(masks, link)
|
for (MasksList::iterator it = masks.begin(); it != masks.end(); ++it)
|
||||||
ase_file_write_mask_chunk(f, reinterpret_cast<Mask*>(link->data));
|
ase_file_write_mask_chunk(f, *it);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write cel chunks */
|
/* write cel chunks */
|
||||||
|
@ -320,8 +320,8 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* palettes support */
|
// Palettes support.
|
||||||
if (jlist_length(fop->sprite->getPalettes()) > 1) {
|
if (fop->sprite->getPalettes().size() > 1) {
|
||||||
if (!(fop->format->flags & (FILE_SUPPORT_PALETTES |
|
if (!(fop->format->flags & (FILE_SUPPORT_PALETTES |
|
||||||
FILE_SUPPORT_SEQUENCES))) {
|
FILE_SUPPORT_SEQUENCES))) {
|
||||||
usprintf(buf+ustrlen(buf), "<<- Palette changes between frames");
|
usprintf(buf+ustrlen(buf), "<<- Palette changes between frames");
|
||||||
@ -329,14 +329,12 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* repositories */
|
/* repositories */
|
||||||
JList masks = fop->sprite->getMasksRepository();
|
MasksList masks = fop->sprite->getMasksRepository();
|
||||||
if (!jlist_empty(masks)) {
|
if (!masks.empty()) {
|
||||||
Mask *mask;
|
|
||||||
JLink link;
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(masks, link) {
|
for (MasksList::iterator it = masks.begin(); it != masks.end(); ++it) {
|
||||||
mask = reinterpret_cast<Mask*>(link->data);
|
Mask* mask = *it;
|
||||||
|
|
||||||
// Names starting with '*' are ignored
|
// Names starting with '*' are ignored
|
||||||
if (mask->name && *mask->name == '*')
|
if (mask->name && *mask->name == '*')
|
||||||
@ -350,7 +348,7 @@ FileOp *fop_to_save_sprite(Sprite *sprite)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jlist_empty(fop->sprite->getPathsRepository())) {
|
if (!fop->sprite->getPathsRepository().empty()) {
|
||||||
if (!(fop->format->flags & FILE_SUPPORT_PATHS_REPOSITORY)) {
|
if (!(fop->format->flags & FILE_SUPPORT_PATHS_REPOSITORY)) {
|
||||||
usprintf(buf+ustrlen(buf), "<<- Path Repository");
|
usprintf(buf+ustrlen(buf), "<<- Path Repository");
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,8 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gui/jlist.h"
|
|
||||||
|
|
||||||
#include "base/mutex.h"
|
#include "base/mutex.h"
|
||||||
|
#include "base/remove_from_container.h"
|
||||||
#include "base/scoped_lock.h"
|
#include "base/scoped_lock.h"
|
||||||
#include "file/format_options.h"
|
#include "file/format_options.h"
|
||||||
#include "raster/raster.h"
|
#include "raster/raster.h"
|
||||||
@ -152,11 +151,9 @@ public:
|
|||||||
return layer2index(getFolder(), layer, &index_count);
|
return layer2index(getFolder(), layer, &index_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Palette* getPalette(int frame) const;
|
Palette* getPalette(int frame) const;
|
||||||
|
|
||||||
Palette* getPalette(int frame);
|
PalettesList getPalettes() const {
|
||||||
|
|
||||||
JList getPalettes() {
|
|
||||||
return m_palettes;
|
return m_palettes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,28 +319,28 @@ public:
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// And add the new mask
|
// And add the new mask
|
||||||
jlist_append(m_repository.masks, mask);
|
m_repository.masks.push_back(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeMask(Mask* mask) {
|
void removeMask(Mask* mask) {
|
||||||
// Remove the mask from the repository
|
// Remove the mask from the repository
|
||||||
jlist_remove(m_repository.masks, mask);
|
base::remove_from_container(m_repository.masks, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mask* requestMask(const char* name) const;
|
Mask* requestMask(const char* name) const;
|
||||||
|
|
||||||
void generateMaskBoundaries(Mask* mask = NULL);
|
void generateMaskBoundaries(Mask* mask = NULL);
|
||||||
|
|
||||||
JList getMasksRepository() {
|
MasksList getMasksRepository() {
|
||||||
return m_repository.masks;
|
return m_repository.masks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addPath(Path* path) {
|
void addPath(Path* path) {
|
||||||
jlist_append(m_repository.paths, path);
|
m_repository.paths.push_back(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removePath(Path* path) {
|
void removePath(Path* path) {
|
||||||
jlist_remove(m_repository.paths, path);
|
base::remove_from_container(m_repository.paths, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPath(const Path* path) {
|
void setPath(const Path* path) {
|
||||||
@ -353,7 +350,7 @@ public:
|
|||||||
m_path = path_new_copy(path);
|
m_path = path_new_copy(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
JList getPathsRepository() {
|
PathsList getPathsRepository() {
|
||||||
return m_repository.paths;
|
return m_repository.paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +399,7 @@ private:
|
|||||||
int m_frames; // how many frames has this sprite
|
int m_frames; // how many frames has this sprite
|
||||||
std::vector<int> m_frlens; // duration per frame
|
std::vector<int> m_frlens; // duration per frame
|
||||||
int m_frame; // current frame, range [0,frames)
|
int m_frame; // current frame, range [0,frames)
|
||||||
JList m_palettes; // list of palettes
|
PalettesList m_palettes; // list of palettes
|
||||||
Stock* m_stock; // stock to get images
|
Stock* m_stock; // stock to get images
|
||||||
LayerFolder* m_folder; // main folder of layers
|
LayerFolder* m_folder; // main folder of layers
|
||||||
Layer* m_layer; // current layer
|
Layer* m_layer; // current layer
|
||||||
@ -410,8 +407,8 @@ private:
|
|||||||
Mask* m_mask; // selected mask region
|
Mask* m_mask; // selected mask region
|
||||||
Undo* m_undo; // undo stack
|
Undo* m_undo; // undo stack
|
||||||
struct {
|
struct {
|
||||||
JList paths; // paths
|
PathsList paths; // paths
|
||||||
JList masks; // masks
|
MasksList masks; // masks
|
||||||
} m_repository;
|
} m_repository;
|
||||||
|
|
||||||
// Selected mask region boundaries
|
// Selected mask region boundaries
|
||||||
@ -454,15 +451,12 @@ SpriteImpl::SpriteImpl(Sprite* sprite, int imgtype, int width, int height, int n
|
|||||||
m_frames = 1;
|
m_frames = 1;
|
||||||
m_frlens.push_back(100); // First frame with 100 msecs of duration
|
m_frlens.push_back(100); // First frame with 100 msecs of duration
|
||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
m_palettes = jlist_new();
|
|
||||||
m_stock = stock_new(imgtype);
|
m_stock = stock_new(imgtype);
|
||||||
m_folder = new LayerFolder(m_self);
|
m_folder = new LayerFolder(m_self);
|
||||||
m_layer = NULL;
|
m_layer = NULL;
|
||||||
m_path = NULL;
|
m_path = NULL;
|
||||||
m_mask = mask_new();
|
m_mask = mask_new();
|
||||||
m_undo = new Undo(m_self);
|
m_undo = new Undo(m_self);
|
||||||
m_repository.paths = jlist_new();
|
|
||||||
m_repository.masks = jlist_new();
|
|
||||||
m_extraCel = NULL;
|
m_extraCel = NULL;
|
||||||
m_extraImage = NULL;
|
m_extraImage = NULL;
|
||||||
|
|
||||||
@ -516,7 +510,6 @@ SpriteImpl::SpriteImpl(Sprite* sprite, int imgtype, int width, int height, int n
|
|||||||
*/
|
*/
|
||||||
SpriteImpl* SpriteImpl::copyBase(Sprite* new_sprite, const SpriteImpl* src_sprite)
|
SpriteImpl* SpriteImpl::copyBase(Sprite* new_sprite, const SpriteImpl* src_sprite)
|
||||||
{
|
{
|
||||||
JLink link;
|
|
||||||
SpriteImpl* dst_sprite = new SpriteImpl(new_sprite,
|
SpriteImpl* dst_sprite = new SpriteImpl(new_sprite,
|
||||||
src_sprite->m_imgtype,
|
src_sprite->m_imgtype,
|
||||||
src_sprite->m_width, src_sprite->m_height,
|
src_sprite->m_width, src_sprite->m_height,
|
||||||
@ -539,9 +532,13 @@ SpriteImpl* SpriteImpl::copyBase(Sprite* new_sprite, const SpriteImpl* src_sprit
|
|||||||
dst_sprite->m_frlens.begin());
|
dst_sprite->m_frlens.begin());
|
||||||
|
|
||||||
// Copy color palettes
|
// Copy color palettes
|
||||||
JI_LIST_FOR_EACH(src_sprite->m_palettes, link) {
|
{
|
||||||
Palette* pal = reinterpret_cast<Palette*>(link->data);
|
PalettesList::const_iterator end = src_sprite->m_palettes.end();
|
||||||
dst_sprite->setPalette(pal, true);
|
PalettesList::const_iterator it = src_sprite->m_palettes.begin();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
Palette* pal = *it;
|
||||||
|
dst_sprite->setPalette(pal, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy path
|
// Copy path
|
||||||
@ -563,16 +560,24 @@ SpriteImpl* SpriteImpl::copyBase(Sprite* new_sprite, const SpriteImpl* src_sprit
|
|||||||
dst_sprite->m_mask = mask_new_copy(src_sprite->m_mask);
|
dst_sprite->m_mask = mask_new_copy(src_sprite->m_mask);
|
||||||
|
|
||||||
/* copy repositories */
|
/* copy repositories */
|
||||||
JI_LIST_FOR_EACH(src_sprite->m_repository.paths, link) {
|
{
|
||||||
Path* path_copy = path_new_copy(reinterpret_cast<Path*>(link->data));
|
PathsList::const_iterator end = src_sprite->m_repository.paths.end();
|
||||||
if (path_copy)
|
PathsList::const_iterator it = src_sprite->m_repository.paths.begin();
|
||||||
dst_sprite->addPath(path_copy);
|
for (; it != end; ++it) {
|
||||||
|
Path* path_copy = path_new_copy(*it);
|
||||||
|
if (path_copy)
|
||||||
|
dst_sprite->addPath(path_copy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(src_sprite->m_repository.masks, link) {
|
{
|
||||||
Mask* mask_copy = mask_new_copy(reinterpret_cast<Mask*>(link->data));
|
MasksList::const_iterator end = src_sprite->m_repository.masks.end();
|
||||||
if (mask_copy)
|
MasksList::const_iterator it = src_sprite->m_repository.masks.begin();
|
||||||
dst_sprite->addMask(mask_copy);
|
for (; it != end; ++it) {
|
||||||
|
Mask* mask_copy = mask_new_copy(*it);
|
||||||
|
if (mask_copy)
|
||||||
|
dst_sprite->addMask(mask_copy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy preferred edition options
|
// Copy preferred edition options
|
||||||
@ -613,8 +618,6 @@ SpriteImpl* SpriteImpl::copyLayers(SpriteImpl* dst_sprite, const SpriteImpl* src
|
|||||||
|
|
||||||
SpriteImpl::~SpriteImpl()
|
SpriteImpl::~SpriteImpl()
|
||||||
{
|
{
|
||||||
JLink link;
|
|
||||||
|
|
||||||
// Destroy layers
|
// Destroy layers
|
||||||
delete m_folder;
|
delete m_folder;
|
||||||
|
|
||||||
@ -623,27 +626,27 @@ SpriteImpl::~SpriteImpl()
|
|||||||
stock_free(m_stock);
|
stock_free(m_stock);
|
||||||
|
|
||||||
// Destroy paths
|
// Destroy paths
|
||||||
if (m_repository.paths) {
|
{
|
||||||
JI_LIST_FOR_EACH(m_repository.paths, link)
|
PathsList::iterator end = m_repository.paths.end();
|
||||||
path_free(reinterpret_cast<Path*>(link->data));
|
PathsList::iterator it = m_repository.paths.begin();
|
||||||
|
for (; it != end; ++it)
|
||||||
jlist_free(m_repository.paths);
|
path_free(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy masks
|
// Destroy masks
|
||||||
if (m_repository.masks) {
|
{
|
||||||
JI_LIST_FOR_EACH(m_repository.masks, link)
|
MasksList::iterator end = m_repository.masks.end();
|
||||||
mask_free(reinterpret_cast<Mask*>(link->data));
|
MasksList::iterator it = m_repository.masks.begin();
|
||||||
|
for (; it != end; ++it)
|
||||||
jlist_free(m_repository.masks);
|
mask_free(*it);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy palettes
|
// Destroy palettes
|
||||||
if (m_palettes) {
|
{
|
||||||
JI_LIST_FOR_EACH(m_palettes, link)
|
PalettesList::iterator end = m_palettes.end();
|
||||||
delete reinterpret_cast<Palette*>(link->data);
|
PalettesList::iterator it = m_palettes.begin();
|
||||||
|
for (; it != end; ++it)
|
||||||
jlist_free(m_palettes);
|
delete *it; // palette
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy undo, mask, etc.
|
// Destroy undo, mask, etc.
|
||||||
@ -794,11 +797,11 @@ void SpriteImpl::setTotalFrames(int frames)
|
|||||||
|
|
||||||
Mask *SpriteImpl::requestMask(const char *name) const
|
Mask *SpriteImpl::requestMask(const char *name) const
|
||||||
{
|
{
|
||||||
Mask *mask;
|
MasksList::const_iterator end = m_repository.masks.end();
|
||||||
JLink link;
|
MasksList::const_iterator it = m_repository.masks.begin();
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(m_repository.masks, link) {
|
for (; it != end; ++it) {
|
||||||
mask = reinterpret_cast<Mask*>(link->data);
|
Mask* mask = *it;
|
||||||
if (strcmp(mask->name, name) == 0)
|
if (strcmp(mask->name, name) == 0)
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
@ -849,38 +852,16 @@ int SpriteImpl::getPixel(int x, int y) const
|
|||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Palette* SpriteImpl::getPalette(int frame) const
|
Palette* SpriteImpl::getPalette(int frame) const
|
||||||
{
|
{
|
||||||
const Palette* found = NULL;
|
|
||||||
const Palette* pal;
|
|
||||||
JLink link;
|
|
||||||
|
|
||||||
ASSERT(frame >= 0);
|
ASSERT(frame >= 0);
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(m_palettes, link) {
|
|
||||||
pal = reinterpret_cast<const Palette*>(link->data);
|
|
||||||
if (frame < pal->getFrame())
|
|
||||||
break;
|
|
||||||
|
|
||||||
found = pal;
|
|
||||||
if (frame == pal->getFrame())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT(found != NULL);
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
|
|
||||||
Palette* SpriteImpl::getPalette(int frame)
|
|
||||||
{
|
|
||||||
Palette* found = NULL;
|
Palette* found = NULL;
|
||||||
Palette* pal;
|
|
||||||
JLink link;
|
|
||||||
|
|
||||||
ASSERT(frame >= 0);
|
PalettesList::const_iterator end = m_palettes.end();
|
||||||
|
PalettesList::const_iterator it = m_palettes.begin();
|
||||||
JI_LIST_FOR_EACH(m_palettes, link) {
|
for (; it != end; ++it) {
|
||||||
pal = reinterpret_cast<Palette*>(link->data);
|
Palette* pal = *it;
|
||||||
if (frame < pal->getFrame())
|
if (frame < pal->getFrame())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -902,11 +883,12 @@ void SpriteImpl::setPalette(Palette* pal, bool truncate)
|
|||||||
pal->copyColorsTo(sprite_pal);
|
pal->copyColorsTo(sprite_pal);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
JLink link = NULL;
|
|
||||||
Palette* other;
|
Palette* other;
|
||||||
|
|
||||||
JI_LIST_FOR_EACH(m_palettes, link) {
|
PalettesList::iterator end = m_palettes.end();
|
||||||
other = reinterpret_cast<Palette*>(link->data);
|
PalettesList::iterator it = m_palettes.begin();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
other = *it;
|
||||||
|
|
||||||
if (pal->getFrame() == other->getFrame()) {
|
if (pal->getFrame() == other->getFrame()) {
|
||||||
pal->copyColorsTo(other);
|
pal->copyColorsTo(other);
|
||||||
@ -916,31 +898,26 @@ void SpriteImpl::setPalette(Palette* pal, bool truncate)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
jlist_insert_before(m_palettes, link, new Palette(*pal));
|
m_palettes.insert(it, new Palette(*pal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteImpl::resetPalettes()
|
void SpriteImpl::resetPalettes()
|
||||||
{
|
{
|
||||||
JLink link, next;
|
PalettesList::iterator end = m_palettes.end();
|
||||||
|
PalettesList::iterator it = m_palettes.begin();
|
||||||
|
for (; it != end; ++it)
|
||||||
|
delete *it; // palette
|
||||||
|
|
||||||
JI_LIST_FOR_EACH_SAFE(m_palettes, link, next) {
|
m_palettes.clear();
|
||||||
if (jlist_first(m_palettes) != link) {
|
|
||||||
delete reinterpret_cast<Palette*>(link->data);
|
|
||||||
jlist_delete_link(m_palettes, link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteImpl::deletePalette(Palette* pal)
|
void SpriteImpl::deletePalette(Palette* pal)
|
||||||
{
|
{
|
||||||
ASSERT(pal != NULL);
|
ASSERT(pal != NULL);
|
||||||
|
|
||||||
JLink link = jlist_find(m_palettes, pal);
|
base::remove_from_container(m_palettes, pal);
|
||||||
ASSERT(link != NULL);
|
delete pal; // palette
|
||||||
|
|
||||||
delete pal;
|
|
||||||
jlist_delete_link(m_palettes, link);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpriteImpl::destroyExtraCel()
|
void SpriteImpl::destroyExtraCel()
|
||||||
@ -1252,17 +1229,12 @@ int Sprite::layerToIndex(const Layer* layer) const
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Palettes
|
// Palettes
|
||||||
|
|
||||||
const Palette* Sprite::getPalette(int frame) const
|
Palette* Sprite::getPalette(int frame) const
|
||||||
{
|
{
|
||||||
return m_impl->getPalette(frame);
|
return m_impl->getPalette(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
Palette* Sprite::getPalette(int frame)
|
PalettesList Sprite::getPalettes() const
|
||||||
{
|
|
||||||
return m_impl->getPalette(frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
JList Sprite::getPalettes()
|
|
||||||
{
|
{
|
||||||
return m_impl->getPalettes();
|
return m_impl->getPalettes();
|
||||||
}
|
}
|
||||||
@ -1445,7 +1417,7 @@ void Sprite::generateMaskBoundaries(Mask* mask)
|
|||||||
m_impl->generateMaskBoundaries(mask);
|
m_impl->generateMaskBoundaries(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
JList Sprite::getMasksRepository()
|
MasksList Sprite::getMasksRepository()
|
||||||
{
|
{
|
||||||
return m_impl->getMasksRepository();
|
return m_impl->getMasksRepository();
|
||||||
}
|
}
|
||||||
@ -1477,7 +1449,7 @@ void Sprite::setPath(const Path* path)
|
|||||||
m_impl->setPath(path);
|
m_impl->setPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
JList Sprite::getPathsRepository()
|
PathsList Sprite::getPathsRepository()
|
||||||
{
|
{
|
||||||
return m_impl->getPathsRepository();
|
return m_impl->getPathsRepository();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#ifndef RASTER_SPRITE_H_INCLUDED
|
#ifndef RASTER_SPRITE_H_INCLUDED
|
||||||
#define RASTER_SPRITE_H_INCLUDED
|
#define RASTER_SPRITE_H_INCLUDED
|
||||||
|
|
||||||
#include "gui/jbase.h"
|
|
||||||
#include "raster/gfxobj.h"
|
#include "raster/gfxobj.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -44,6 +43,10 @@ struct PreferredEditorSettings
|
|||||||
int zoom;
|
int zoom;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::vector<Palette*> PalettesList;
|
||||||
|
typedef std::vector<Mask*> MasksList;
|
||||||
|
typedef std::vector<Path*> PathsList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main structure used in the whole program to handle a sprite.
|
* The main structure used in the whole program to handle a sprite.
|
||||||
*/
|
*/
|
||||||
@ -115,9 +118,8 @@ public:
|
|||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Palettes
|
// Palettes
|
||||||
|
|
||||||
const Palette* getPalette(int frame) const;
|
Palette* getPalette(int frame) const;
|
||||||
Palette* getPalette(int frame);
|
PalettesList getPalettes() const;
|
||||||
JList getPalettes();
|
|
||||||
|
|
||||||
void setPalette(Palette* pal, bool truncate);
|
void setPalette(Palette* pal, bool truncate);
|
||||||
void resetPalettes();
|
void resetPalettes();
|
||||||
@ -174,7 +176,7 @@ public:
|
|||||||
|
|
||||||
void generateMaskBoundaries(Mask* mask = NULL);
|
void generateMaskBoundaries(Mask* mask = NULL);
|
||||||
|
|
||||||
JList getMasksRepository();
|
MasksList getMasksRepository();
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Path
|
// Path
|
||||||
@ -183,7 +185,7 @@ public:
|
|||||||
void removePath(Path* path);
|
void removePath(Path* path);
|
||||||
void setPath(const Path* path);
|
void setPath(const Path* path);
|
||||||
|
|
||||||
JList getPathsRepository();
|
PathsList getPathsRepository();
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Loaded options from file
|
// Loaded options from file
|
||||||
|
@ -233,12 +233,10 @@ void Undoable::setImgType(int new_imgtype, int dithering_method)
|
|||||||
// change "sprite.palette"
|
// change "sprite.palette"
|
||||||
if (new_imgtype == IMAGE_GRAYSCALE) {
|
if (new_imgtype == IMAGE_GRAYSCALE) {
|
||||||
if (isEnabled()) {
|
if (isEnabled()) {
|
||||||
Palette* palette;
|
|
||||||
JLink link;
|
|
||||||
|
|
||||||
// Save all palettes
|
// Save all palettes
|
||||||
JI_LIST_FOR_EACH(m_sprite->getPalettes(), link) {
|
PalettesList palettes = m_sprite->getPalettes();
|
||||||
palette = reinterpret_cast<Palette*>(link->data);
|
for (PalettesList::iterator it = palettes.begin(); it != palettes.end(); ++it) {
|
||||||
|
Palette* palette = *it;
|
||||||
undo_remove_palette(m_sprite->getUndo(), m_sprite, palette);
|
undo_remove_palette(m_sprite->getUndo(), m_sprite, palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user