Replace base::SharedPtr with std::shared_ptr

We can remove our smart pointer (base::SharedPtr) as we're already
using C++11 compilers on all platforms.
This commit is contained in:
David Capello 2019-08-01 19:14:46 -03:00
parent 2d3be681e0
commit d32fd97da5
41 changed files with 149 additions and 137 deletions

View File

@ -46,6 +46,7 @@
#include "keyboard_shortcuts.xml.h"
#include <map>
#include <memory>
#define KEYBOARD_FILENAME_EXTENSION "aseprite-keys"
@ -464,9 +465,9 @@ private:
AppMenuItem* m_menuitem;
int m_level;
ui::Accelerators m_newAccels;
base::SharedPtr<ui::Button> m_changeButton;
base::SharedPtr<ui::Button> m_deleteButton;
base::SharedPtr<ui::Button> m_addButton;
std::shared_ptr<ui::Button> m_changeButton;
std::shared_ptr<ui::Button> m_deleteButton;
std::shared_ptr<ui::Button> m_addButton;
obs::scoped_connection m_changeConn;
obs::scoped_connection m_deleteConn;
obs::scoped_connection m_addConn;

View File

@ -12,11 +12,11 @@
#include "app/crash/raw_images_as.h"
#include "base/disable_copying.h"
#include "base/process.h"
#include "base/shared_ptr.h"
#include "base/task.h"
#include "doc/object_id.h"
#include <fstream>
#include <memory>
#include <string>
#include <vector>
@ -87,7 +87,7 @@ namespace crash {
DISABLE_COPYING(Session);
};
typedef base::SharedPtr<Session> SessionPtr;
typedef std::shared_ptr<Session> SessionPtr;
} // namespace crash
} // namespace app

View File

@ -247,7 +247,7 @@ bool Doc::isFullyBackedUp() const
//////////////////////////////////////////////////////////////////////
// Loaded options from file
void Doc::setFormatOptions(const base::SharedPtr<FormatOptions>& format_options)
void Doc::setFormatOptions(const std::shared_ptr<FormatOptions>& format_options)
{
m_format_options = format_options;
}

View File

