]> git.cworth.org Git - vogl/blob - src/vogleditor/vogleditor_gl_state_snapshot.cpp
Initial vogl checkin
[vogl] / src / vogleditor / vogleditor_gl_state_snapshot.cpp
1 #include "vogleditor_gl_state_snapshot.h"
2
3 vogleditor_gl_state_snapshot::vogleditor_gl_state_snapshot(vogl_gl_state_snapshot* pSnapshot)
4     : m_pSnapshot(pSnapshot),
5       m_bEdited(false),
6       m_bOutdated(false)
7 {
8 }
9
10 vogleditor_gl_state_snapshot::~vogleditor_gl_state_snapshot()
11 {
12     if (m_pSnapshot != NULL)
13     {
14         vogl_delete(m_pSnapshot);
15         m_pSnapshot = NULL;
16     }
17 }
18
19 void vogleditor_gl_state_snapshot::set_outdated(bool bOutdated)
20 {
21     if (m_bOutdated == bOutdated)
22         return;
23
24     m_bOutdated = bOutdated;
25     if (m_bOutdated)
26     {
27         // for now, we will delete the snapshot to save memory, in the future we will
28         // want to keep it around so that we can diff between them.
29         if (m_pSnapshot != NULL)
30         {
31             vogl_delete(m_pSnapshot);
32             m_pSnapshot = NULL;
33         }
34     }
35     else
36     {
37         VOGL_ASSERT(!"We should not be setting a snapshot as no-longer outdated.");
38     }
39 }