1 // Aseprite 2 // Copyright (C) 2001-2015 David Capello 3 // 4 // This program is distributed under the terms of 5 // the End-User License Agreement for Aseprite. 6 7 #ifndef APP_CMD_CLEAR_RECT_H_INCLUDED 8 #define APP_CMD_CLEAR_RECT_H_INCLUDED 9 #pragma once 10 11 #include "app/cmd.h" 12 #include "app/cmd/with_image.h" 13 #include "app/cmd_sequence.h" 14 #include "base/unique_ptr.h" 15 #include "doc/image_ref.h" 16 #include "gfx/fwd.h" 17 18 namespace doc { 19 class Cel; 20 } 21 22 namespace app { 23 namespace cmd { 24 using namespace doc; 25 26 class ClearRect : public Cmd { 27 public: 28 ClearRect(Cel* cel, const gfx::Rect& bounds); 29 30 protected: 31 void onExecute() override; 32 void onUndo() override; 33 void onRedo() override; onMemSize()34 size_t onMemSize() const override { 35 return sizeof(*this) + m_seq.memSize() + 36 (m_copy ? m_copy->getMemSize(): 0); 37 } 38 39 private: 40 void clear(); 41 void restore(); 42 43 CmdSequence m_seq; 44 base::UniquePtr<WithImage> m_dstImage; 45 ImageRef m_copy; 46 int m_offsetX, m_offsetY; 47 color_t m_bgcolor; 48 }; 49 50 } // namespace cmd 51 } // namespace app 52 53 #endif 54