@ -16,7 +16,6 @@
#include "base/disable_copying.h"
#include "base/mutex.h"
#include "base/rw_lock.h"
#include "base/shared_ptr.h"
#include "doc/blend_mode.h"
#include "doc/color.h"
#include "doc/document.h"
@ -26,6 +25,7 @@
#include "obs/observable.h"
#include "os/color_space.h"
#include <memory>
#include <string>
namespace doc {
@ -129,8 +129,8 @@ namespace app {
//////////////////////////////////////////////////////////////////////
// Loaded options from file
void setFormatOptions(const base::SharedPtr<FormatOptions>& format_options);
base::SharedPtr<FormatOptions> getFormatOptions() const { return m_format_options; }
void setFormatOptions(const std::shared_ptr<FormatOptions>& format_options);
std::shared_ptr<FormatOptions> getFormatOptions() const { return m_format_options; }
//////////////////////////////////////////////////////////////////////
// Boundaries
@ -210,7 +210,7 @@ namespace app {
std::unique_ptr<doc::MaskBoundaries> m_maskBoundaries;
// Data to save the file in the same format that it was loaded
base::SharedPtr<FormatOptions> m_format_options;
std::shared_ptr<FormatOptions> m_format_options;
// Extra cel used to draw extra stuff (e.g. editor's pen preview, pixels in movement, etc.)
ExtraCelRef m_extraCel;

View File

@ -24,7 +24,6 @@
#include "base/fs.h"
#include "base/fstream_path.h"
#include "base/replace_string.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "doc/algorithm/shrink_bounds.h"
#include "doc/cel.h"
@ -48,6 +47,7 @@
#include <iomanip>
#include <iostream>
#include <list>
#include <memory>
using namespace doc;
@ -111,7 +111,7 @@ private:
gfx::Rect m_inTextureBounds;
};
typedef base::SharedPtr<SampleBounds> SampleBoundsPtr;
typedef std::shared_ptr<SampleBounds> SampleBoundsPtr;
DocExporter::Item::Item(Doc* doc,
doc::FrameTag* frameTag,

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -50,7 +51,7 @@ namespace app {
DISABLE_COPYING(ExtraCel);
};
typedef base::SharedPtr<ExtraCel> ExtraCelRef;
typedef std::shared_ptr<ExtraCel> ExtraCelRef;
} // namespace app

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -703,7 +704,7 @@ bool BmpFormat::onLoad(FileOp *fop)
// Setup the file-data.
if (!fop->formatOptions()) {
base::SharedPtr<BmpOptions> bmp_options(new BmpOptions());
auto bmp_options = std::make_shared<BmpOptions>();
bmp_options->format = format;
bmp_options->compression = infoheader.biCompression;

View File

@ -32,7 +32,6 @@
#include "base/fs.h"
#include "base/mutex.h"
#include "base/scoped_lock.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "dio/detect_format.h"
#include "doc/doc.h"
@ -546,8 +545,7 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
// Configure output format?
if (fop->m_format->support(FILE_SUPPORT_GET_FORMAT_OPTIONS)) {
base::SharedPtr<FormatOptions> opts =
fop->m_format->getFormatOptions(fop.get());
auto opts = fop->m_format->getFormatOptions(fop.get());
// Does the user cancelled the operation?
if (!opts)
@ -904,7 +902,7 @@ void FileOp::postLoad()
sprite->pixelFormat() == IMAGE_RGB &&
sprite->getPalettes().size() <= 1 &&
sprite->palette(frame_t(0))->isBlack()) {
base::SharedPtr<Palette> palette(
std::shared_ptr<Palette> palette(
render::create_palette_from_sprite(
sprite, frame_t(0), sprite->lastFrame(), true,
nullptr, nullptr, m_config.newBlend));
@ -1004,12 +1002,12 @@ void FileOp::postLoad()
m_document->markAsSaved();
}
base::SharedPtr<FormatOptions> FileOp::formatOptions() const
std::shared_ptr<FormatOptions> FileOp::formatOptions() const
{
return m_formatOptions;
}
void FileOp::setFormatOptions(const base::SharedPtr<FormatOptions>& opts)
void FileOp::setFormatOptions(const std::shared_ptr<FormatOptions>& opts)
{
ASSERT(!m_formatOptions);
m_formatOptions = opts;

View File

@ -14,13 +14,13 @@
#include "app/pref/preferences.h"
#include "base/mutex.h"
#include "base/paths.h"
#include "base/shared_ptr.h"
#include "doc/frame.h"
#include "doc/image_ref.h"
#include "doc/pixel_format.h"
#include "doc/selected_frames.h"
#include <cstdio>
#include <memory>
#include <string>
// Flags for FileOp::createLoadDocumentOperation()
@ -143,8 +143,8 @@ namespace app {
void postLoad();
// Special options specific to the file format.
base::SharedPtr<FormatOptions> formatOptions() const;
void setFormatOptions(const base::SharedPtr<FormatOptions>& opts);
std::shared_ptr<FormatOptions> formatOptions() const;
void setFormatOptions(const std::shared_ptr<FormatOptions>& opts);
// Helpers for file decoder/encoder (FileFormat) with
// FILE_SUPPORT_SEQUENCES flag.
@ -214,7 +214,7 @@ namespace app {
FileOpConfig m_config;
base::SharedPtr<FormatOptions> m_formatOptions;
std::shared_ptr<FormatOptions> m_formatOptions;
// Data for sequences.
struct {

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -9,7 +10,6 @@
#pragma once
#include "base/paths.h"
#include "base/shared_ptr.h"
#include "dio/file_format.h"
#include <vector>
@ -65,7 +65,7 @@ namespace app {
// Returns extra options for this format. It can return != NULL
// only if flags() returns FILE_SUPPORT_GET_FORMAT_OPTIONS.
base::SharedPtr<FormatOptions> getFormatOptions(FileOp* fop) {
std::shared_ptr<FormatOptions> getFormatOptions(FileOp* fop) {
return onGetFormatOptions(fop);
}
@ -87,8 +87,8 @@ namespace app {
#endif
virtual void onDestroyData(FileOp* fop) { }
virtual base::SharedPtr<FormatOptions> onGetFormatOptions(FileOp* fop) {
return base::SharedPtr<FormatOptions>(0);
virtual std::shared_ptr<FormatOptions> onGetFormatOptions(FileOp* fop) {
return std::shared_ptr<FormatOptions>(nullptr);
}
};

View File

@ -96,7 +96,7 @@ class GifFormat : public FileFormat {
#ifdef ENABLE_SAVE
bool onSave(FileOp* fop) override;
#endif
base::SharedPtr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
std::shared_ptr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
};
FileFormat* CreateGifFormat()
@ -926,7 +926,7 @@ public:
else
m_clearColor = rgba(0, 0, 0, 0);
const base::SharedPtr<GifOptions> gifOptions = fop->formatOptions();
const auto gifOptions = std::static_pointer_cast<GifOptions>(fop->formatOptions());
LOG("GIF: Saving with options: interlaced=%d loop=%d\n",
gifOptions->interlaced(), gifOptions->loop());
@ -1412,14 +1412,14 @@ bool GifFormat::onSave(FileOp* fop)
#endif // ENABLE_SAVE
base::SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
std::shared_ptr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
{
base::SharedPtr<GifOptions> gif_options;
std::shared_ptr<GifOptions> gif_options;
if (fop->document()->getFormatOptions())
gif_options = base::SharedPtr<GifOptions>(fop->document()->getFormatOptions());
gif_options = std::static_pointer_cast<GifOptions>(fop->document()->getFormatOptions());
if (!gif_options)
gif_options.reset(new GifOptions);
gif_options = std::make_shared<GifOptions>();
#ifdef ENABLE_UI
if (fop->context() && fop->context()->isUIAvailable()) {
@ -1447,13 +1447,13 @@ base::SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
gif_options->setLoop(pref.gif.loop());
}
else {
gif_options.reset(nullptr);
gif_options.reset();
}
}
}
catch (std::exception& e) {
Console::showException(e);
return base::SharedPtr<GifOptions>(nullptr);
return std::shared_ptr<GifOptions>(nullptr);
}
}
#endif // ENABLE_UI

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -75,7 +75,7 @@ class JpegFormat : public FileFormat {
const gfx::ColorSpace* colorSpace);
#endif
base::SharedPtr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
std::shared_ptr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
};
FileFormat* CreateJpegFormat()
@ -355,8 +355,9 @@ bool JpegFormat::onSave(FileOp* fop)
const Image* image = fop->sequenceImage();
JSAMPARRAY buffer;
JDIMENSION buffer_height;
const base::SharedPtr<JpegOptions> jpeg_options = fop->formatOptions();
const auto jpeg_options = std::static_pointer_cast<JpegOptions>(fop->formatOptions());
const int qualityValue = (int)MID(0, 100.0f * jpeg_options->quality, 100);
int c;
LOG("JPEG: Saving with options: quality=%d\n", qualityValue);
@ -520,14 +521,14 @@ void JpegFormat::saveColorSpace(FileOp* fop, jpeg_compress_struct* cinfo,
#endif // ENABLE_SAVE
// Shows the JPEG configuration dialog.
base::SharedPtr<FormatOptions> JpegFormat::onGetFormatOptions(FileOp* fop)
std::shared_ptr<FormatOptions> JpegFormat::onGetFormatOptions(FileOp* fop)
{
base::SharedPtr<JpegOptions> jpeg_options;
std::shared_ptr<JpegOptions> jpeg_options;
if (fop->document()->getFormatOptions())
jpeg_options = base::SharedPtr<JpegOptions>(fop->document()->getFormatOptions());
jpeg_options = std::static_pointer_cast<JpegOptions>(fop->document()->getFormatOptions());
if (!jpeg_options)
jpeg_options.reset(new JpegOptions);
jpeg_options = std::make_shared<JpegOptions>();
#ifdef ENABLE_UI
if (fop->context() && fop->context()->isUIAvailable()) {
@ -549,13 +550,13 @@ base::SharedPtr<FormatOptions> JpegFormat::onGetFormatOptions(FileOp* fop)
jpeg_options->quality = pref.jpeg.quality();
}
else {
jpeg_options.reset(nullptr);
jpeg_options.reset();
}
}
}
catch (std::exception& e) {
Console::showException(e);
return base::SharedPtr<JpegOptions>(0);
return std::shared_ptr<JpegOptions>(0);
}
}
#endif // ENABLE_UI

View File

@ -34,7 +34,7 @@ class SvgFormat : public FileFormat {
SvgOptions() : pixelScale(1) { }
int pixelScale;
};
const char* onGetName() const override {
return "svg";
}
@ -64,7 +64,7 @@ class SvgFormat : public FileFormat {
#ifdef ENABLE_SAVE
bool onSave(FileOp* fop) override;
#endif
base::SharedPtr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
std::shared_ptr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
};
FileFormat* CreateSvgFormat()
@ -80,7 +80,7 @@ bool SvgFormat::onSave(FileOp* fop)
{
const Image* image = fop->sequenceImage();
int x, y, c, r, g, b, a, alpha;
const base::SharedPtr<SvgOptions> svg_options = fop->formatOptions();
const auto svg_options = std::static_pointer_cast<SvgOptions>(fop->formatOptions());
const int pixelScaleValue = MID(0, svg_options->pixelScale, 10000);
FileHandle handle(open_file_with_exception_sync_on_close(fop->filename(), "wb"));
FILE* f = handle.get();
@ -164,42 +164,42 @@ bool SvgFormat::onSave(FileOp* fop)
#endif
// Shows the SVG configuration dialog.
base::SharedPtr<FormatOptions> SvgFormat::onGetFormatOptions(FileOp* fop)
std::shared_ptr<FormatOptions> SvgFormat::onGetFormatOptions(FileOp* fop)
{
base::SharedPtr<SvgOptions> svg_options;
std::shared_ptr<SvgOptions> svg_options;
if (fop->document()->getFormatOptions())
svg_options = base::SharedPtr<SvgOptions>(fop->document()->getFormatOptions());
svg_options = std::static_pointer_cast<SvgOptions>(fop->document()->getFormatOptions());
if (!svg_options)
svg_options.reset(new SvgOptions);
svg_options = std::make_shared<SvgOptions>();
#ifdef ENABLE_UI
if (fop->context() && fop->context()->isUIAvailable()) {
try {
auto& pref = Preferences::instance();
if (pref.isSet(pref.svg.pixelScale))
svg_options->pixelScale = pref.svg.pixelScale();
if (pref.svg.showAlert()) {
app::gen::SvgOptions win;
win.pxsc()->setTextf("%d", svg_options->pixelScale);
win.openWindowInForeground();
if (win.closer() == win.ok()) {
pref.svg.pixelScale((int)win.pxsc()->textInt());
pref.svg.showAlert(!win.dontShow()->isSelected());
svg_options->pixelScale = pref.svg.pixelScale();
}
else {
svg_options.reset(nullptr);
svg_options.reset();
}
}
}
catch (std::exception& e) {
Console::showException(e);
return base::SharedPtr<SvgOptions>(nullptr);
return std::shared_ptr<SvgOptions>(nullptr);
}
}
#endif

View File

@ -1,7 +1,7 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2015-2018 David Capello
// Copyright (C) 2015 Gabriel Rauter
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2015-2018 David Capello
// Copyright (C) 2015 Gabriel Rauter
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -69,7 +69,7 @@ class WebPFormat : public FileFormat {
#ifdef ENABLE_SAVE
bool onSave(FileOp* fop) override;
#endif
base::SharedPtr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
std::shared_ptr<FormatOptions> onGetFormatOptions(FileOp* fop) override;
};
FileFormat* CreateWebPFormat()
@ -139,7 +139,7 @@ bool WebPFormat::onLoad(FileOp* fop)
WebPInitDecoderConfig(&config);
if (WebPGetFeatures(webp_data.bytes, webp_data.size, &config.input)) {
if (!fop->formatOptions()) {
base::SharedPtr<WebPOptions> opts(new WebPOptions());
auto opts = std::make_shared<WebPOptions>();
WebPOptions::Type type = WebPOptions::Simple;
switch (config.input.format) {
case 0: type = WebPOptions::Simple; break;
@ -268,7 +268,7 @@ bool WebPFormat::onSave(FileOp* fop)
return false;
}
base::SharedPtr<WebPOptions> opts = fop->formatOptions();
auto opts = std::static_pointer_cast<WebPOptions>(fop->formatOptions());
WebPConfig config;
WebPConfigInit(&config);
@ -367,14 +367,14 @@ bool WebPFormat::onSave(FileOp* fop)
#endif // ENABLE_SAVE
// Shows the WebP configuration dialog.
base::SharedPtr<FormatOptions> WebPFormat::onGetFormatOptions(FileOp* fop)
std::shared_ptr<FormatOptions> WebPFormat::onGetFormatOptions(FileOp* fop)
{
base::SharedPtr<WebPOptions> opts;
std::shared_ptr<WebPOptions> opts;
if (fop->document()->getFormatOptions())
opts = base::SharedPtr<WebPOptions>(fop->document()->getFormatOptions());
opts = std::static_pointer_cast<WebPOptions>(fop->document()->getFormatOptions());
if (!opts)
opts.reset(new WebPOptions);
opts = std::make_shared<WebPOptions>();
#ifdef ENABLE_UI
if (fop->context() && fop->context()->isUIAvailable()) {
@ -452,13 +452,13 @@ base::SharedPtr<FormatOptions> WebPFormat::onGetFormatOptions(FileOp* fop)
}
}
else {
opts.reset(nullptr);
opts.reset();
}
}
}
catch (const std::exception& e) {
Console::showException(e);
return base::SharedPtr<WebPOptions>(nullptr);
return std::shared_ptr<WebPOptions>(nullptr);
}
}
#endif // ENABLE_UI

View File

@ -39,7 +39,6 @@
#include "base/clamp.h"
#include "base/fs.h"
#include "base/memory.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "doc/sprite.h"
#include "os/display.h"
@ -337,7 +336,7 @@ void save_window_pos(Widget* window, const char *section)
// TODO Replace this with new theme styles
Widget* setup_mini_font(Widget* widget)
{
SkinPropertyPtr skinProp = get_skin_property(widget);
auto skinProp = get_skin_property(widget);
skinProp->setMiniFont();
return widget;
}
@ -345,7 +344,7 @@ Widget* setup_mini_font(Widget* widget)
// TODO Replace this with new theme styles
Widget* setup_mini_look(Widget* widget)
{
SkinPropertyPtr skinProp = get_skin_property(widget);
auto skinProp = get_skin_property(widget);
skinProp->setLook(MiniLook);
return widget;
}

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -35,7 +36,7 @@ public:
class BrushPointShape : public PointShape {
Brush* m_brush;
base::SharedPtr<CompressedImage> m_compressedImage;
std::shared_ptr<CompressedImage> m_compressedImage;
bool m_firstPoint;
public:

View File

@ -10,7 +10,6 @@
#pragma once
#include "app/ui/button_set.h"
#include "base/shared_ptr.h"
#include "doc/brushes.h"
#include "ui/box.h"
#include "ui/popup_window.h"

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2018 Igara Studio S.A.
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -370,7 +370,7 @@ void ColorSliders::addSlider(const Channel channel,
item.relSlider->setSizeHint(gfx::Size(128, 0));
item.absSlider->setSizeHint(gfx::Size(128, 0));
item.absSlider->setProperty(SkinSliderPropertyPtr(new SkinSliderProperty(new ColorSliderBgPainter(channel))));
item.absSlider->setProperty(std::make_shared<SkinSliderProperty>(new ColorSliderBgPainter(channel)));
item.absSlider->setDoubleBuffered(true);
get_skin_property(item.entry)->setLook(MiniLook);
@ -498,7 +498,8 @@ void ColorSliders::updateSlidersBgColor()
void ColorSliders::updateSliderBgColor(Slider* slider, const app::Color& color)
{
SkinSliderPropertyPtr sliderProperty(slider->getProperty(SkinSliderProperty::Name));
auto sliderProperty = std::static_pointer_cast<SkinSliderProperty>(
slider->getProperty(SkinSliderProperty::Name));
static_cast<ColorSliderBgPainter*>(sliderProperty->getBgPainter())->setColor(color);

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2016 David Capello
//
// This program is distributed under the terms of
@ -9,7 +10,6 @@
#pragma once
#include "app/extra_cel.h"
#include "base/shared_ptr.h"
#include "doc/brush.h"
#include "doc/color.h"
#include "doc/frame.h"
@ -93,7 +93,7 @@ namespace app {
gfx::Point m_editorPosition; // Position in the editor (model)
// Information about current brush
base::SharedPtr<doc::MaskBoundaries> m_brushBoundaries;
std::shared_ptr<doc::MaskBoundaries> m_brushBoundaries;
int m_brushGen;
int m_brushWidth;
int m_brushHeight;

View File

@ -10,7 +10,6 @@
#pragma once
#include "base/disable_copying.h"
#include "base/shared_ptr.h"
#include "gfx/point.h"
namespace gfx {
@ -132,7 +131,7 @@ namespace app {
DISABLE_COPYING(EditorState);
};
typedef base::SharedPtr<EditorState> EditorStatePtr;
typedef std::shared_ptr<EditorState> EditorStatePtr;
} // namespace app

View File

@ -713,7 +713,7 @@ void MovingPixelsState::removeAsEditorObserver()
void MovingPixelsState::removePixelsMovement()
{
m_pixelsMovement.reset(nullptr);
m_pixelsMovement.reset();
m_ctxConn.disconnect();
m_opaqueConn.disconnect();
m_transparentConn.disconnect();

View File

@ -14,11 +14,12 @@
#include "app/site.h"
#include "app/tx.h"
#include "app/ui/editor/handle_type.h"
#include "base/shared_ptr.h"
#include "doc/algorithm/flip_type.h"
#include "gfx/size.h"
#include "obs/connection.h"
#include <memory>
namespace doc {
class Image;
class Mask;
@ -152,7 +153,7 @@ namespace app {
return a;
}
typedef base::SharedPtr<PixelsMovement> PixelsMovementPtr;
typedef std::shared_ptr<PixelsMovement> PixelsMovementPtr;
} // namespace app

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -8,10 +9,10 @@
#define APP_UI_SKIN_SKIN_PART_H_INCLUDED
#pragma once
#include "base/shared_ptr.h"
#include "gfx/rect.h"
#include "gfx/size.h"
#include <memory>
#include <vector>
namespace os {
@ -59,7 +60,7 @@ namespace app {
gfx::Rect m_slicesBounds;
};
typedef base::SharedPtr<SkinPart> SkinPartPtr;
typedef std::shared_ptr<SkinPart> SkinPartPtr;
} // namespace skin
} // namespace app

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -30,14 +31,12 @@ SkinProperty::~SkinProperty()
SkinPropertyPtr get_skin_property(ui::Widget* widget)
{
SkinPropertyPtr skinProp;
skinProp = widget->getProperty(SkinProperty::Name);
auto skinProp =
std::static_pointer_cast<SkinProperty>(widget->getProperty(SkinProperty::Name));
if (!skinProp) {
skinProp.reset(new SkinProperty);
skinProp = std::make_shared<SkinProperty>();
widget->setProperty(skinProp);
}
return skinProp;
}

View File

@ -1,5 +1,6 @@
// Aseprite
// Copyright (C) 2001-2015, 2017 David Capello
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -8,9 +9,10 @@
#define APP_UI_SKIN_SKIN_PROPERTY_H_INCLUDED
#pragma once
#include "base/shared_ptr.h"
#include "ui/property.h"
#include <memory>
namespace ui {
class Widget;
}
@ -43,7 +45,7 @@ namespace app {
bool m_miniFont;
};
typedef base::SharedPtr<SkinProperty> SkinPropertyPtr;
typedef std::shared_ptr<SkinProperty> SkinPropertyPtr;
SkinPropertyPtr get_skin_property(ui::Widget* widget);

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
@ -9,9 +10,10 @@
#pragma once
#include "app/ui/skin/skin_property.h"
#include "base/shared_ptr.h"
#include "gfx/rect.h"
#include <memory>
namespace ui {
class Slider;
class Graphics;
@ -41,8 +43,6 @@ namespace app {
ISliderBgPainter* m_painter;
};
typedef base::SharedPtr<SkinSliderProperty> SkinSliderPropertyPtr;
} // namespace skin
} // namespace app

View File

@ -28,7 +28,6 @@
#include "base/bind.h"
#include "base/fs.h"
#include "base/log.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "gfx/border.h"
#include "gfx/point.h"
@ -726,7 +725,7 @@ os::Surface* SkinTheme::sliceSheet(os::Surface* sur, const gfx::Rect& bounds)
os::Font* SkinTheme::getWidgetFont(const Widget* widget) const
{
SkinPropertyPtr skinPropery = widget->getProperty(SkinProperty::Name);
auto skinPropery = std::static_pointer_cast<SkinProperty>(widget->getProperty(SkinProperty::Name));
if (skinPropery && skinPropery->hasMiniFont())
return getMiniFont();
else
@ -951,7 +950,7 @@ void SkinTheme::paintEntry(PaintEvent& ev)
g->fillRect(BGCOLOR, bounds);
bool isMiniLook = false;
SkinPropertyPtr skinPropery = widget->getProperty(SkinProperty::Name);
auto skinPropery = std::static_pointer_cast<SkinProperty>(widget->getProperty(SkinProperty::Name));
if (skinPropery)
isMiniLook = (skinPropery->getLook() == MiniLook);
@ -1260,11 +1259,11 @@ void SkinTheme::paintSlider(PaintEvent& ev)
// customized background (e.g. RGB sliders)
ISliderBgPainter* bgPainter = NULL;
SkinPropertyPtr skinPropery = widget->getProperty(SkinProperty::Name);
const auto skinPropery = std::static_pointer_cast<SkinProperty>(widget->getProperty(SkinProperty::Name));
if (skinPropery)
isMiniLook = (skinPropery->getLook() == MiniLook);
SkinSliderPropertyPtr skinSliderPropery = widget->getProperty(SkinSliderProperty::Name);
const auto skinSliderPropery = std::static_pointer_cast<SkinSliderProperty>(widget->getProperty(SkinSliderProperty::Name));
if (skinSliderPropery)
bgPainter = skinSliderPropery->getBgPainter();

View File

@ -10,11 +10,11 @@
#pragma once
#include "app/ui/animated_widget.h"
#include "base/shared_ptr.h"
#include "ui/mouse_buttons.h"
#include "ui/timer.h"
#include "ui/widget.h"
#include <memory>
#include <vector>
namespace ui {
@ -136,7 +136,7 @@ namespace app {
}
};
typedef base::SharedPtr<Tab> TabPtr;
typedef std::shared_ptr<Tab> TabPtr;
typedef std::vector<TabPtr> TabsList;
typedef TabsList::iterator TabsListIterator;

View File

@ -33,13 +33,13 @@
#include "app/util/clipboard.h"
#include "app/util/clipboard_native.h"
#include "app/util/new_image_from_mask.h"
#include "base/shared_ptr.h"
#include "clip/clip.h"
#include "doc/doc.h"
#include "render/dithering.h"
#include "render/ordered_dither.h"
#include "render/quantization.h"
#include <memory>
#include <stdexcept>
namespace app {
@ -96,10 +96,10 @@ namespace clipboard {
using namespace doc;
static base::SharedPtr<Palette> clipboard_palette;
static std::shared_ptr<Palette> clipboard_palette;
static PalettePicks clipboard_picks;
static ImageRef clipboard_image;
static base::SharedPtr<Mask> clipboard_mask;
static std::shared_ptr<Mask> clipboard_mask;
static ClipboardRange clipboard_range;
static ClipboardManager* g_instance = nullptr;

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -41,8 +42,8 @@ static doc::ImageBufferPtr dst_buffer;
static void destroy_buffers()
{
src_buffer.reset(NULL);
dst_buffer.reset(NULL);
src_buffer.reset();
dst_buffer.reset();
}
static void create_buffers()

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
@ -26,7 +27,7 @@ XmlDocumentRef open_xml(const std::string& filename)
throw Exception("Error loading file: " + filename);
// Try to load the XML file
XmlDocumentRef doc(new TiXmlDocument());
auto doc = std::make_shared<TiXmlDocument>();
doc->SetValue(filename.c_str());
if (!doc->LoadFile(file.get()))
throw XmlException(doc.get());

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
@ -9,15 +10,15 @@
#pragma once
#include "base/exception.h"
#include "base/shared_ptr.h"
#include "tinyxml.h"
#include <memory>
#include <string>
namespace app {
typedef base::SharedPtr<TiXmlDocument> XmlDocumentRef;
typedef std::shared_ptr<TiXmlDocument> XmlDocumentRef;
XmlDocumentRef open_xml(const std::string& filename);
void save_xml(XmlDocumentRef doc, const std::string& filename);

View File

@ -82,7 +82,7 @@ namespace doc {
std::unique_ptr<color_t> m_bgColor; // Background color (nullptr if it wasn't specified)
};
typedef base::SharedPtr<Brush> BrushRef;
typedef std::shared_ptr<Brush> BrushRef;
} // namespace doc

View File

@ -1,4 +1,5 @@
// Aseprite Document Library
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (c) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
@ -8,12 +9,13 @@
#define DOC_CEL_DATA_H_INCLUDED
#pragma once
#include "base/shared_ptr.h"
#include "doc/image_ref.h"
#include "doc/object.h"
#include "doc/with_user_data.h"
#include "gfx/rect.h"
#include <memory>
namespace doc {
class CelData : public WithUserData {
@ -68,7 +70,7 @@ namespace doc {
mutable gfx::RectF* m_boundsF;
};
typedef base::SharedPtr<CelData> CelDataRef;
typedef std::shared_ptr<CelData> CelDataRef;
} // namespace doc

View File

@ -1,5 +1,6 @@
// Aseprite Document Library
// Copyright (c) 2001-2016 David Capello
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -9,10 +10,10 @@
#pragma once
#include "base/ints.h"
#include "base/shared_ptr.h"
#include <vector>
#include <cstddef>
#include <memory>
#include <vector>
namespace doc {
@ -33,7 +34,7 @@ namespace doc {
std::vector<uint8_t> m_buffer;
};
typedef base::SharedPtr<ImageBuffer> ImageBufferPtr;
typedef std::shared_ptr<ImageBuffer> ImageBufferPtr;
} // namespace doc

View File

@ -1,6 +1,6 @@
// Aseprite Document Library
// Copyright (c) 2018 Igara Studio S.A.
// Copyright (c) 2001-2016 David Capello
// Copyright (C) 2018-2019 Igara Studio S.A.
// Copyright (C) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -68,7 +68,7 @@ namespace doc {
std::size_t required_size = for_rows + rowstride_bytes*spec.height();
if (!m_buffer)
m_buffer.reset(new ImageBuffer(required_size));
m_buffer = std::make_shared<ImageBuffer>(required_size);
else
m_buffer->resizeIfNecessary(required_size);

View File

@ -1,5 +1,6 @@
// Aseprite Document Library
// Copyright (c) 2001-2015 David Capello
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -8,12 +9,13 @@
#define DOC_IMAGE_REF_H_INCLUDED
#pragma once
#include "base/shared_ptr.h"
#include "doc/image.h"
#include <memory>
namespace doc {
typedef base::SharedPtr<Image> ImageRef;
typedef std::shared_ptr<Image> ImageRef;
} // namespace doc

View File

@ -1,4 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
@ -8,9 +9,9 @@
#define UI_ALERT_H_INCLUDED
#pragma once
#include "base/shared_ptr.h"
#include "ui/window.h"
#include <memory>
#include <string>
#include <vector>
@ -21,7 +22,7 @@ namespace ui {
class Slider;
class Alert;
typedef base::SharedPtr<Alert> AlertPtr;
typedef std::shared_ptr<Alert> AlertPtr;
class Alert : public Window {
public:

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2001-2013, 2015 David Capello
// Copyright (C) 2001-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -8,7 +8,6 @@
#include "config.h"
#endif
#include "base/shared_ptr.h"
#include "ui/component.h"
#include "ui/property.h"

View File

@ -10,7 +10,6 @@
#pragma once
#include "base/disable_copying.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "gfx/color.h"
#include "gfx/point.h"
@ -18,6 +17,7 @@
#include "gfx/size.h"
#include "os/paint.h"
#include <memory>
#include <string>
namespace gfx {
@ -200,7 +200,7 @@ namespace ui {
DISABLE_COPYING(CheckedDrawMode);
};
typedef base::SharedPtr<Graphics> GraphicsPtr;
typedef std::shared_ptr<Graphics> GraphicsPtr;
} // namespace ui

View File

@ -1,5 +1,6 @@
// Aseprite UI Library
// Copyright (C) 2001-2013, 2015 David Capello
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
@ -9,8 +10,8 @@
#pragma once
#include "base/disable_copying.h"
#include "base/shared_ptr.h"
#include <memory>
#include <string>
namespace ui {
@ -28,7 +29,7 @@ namespace ui {
DISABLE_COPYING(Property);
};
typedef base::SharedPtr<Property> PropertyPtr;
typedef std::shared_ptr<Property> PropertyPtr;
} // namespace ui