From 2596d44732758b36c5065047b6d5663dc4130619 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 20 May 2024 22:04:21 -0300 Subject: [PATCH] Fix incorrect diff between layers debugging the restoration of a backup (TEST_BACKUP_INTEGRITY) Only in debug mode with TEST_BACKUP_INTEGRITY flag, we now don't detect as a layer diff between the doc in memory and the restore doc from backup if only some layer flags like visibility/collapse changed. --- src/app/doc_diff.cpp | 6 +++--- src/doc/layer.h | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/doc_diff.cpp b/src/app/doc_diff.cpp index 7a09bb2cf..120dc3be5 100644 --- a/src/app/doc_diff.cpp +++ b/src/app/doc_diff.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2019-2023 Igara Studio S.A. +// Copyright (C) 2019-2024 Igara Studio S.A. // Copyright (C) 2018 David Capello // // This program is distributed under the terms of @@ -191,8 +191,8 @@ DocDiff compare_docs(const Doc* a, if (aLay->type() != bLay->type() || aLay->name() != bLay->name() || aLay->userData() != bLay->userData() || - ((int(aLay->flags()) & int(LayerFlags::PersistentFlagsMask)) != - (int(bLay->flags()) & int(LayerFlags::PersistentFlagsMask))) || + ((int(aLay->flags()) & int(LayerFlags::StructuralFlagsMask)) != + (int(bLay->flags()) & int(LayerFlags::StructuralFlagsMask))) || (aLay->isImage() && bLay->isImage() && (((const LayerImage*)aLay)->opacity() != ((const LayerImage*)bLay)->opacity())) || (aLay->isTilemap() && bLay->isTilemap() && diff --git a/src/doc/layer.h b/src/doc/layer.h index dc291673f..facbfd97b 100644 --- a/src/doc/layer.h +++ b/src/doc/layer.h @@ -1,5 +1,5 @@ // Aseprite Document Library -// Copyright (C) 2019-2021 Igara Studio S.A. +// Copyright (C) 2019-2024 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This file is released under the terms of the MIT license. @@ -42,10 +42,13 @@ namespace doc { Reference = 64, // Is a reference layer PersistentFlagsMask = 0xffff, - Internal_WasVisible = 0x10000, // Was visible in the alternative state (Alt+click) BackgroundLayerFlags = LockMove | Background, + + // Flags that change the modified flag of the document + // (e.g. created by undoable actions). + StructuralFlagsMask = Background | Reference, }; class Layer : public WithUserData {