mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-01 10:13:22 +00:00
Rename Editor::m_cursorThick -> m_cursorOnScreen
This commit is contained in:
parent
41ed14f036
commit
6c882e43d5
@ -117,7 +117,7 @@ void Editor::set_cursor_color(const app::Color& color)
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
static gfx::Rect lastBrushBounds;
|
||||
static int brush_size_thick = 0;
|
||||
static bool brush_on_screen = false;
|
||||
|
||||
static void on_palette_change_update_cursor_color()
|
||||
{
|
||||
@ -127,8 +127,8 @@ static void on_palette_change_update_cursor_color()
|
||||
static void on_brush_before_change()
|
||||
{
|
||||
if (current_editor) {
|
||||
brush_size_thick = current_editor->cursorThick();
|
||||
if (brush_size_thick)
|
||||
brush_on_screen = current_editor->cursorOnScreen();
|
||||
if (brush_on_screen)
|
||||
current_editor->hideDrawingCursor();
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ static void on_brush_after_change()
|
||||
{
|
||||
if (current_editor) {
|
||||
// Show drawing cursor
|
||||
if (current_editor->sprite() && brush_size_thick > 0)
|
||||
if (current_editor->sprite() && brush_on_screen)
|
||||
current_editor->showDrawingCursor();
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ void Editor::editor_cursor_exit()
|
||||
{
|
||||
set_config_color("Tools", "CursorColor", cursor_color);
|
||||
|
||||
if (cursor_bound.seg != NULL)
|
||||
if (cursor_bound.seg)
|
||||
base_free(cursor_bound.seg);
|
||||
}
|
||||
|
||||
@ -178,8 +178,8 @@ void Editor::editor_cursor_exit()
|
||||
// Note: x and y params are absolute positions of the mouse.
|
||||
void Editor::drawBrushPreview(const gfx::Point& pos, bool refresh)
|
||||
{
|
||||
ASSERT(m_cursorThick == 0);
|
||||
ASSERT(m_sprite != NULL);
|
||||
ASSERT(!m_cursorOnScreen);
|
||||
ASSERT(m_sprite);
|
||||
|
||||
// Get drawable region
|
||||
getDrawableRegion(clipping_region, kCutTopWindows);
|
||||
@ -286,10 +286,8 @@ void Editor::drawBrushPreview(const gfx::Point& pos, bool refresh)
|
||||
forEachBrushPixel(&g, m_cursorScreen, spritePos, ui_cursor_color, drawpixel);
|
||||
}
|
||||
|
||||
// Cursor thickness
|
||||
m_cursorThick = 1;
|
||||
|
||||
// Cursor in the editor (model)
|
||||
m_cursorOnScreen = true;
|
||||
m_cursorEditor = spritePos;
|
||||
|
||||
// Save the clipping-region to know where to clean the pixels
|
||||
@ -350,8 +348,8 @@ void Editor::moveBrushPreview(const gfx::Point& pos, bool refresh)
|
||||
*/
|
||||
void Editor::clearBrushPreview(bool refresh)
|
||||
{
|
||||
ASSERT(m_cursorThick != 0);
|
||||
ASSERT(m_sprite != NULL);
|
||||
ASSERT(m_cursorOnScreen);
|
||||
ASSERT(m_sprite);
|
||||
|
||||
getDrawableRegion(clipping_region, kCutTopWindows);
|
||||
|
||||
@ -374,7 +372,7 @@ void Editor::clearBrushPreview(bool refresh)
|
||||
}
|
||||
}
|
||||
|
||||
m_cursorThick = 0;
|
||||
m_cursorOnScreen = false;
|
||||
|
||||
clipping_region.clear();
|
||||
old_clipping_region.clear();
|
||||
|
@ -152,7 +152,7 @@ Editor::Editor(Document* document, EditorFlags flags)
|
||||
, m_layer(m_sprite->folder()->getFirstLayer())
|
||||
, m_frame(frame_t(0))
|
||||
, m_zoom(1, 1)
|
||||
, m_cursorThick(0)
|
||||
, m_cursorOnScreen(false)
|
||||
, m_cursorScreen(0, 0)
|
||||
, m_cursorEditor(0, 0)
|
||||
, m_quicktool(NULL)
|
||||
@ -325,9 +325,9 @@ void Editor::setEditorScroll(const gfx::Point& scroll, bool blit_valid_rgn)
|
||||
View* view = View::getView(this);
|
||||
Point oldScroll;
|
||||
Region region;
|
||||
int thick = m_cursorThick;
|
||||
bool onScreen = m_cursorOnScreen;
|
||||
|
||||
if (thick)
|
||||
if (onScreen)
|
||||
clearBrushPreview();
|
||||
|
||||
if (blit_valid_rgn) {
|
||||
@ -343,7 +343,7 @@ void Editor::setEditorScroll(const gfx::Point& scroll, bool blit_valid_rgn)
|
||||
scrollRegion(region, oldScroll - newScroll);
|
||||
}
|
||||
|
||||
if (thick)
|
||||
if (onScreen)
|
||||
drawBrushPreview(m_cursorScreen);
|
||||
}
|
||||
|
||||
@ -687,13 +687,13 @@ void Editor::drawMaskSafe()
|
||||
if (isVisible() &&
|
||||
m_document &&
|
||||
m_document->getBoundariesSegments()) {
|
||||
int thick = m_cursorThick;
|
||||
bool onScreen = m_cursorOnScreen;
|
||||
|
||||
Region region;
|
||||
getDrawableRegion(region, kCutTopWindows);
|
||||
region.offset(-getBounds().getOrigin());
|
||||
|
||||
if (thick)
|
||||
if (onScreen)
|
||||
clearBrushPreview();
|
||||
else
|
||||
ui::hide_mouse_cursor();
|
||||
@ -707,7 +707,7 @@ void Editor::drawMaskSafe()
|
||||
}
|
||||
|
||||
// Draw the cursor
|
||||
if (thick)
|
||||
if (onScreen)
|
||||
drawBrushPreview(m_cursorScreen);
|
||||
else
|
||||
ui::show_mouse_cursor();
|
||||
@ -1006,7 +1006,7 @@ void Editor::showDrawingCursor()
|
||||
{
|
||||
ASSERT(m_sprite != NULL);
|
||||
|
||||
if (!m_cursorThick && canDraw()) {
|
||||
if (!m_cursorOnScreen && canDraw()) {
|
||||
ui::hide_mouse_cursor();
|
||||
drawBrushPreview(ui::get_mouse_position());
|
||||
ui::show_mouse_cursor();
|
||||
@ -1015,7 +1015,7 @@ void Editor::showDrawingCursor()
|
||||
|
||||
void Editor::hideDrawingCursor()
|
||||
{
|
||||
if (m_cursorThick) {
|
||||
if (m_cursorOnScreen) {
|
||||
ui::hide_mouse_cursor();
|
||||
clearBrushPreview();
|
||||
ui::show_mouse_cursor();
|
||||
@ -1025,7 +1025,7 @@ void Editor::hideDrawingCursor()
|
||||
void Editor::moveDrawingCursor()
|
||||
{
|
||||
// Draw cursor
|
||||
if (m_cursorThick) {
|
||||
if (m_cursorOnScreen) {
|
||||
gfx::Point mousePos = ui::get_mouse_position();
|
||||
|
||||
// Redraw it only when the mouse change to other pixel (not
|
||||
@ -1353,8 +1353,8 @@ void Editor::onPaint(ui::PaintEvent& ev)
|
||||
gfx::Rect rc = getClientBounds();
|
||||
SkinTheme* theme = static_cast<SkinTheme*>(this->getTheme());
|
||||
|
||||
int old_cursor_thick = m_cursorThick;
|
||||
if (m_cursorThick)
|
||||
bool onScreen = m_cursorOnScreen;
|
||||
if (onScreen)
|
||||
clearBrushPreview();
|
||||
|
||||
// Editor without sprite
|
||||
@ -1380,7 +1380,7 @@ void Editor::onPaint(ui::PaintEvent& ev)
|
||||
}
|
||||
|
||||
// Draw the cursor again
|
||||
if (old_cursor_thick != 0) {
|
||||
if (onScreen) {
|
||||
drawBrushPreview(ui::get_mouse_position());
|
||||
}
|
||||
}
|
||||
@ -1401,7 +1401,7 @@ void Editor::onCurrentToolChange()
|
||||
|
||||
void Editor::onFgColorChange()
|
||||
{
|
||||
if (m_cursorThick) {
|
||||
if (m_cursorOnScreen) {
|
||||
hideDrawingCursor();
|
||||
showDrawingCursor();
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ namespace app {
|
||||
const render::Zoom& zoom() const { return m_zoom; }
|
||||
int offsetX() const { return m_offset_x; }
|
||||
int offsetY() const { return m_offset_y; }
|
||||
int cursorThick() { return m_cursorThick; }
|
||||
bool cursorOnScreen() const { return m_cursorOnScreen; }
|
||||
|
||||
void setZoom(render::Zoom zoom) { m_zoom = zoom; }
|
||||
void setOffsetX(int x) { m_offset_x = x; }
|
||||
@ -269,7 +269,7 @@ namespace app {
|
||||
render::Zoom m_zoom; // Zoom in the editor
|
||||
|
||||
// Drawing cursor
|
||||
int m_cursorThick;
|
||||
bool m_cursorOnScreen;
|
||||
gfx::Point m_cursorScreen; // Position in the screen (view)
|
||||
gfx::Point m_cursorEditor; // Position in the editor (model)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user