mirror of https://github.com/aseprite/aseprite.git
Merge branch 'beta' into tilemap-editor
This commit is contained in:
commit
0bae04f40b
2
laf
2
laf
|
|
@ -1 +1 @@
|
|||
Subproject commit 2ecf7a9827f6d187d4e1b9a25b354d6a6b636096
|
||||
Subproject commit c8e6b958fdcca7809ab2b50f9cfed7d9387a2c86
|
||||
|
|
@ -55,10 +55,10 @@
|
|||
#include "app/util/layer_utils.h"
|
||||
#include "base/chrono.h"
|
||||
#include "base/clamp.h"
|
||||
#include "base/convert_to.h"
|
||||
#include "doc/doc.h"
|
||||
#include "doc/mask_boundaries.h"
|
||||
#include "doc/slice.h"
|
||||
#include "fmt/format.h"
|
||||
#include "os/color_space.h"
|
||||
#include "os/display.h"
|
||||
#include "os/surface.h"
|
||||
|
|
@ -94,6 +94,10 @@ public:
|
|||
return m_editor;
|
||||
}
|
||||
|
||||
Graphics* getGraphics() override {
|
||||
return m_g;
|
||||
}
|
||||
|
||||
void drawLine(gfx::Color color, int x1, int y1, int x2, int y2) override {
|
||||
gfx::Point a(x1, y1);
|
||||
gfx::Point b(x2, y2);
|
||||
|
|
@ -1232,7 +1236,7 @@ void Editor::drawCelHGuide(ui::Graphics* g,
|
|||
const int dottedX)
|
||||
{
|
||||
gfx::Color color = color_utils::color_for_ui(Preferences::instance().guides.autoGuidesColor());
|
||||
g->drawHLine(color, scrX1, scrY, scrX2 - scrX1);
|
||||
g->drawHLine(color, std::min(scrX1, scrX2), scrY, std::abs(scrX2 - scrX1));
|
||||
|
||||
// Vertical guide to touch the horizontal line
|
||||
{
|
||||
|
|
@ -1244,7 +1248,7 @@ void Editor::drawCelHGuide(ui::Graphics* g,
|
|||
g->drawVLine(color, dottedX, scrCmpBounds.y2(), scrCelBounds.y2() - scrCmpBounds.y2());
|
||||
}
|
||||
|
||||
auto text = base::convert_to<std::string>(ABS(sprX2 - sprX1)) + "px";
|
||||
auto text = fmt::format("{}px", ABS(sprX2 - sprX1));
|
||||
const int textW = Graphics::measureUITextLength(text, font());
|
||||
g->drawText(text,
|
||||
color_utils::blackandwhite_neg(color), color,
|
||||
|
|
@ -1258,7 +1262,7 @@ void Editor::drawCelVGuide(ui::Graphics* g,
|
|||
const int dottedY)
|
||||
{
|
||||
gfx::Color color = color_utils::color_for_ui(Preferences::instance().guides.autoGuidesColor());
|
||||
g->drawVLine(color, scrX, scrY1, scrY2 - scrY1);
|
||||
g->drawVLine(color, scrX, std::min(scrY1, scrY2), std::abs(scrY2 - scrY1));
|
||||
|
||||
// Horizontal guide to touch the vertical line
|
||||
{
|
||||
|
|
@ -1270,7 +1274,7 @@ void Editor::drawCelVGuide(ui::Graphics* g,
|
|||
g->drawHLine(color, scrCmpBounds.x2(), dottedY, scrCelBounds.x2() - scrCmpBounds.x2());
|
||||
}
|
||||
|
||||
auto text = base::convert_to<std::string>(ABS(sprY2 - sprY1)) + "px";
|
||||
auto text = fmt::format("{}px", ABS(sprY2 - sprY1));
|
||||
g->drawText(text,
|
||||
color_utils::blackandwhite_neg(color), color,
|
||||
gfx::Point(scrX, (scrY1+scrY2)/2-textHeight()/2));
|
||||
|
|
@ -2610,7 +2614,7 @@ void Editor::showAnimationSpeedMultiplierPopup(Option<bool>& playOnce,
|
|||
Menu menu;
|
||||
|
||||
for (double option : options) {
|
||||
MenuItem* item = new MenuItem("Speed x" + base::convert_to<std::string>(option));
|
||||
MenuItem* item = new MenuItem(fmt::format("Speed x{}", option));
|
||||
item->Click.connect([this, option]{ setAnimationSpeedMultiplier(option); });
|
||||
item->setSelected(m_aniSpeed == option);
|
||||
menu.addChild(item);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
|
@ -36,6 +37,7 @@ namespace app {
|
|||
public:
|
||||
virtual ~EditorPostRender() { }
|
||||
virtual Editor* getEditor() = 0;
|
||||
virtual ui::Graphics* getGraphics() = 0;
|
||||
virtual void drawLine(gfx::Color color, int x1, int y1, int x2, int y2) = 0;
|
||||
virtual void drawRectXor(const gfx::Rect& rc) = 0;
|
||||
virtual void fillRect(gfx::Color color, const gfx::Rect& rc) = 0;
|
||||
|
|
|
|||
|
|
@ -1002,8 +1002,9 @@ void StandbyState::Decorator::postRenderDecorator(EditorPostRender* render)
|
|||
tools::Ink* ink = editor->getCurrentEditorInk();
|
||||
|
||||
if (ink->isSelection()) {
|
||||
getTransformHandles(editor)->drawHandles(editor,
|
||||
m_standbyState->getTransformation(editor));
|
||||
getTransformHandles(editor)
|
||||
->drawHandles(editor, render->getGraphics(),
|
||||
m_standbyState->getTransformation(editor));
|
||||
|
||||
m_standbyState->m_transformSelectionHandlesAreVisible = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
|
@ -84,9 +85,9 @@ HandleType TransformHandles::getHandleAtPoint(Editor* editor, const gfx::Point&
|
|||
return NoHandle;
|
||||
}
|
||||
|
||||
void TransformHandles::drawHandles(Editor* editor, const Transformation& transform)
|
||||
void TransformHandles::drawHandles(Editor* editor, ui::Graphics* g,
|
||||
const Transformation& transform)
|
||||
{
|
||||
ScreenGraphics g;
|
||||
fixmath::fixed angle = fixmath::ftofix(128.0 * transform.angle() / PI);
|
||||
|
||||
Transformation::Corners corners;
|
||||
|
|
@ -95,29 +96,31 @@ void TransformHandles::drawHandles(Editor* editor, const Transformation& transfo
|
|||
std::vector<gfx::Point> screenPoints;
|
||||
getScreenPoints(editor, corners, screenPoints);
|
||||
|
||||
// TODO DO NOT COMMIT
|
||||
const gfx::Point origin = editor->bounds().origin();
|
||||
|
||||
#if 0 // Uncomment this if you want to see the bounds in red (only for debugging purposes)
|
||||
// -----------------------------------------------
|
||||
{
|
||||
gfx::Point
|
||||
a(transform.bounds().origin()),
|
||||
b(transform.bounds().point2());
|
||||
a = editor->editorToScreen(a);
|
||||
b = editor->editorToScreen(b);
|
||||
g.drawRect(gfx::rgba(255, 0, 0), gfx::Rect(a, b));
|
||||
a = editor->editorToScreen(a) - origin;
|
||||
b = editor->editorToScreen(b) - origin;
|
||||
g->drawRect(gfx::rgba(255, 0, 0), gfx::Rect(a, b));
|
||||
|
||||
a = transform.pivot();
|
||||
a = editor->editorToScreen(a);
|
||||
g.drawRect(gfx::rgba(255, 0, 0), gfx::Rect(a.x-2, a.y-2, 5, 5));
|
||||
a = editor->editorToScreen(a) - origin;
|
||||
g->drawRect(gfx::rgba(255, 0, 0), gfx::Rect(a.x-2, a.y-2, 5, 5));
|
||||
}
|
||||
// -----------------------------------------------
|
||||
#endif
|
||||
|
||||
// Draw corner handle
|
||||
for (size_t c=0; c<HANDLES; ++c) {
|
||||
drawHandle(&g,
|
||||
(screenPoints[handles_info[c].i1].x+screenPoints[handles_info[c].i2].x)/2,
|
||||
(screenPoints[handles_info[c].i1].y+screenPoints[handles_info[c].i2].y)/2,
|
||||
drawHandle(
|
||||
g,
|
||||
(screenPoints[handles_info[c].i1].x+screenPoints[handles_info[c].i2].x)/2 - origin.x,
|
||||
(screenPoints[handles_info[c].i1].y+screenPoints[handles_info[c].i2].y)/2 - origin.y,
|
||||
angle + handles_info[c].angle);
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +130,9 @@ void TransformHandles::drawHandles(Editor* editor, const Transformation& transfo
|
|||
SkinTheme* theme = SkinTheme::instance();
|
||||
os::Surface* part = theme->parts.pivotHandle()->bitmap(0);
|
||||
|
||||
g.drawRgbaSurface(part, pivotBounds.x, pivotBounds.y);
|
||||
g->drawRgbaSurface(part,
|
||||
pivotBounds.x - origin.x,
|
||||
pivotBounds.y - origin.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// Aseprite
|
||||
// Copyright (C) 2020 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
|
|
@ -30,7 +31,8 @@ namespace app {
|
|||
// has applied the given transformation to the selection.
|
||||
HandleType getHandleAtPoint(Editor* editor, const gfx::Point& pt, const Transformation& transform);
|
||||
|
||||
void drawHandles(Editor* editor, const Transformation& transform);
|
||||
void drawHandles(Editor* editor, ui::Graphics* g,
|
||||
const Transformation& transform);
|
||||
void invalidateHandles(Editor* editor, const Transformation& transform);
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in New Issue