mirror of https://github.com/aseprite/aseprite.git
Compare commits
10 Commits
dc3395ad8b
...
d3a05db5d2
Author | SHA1 | Date |
---|---|---|
|
d3a05db5d2 | |
|
107e846911 | |
|
577caa4793 | |
|
f3a372e78e | |
|
41e5097c33 | |
|
cf290b7679 | |
|
d7b2faca6d | |
|
f26ce64208 | |
|
f6b23dc4e8 | |
|
9fd1214947 |
2
laf
2
laf
|
@ -1 +1 @@
|
|||
Subproject commit de781a5066732d700ac4520ee5fc9034e92875ad
|
||||
Subproject commit 39706c11063fb53cf4c8e865102c6f71e2606906
|
|
@ -51,7 +51,7 @@ void DuplicateLayerCommand::onExecute(Context* context)
|
|||
Tx tx(writer, "Layer Duplication");
|
||||
LayerImage* sourceLayer = static_cast<LayerImage*>(writer.layer());
|
||||
DocApi api = document->getApi(tx);
|
||||
api.duplicateLayerAfter(sourceLayer, sourceLayer->parent(), sourceLayer, " Copy");
|
||||
api.duplicateLayerAfter(sourceLayer, sourceLayer->parent(), sourceLayer);
|
||||
tx.commit();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "app/commands/new_params.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/context_access.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/fs.h"
|
||||
|
@ -64,7 +65,8 @@ void DuplicateSpriteCommand::onExecute(Context* context)
|
|||
|
||||
std::string duplicateFn = params().filename.isSet() ?
|
||||
params().filename() :
|
||||
base::get_file_title(fn) + " Copy" + (!ext.empty() ? "." + ext : "");
|
||||
Strings::general_copy_of(base::get_file_title(fn)) +
|
||||
(!ext.empty() ? "." + ext : "");
|
||||
|
||||
bool flatten = params().flatten.isSet() ? params().flatten() :
|
||||
get_config_bool("DuplicateSprite", "Flatten", false);
|
||||
|
|
|
@ -325,10 +325,15 @@ void FilterManagerImpl::applyToTarget()
|
|||
void FilterManagerImpl::initTransaction()
|
||||
{
|
||||
ASSERT(!m_tx);
|
||||
m_writer.reset(new ContextWriter(m_reader));
|
||||
m_writer = std::make_unique<ContextWriter>(m_reader);
|
||||
m_tx.reset(new Tx(*m_writer, m_filter->getName(), ModifyDocument));
|
||||
}
|
||||
|
||||
void FilterManagerImpl::updateWriterThread()
|
||||
{
|
||||
document()->updateWriterThread();
|
||||
}
|
||||
|
||||
bool FilterManagerImpl::isTransaction() const
|
||||
{
|
||||
return (m_tx != nullptr);
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
void applyToTarget();
|
||||
|
||||
void initTransaction();
|
||||
void updateWriterThread();
|
||||
bool isTransaction() const;
|
||||
void commitTransaction();
|
||||
|
||||
|
|
|
@ -118,7 +118,13 @@ FilterWorker::~FilterWorker()
|
|||
|
||||
void FilterWorker::run()
|
||||
{
|
||||
// Initialize writting transaction
|
||||
// Initialize writing transaction from the main thread. This is
|
||||
// required to get the activeSite() from the UIContext from
|
||||
// CmdTransaction::calcSpritePosition().
|
||||
//
|
||||
// The document will keep the UI thread associated as the "writer"
|
||||
// thread, but that will be updated later in
|
||||
// applyFilterInBackground() with the worker thread ID.
|
||||
m_filterMgr->initTransaction();
|
||||
|
||||
std::thread thread;
|
||||
|
@ -182,6 +188,11 @@ bool FilterWorker::isCancelled()
|
|||
void FilterWorker::applyFilterInBackground()
|
||||
{
|
||||
try {
|
||||
// This background thread is the new writer. This is required to
|
||||
// avoid read-locking from the UI thread from Editor and Timeline
|
||||
// onPaint() events.
|
||||
m_filterMgr->updateWriterThread();
|
||||
|
||||
// Apply the filter
|
||||
m_filterMgr->applyToTarget();
|
||||
|
||||
|
|
|
@ -124,6 +124,11 @@ Doc::LockResult Doc::upgradeToWrite(int timeout)
|
|||
return res;
|
||||
}
|
||||
|
||||
void Doc::updateWriterThread()
|
||||
{
|
||||
m_rwLock.updateWriterThread();
|
||||
}
|
||||
|
||||
void Doc::downgradeToRead(LockResult lockResult)
|
||||
{
|
||||
DOC_TRACE("DOC: downgradeToRead", this, (int)lockResult);
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
LockResult readLock(int timeout);
|
||||
LockResult writeLock(int timeout);
|
||||
LockResult upgradeToWrite(int timeout);
|
||||
void updateWriterThread();
|
||||
void downgradeToRead(LockResult lockResult);
|
||||
void unlock(LockResult lockResult);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "app/context.h"
|
||||
#include "app/doc.h"
|
||||
#include "app/doc_undo.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/pref/preferences.h"
|
||||
#include "app/snap_to_grid.h"
|
||||
#include "app/transaction.h"
|
||||
|
@ -725,29 +726,23 @@ Layer* DocApi::copyLayerWithSprite(doc::Layer* layer, doc::Sprite* sprite)
|
|||
return clone.release();
|
||||
}
|
||||
|
||||
Layer* DocApi::duplicateLayerAfter(Layer* sourceLayer,
|
||||
LayerGroup* parent,
|
||||
Layer* afterLayer,
|
||||
const std::string& nameSuffix)
|
||||
Layer* DocApi::duplicateLayerAfter(Layer* sourceLayer, LayerGroup* parent, Layer* afterLayer)
|
||||
{
|
||||
ASSERT(parent);
|
||||
Layer* newLayerPtr = copyLayerWithSprite(sourceLayer, parent->sprite());
|
||||
|
||||
newLayerPtr->setName(newLayerPtr->name() + nameSuffix);
|
||||
newLayerPtr->setName(Strings::general_copy_of(newLayerPtr->name()));
|
||||
|
||||
addLayer(parent, newLayerPtr, afterLayer);
|
||||
|
||||
return newLayerPtr;
|
||||
}
|
||||
|
||||
Layer* DocApi::duplicateLayerBefore(Layer* sourceLayer,
|
||||
LayerGroup* parent,
|
||||
Layer* beforeLayer,
|
||||
const std::string& nameSuffix)
|
||||
Layer* DocApi::duplicateLayerBefore(Layer* sourceLayer, LayerGroup* parent, Layer* beforeLayer)
|
||||
{
|
||||
ASSERT(parent);
|
||||
Layer* afterThis = (beforeLayer ? beforeLayer->getPreviousBrowsable() : nullptr);
|
||||
Layer* newLayer = duplicateLayerAfter(sourceLayer, parent, afterThis, nameSuffix);
|
||||
Layer* newLayer = duplicateLayerAfter(sourceLayer, parent, afterThis);
|
||||
if (newLayer)
|
||||
restackLayerBefore(newLayer, parent, beforeLayer);
|
||||
return newLayer;
|
||||
|
|
|
@ -119,14 +119,8 @@ public:
|
|||
void removeLayer(Layer* layer);
|
||||
void restackLayerAfter(Layer* layer, LayerGroup* parent, Layer* afterThis);
|
||||
void restackLayerBefore(Layer* layer, LayerGroup* parent, Layer* beforeThis);
|
||||
Layer* duplicateLayerAfter(Layer* sourceLayer,
|
||||
LayerGroup* parent,
|
||||
Layer* afterLayer,
|
||||
const std::string& nameSuffix = std::string());
|
||||
Layer* duplicateLayerBefore(Layer* sourceLayer,
|
||||
LayerGroup* parent,
|
||||
Layer* beforeLayer,
|
||||
const std::string& nameSuffix = std::string());
|
||||
Layer* duplicateLayerAfter(Layer* sourceLayer, LayerGroup* parent, Layer* afterLayer);
|
||||
Layer* duplicateLayerBefore(Layer* sourceLayer, LayerGroup* parent, Layer* beforeLayer);
|
||||
|
||||
// Images API
|
||||
void replaceImage(Sprite* sprite, const ImageRef& oldImage, const ImageRef& newImage);
|
||||
|
|
|
@ -405,8 +405,7 @@ static DocRange drop_range_op(Doc* doc,
|
|||
if (place == kDocRangeBefore) {
|
||||
Layer* beforeThis = (!dstLayers.empty() ? dstLayers.front() : nullptr);
|
||||
for (Layer* srcLayer : srcLayers) {
|
||||
Layer* copiedLayer =
|
||||
api.duplicateLayerBefore(srcLayer, parent, beforeThis, " Copy");
|
||||
Layer* copiedLayer = api.duplicateLayerBefore(srcLayer, parent, beforeThis);
|
||||
|
||||
resultRange.startRange(copiedLayer, -1, DocRange::kLayers);
|
||||
resultRange.endRange(copiedLayer, -1);
|
||||
|
@ -417,7 +416,7 @@ static DocRange drop_range_op(Doc* doc,
|
|||
|
||||
Layer* afterThis = (!dstLayers.empty() ? dstLayers.back() : nullptr);
|
||||
for (Layer* srcLayer : srcLayers) {
|
||||
Layer* copiedLayer = api.duplicateLayerAfter(srcLayer, parent, afterThis, " Copy");
|
||||
Layer* copiedLayer = api.duplicateLayerAfter(srcLayer, parent, afterThis);
|
||||
|
||||
resultRange.startRange(copiedLayer, -1, DocRange::kLayers);
|
||||
resultRange.endRange(copiedLayer, -1);
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
// Increment this value if the scripting API is modified between two
|
||||
// released Aseprite versions.
|
||||
#define API_VERSION 35
|
||||
#define API_VERSION 36
|
||||
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace app { namespace script {
|
|||
template<>
|
||||
void push_value_to_lua(lua_State* L, const std::nullptr_t&)
|
||||
{
|
||||
TRACEARGS("push_value_to_lua nullptr_t");
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
|
|
|
@ -2763,7 +2763,7 @@ void Editor::pasteImage(const Image* image, const Mask* mask, const gfx::Point*
|
|||
ASSERT(image);
|
||||
|
||||
std::unique_ptr<Mask> temp_mask;
|
||||
if (!mask) {
|
||||
if (!mask || mask->bounds().isEmpty()) {
|
||||
gfx::Rect visibleBounds = getVisibleSpriteBounds();
|
||||
gfx::Rect imageBounds = image->bounds();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2019-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2019-2025 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
@ -50,10 +50,8 @@ TaskWidget::TaskWidget(const Type type, base::task::func_t&& func)
|
|||
}
|
||||
else if (m_progressBar.parent()) {
|
||||
float v = m_task.progress();
|
||||
if (v > 0.0f) {
|
||||
TRACEARGS("progressBar setValue", int(std::clamp(v * 100.0f, 0.0f, 100.0f)));
|
||||
if (v > 0.0f)
|
||||
m_progressBar.setValue(int(std::clamp(v * 100.0f, 0.0f, 100.0f)));
|
||||
}
|
||||
}
|
||||
});
|
||||
m_monitorTimer.start();
|
||||
|
|
|
@ -4631,13 +4631,13 @@ void Timeline::onDrop(ui::DragEvent& e)
|
|||
std::string txmsg;
|
||||
std::unique_ptr<docapi::DocProvider> docProvider = nullptr;
|
||||
if (droppedImage) {
|
||||
txmsg = "Dropped image on timeline";
|
||||
txmsg = "Drop Image";
|
||||
doc::ImageRef image = nullptr;
|
||||
convert_surface_to_image(surface.get(), 0, 0, surface->width(), surface->height(), image);
|
||||
docProvider = std::make_unique<DocProviderFromImage>(image);
|
||||
}
|
||||
else {
|
||||
txmsg = "Dropped paths on timeline";
|
||||
txmsg = "Drop File";
|
||||
docProvider = std::make_unique<DocProviderFromPaths>(m_document->context(), paths);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "app/ui/workspace.h"
|
||||
#include "app/ui/workspace_tabs.h"
|
||||
#include "doc/sprite.h"
|
||||
#include "ui/manager.h"
|
||||
#include "ui/system.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -120,6 +121,10 @@ void UIContext::setActiveView(DocView* docView)
|
|||
mainWin->getTimeline()->updateUsingEditor(editor);
|
||||
mainWin->getPreviewEditor()->updateUsingEditor(editor);
|
||||
|
||||
// Update mouse widgets immediately after changing views rather
|
||||
// than waiting for mouse movement.
|
||||
mainWin->manager()->_updateMouseWidgets();
|
||||
|
||||
// Change the image-type of color bar.
|
||||
ColorBar::instance()->setPixelFormat(app_get_current_pixel_format());
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (c) 2024 Igara Studio S.A.
|
||||
// Copyright (c) 2024-2025 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
@ -26,7 +26,7 @@ uint32_t convert_color_to_image(gfx::Color c, const os::SurfaceFormatData* fd)
|
|||
uint8_t b = ((c & fd->blueMask) >> fd->blueShift);
|
||||
uint8_t a = ((c & fd->alphaMask) >> fd->alphaShift);
|
||||
|
||||
if (fd->pixelAlpha == os::PixelAlpha::kPremultiplied) {
|
||||
if (a > 0 && fd->pixelAlpha == os::PixelAlpha::kPremultiplied) {
|
||||
r = r * 255 / a;
|
||||
g = g * 255 / a;
|
||||
b = b * 255 / a;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Aseprite Steam Wrapper
|
||||
// Copyright (c) 2020-2024 Igara Studio S.A.
|
||||
// Copyright (c) 2020-2025 Igara Studio S.A.
|
||||
// Copyright (c) 2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
|
@ -153,8 +153,6 @@ public:
|
|||
|
||||
CallbackMsg_t msg;
|
||||
if (SteamAPI_ManualDispatch_GetNextCallback(m_pipe, &msg)) {
|
||||
// TRACEARGS("SteamAPI_ManualDispatch_GetNextCallback", msg.callback);
|
||||
|
||||
bool disconnected = false;
|
||||
switch (msg.callback) {
|
||||
case kSteamServersDisconnected:
|
||||
|
|
Loading…
Reference in New Issue