xref: /aosp_15_r20/external/pdfium/third_party/agg23/0011-path-storage-move-ctor.patch (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1diff --git a/third_party/agg23/agg_path_storage.cpp b/third_party/agg23/agg_path_storage.cpp
2index 2cd0caed1..1491e9e33 100644
3--- a/third_party/agg23/agg_path_storage.cpp
4+++ b/third_party/agg23/agg_path_storage.cpp
5@@ -43,14 +43,20 @@ path_storage::~path_storage()
6         FX_Free(m_coord_blocks);
7     }
8 }
9-path_storage::path_storage() :
10-    m_total_vertices(0),
11-    m_total_blocks(0),
12-    m_max_blocks(0),
13-    m_coord_blocks(0),
14-    m_cmd_blocks(0),
15-    m_iterator(0)
16-{
17+path_storage::path_storage() = default;
18+path_storage::path_storage(path_storage&& other) {
19+    m_total_vertices = other.m_total_vertices;
20+    m_total_blocks = other.m_total_blocks;
21+    m_max_blocks = other.m_max_blocks;
22+    m_coord_blocks = other.m_coord_blocks;
23+    m_cmd_blocks = other.m_cmd_blocks;
24+    m_iterator = other.m_iterator;
25+    other.m_total_vertices = 0;
26+    other.m_total_blocks = 0;
27+    other.m_max_blocks = 0;
28+    other.m_coord_blocks = nullptr;
29+    other.m_cmd_blocks = nullptr;
30+    other.m_iterator = 0;
31 }
32 void path_storage::allocate_block(unsigned nb)
33 {
34diff --git a/third_party/agg23/agg_path_storage.h b/third_party/agg23/agg_path_storage.h
35index 55d6df001..8f10ff36d 100644
36--- a/third_party/agg23/agg_path_storage.h
37+++ b/third_party/agg23/agg_path_storage.h
38@@ -50,6 +50,10 @@ public:
39     };
40     ~path_storage();
41     path_storage();
42+    path_storage(path_storage&& other);
43+    path_storage& operator=(path_storage&&) = delete;
44+    path_storage(const path_storage&) = delete;
45+    path_storage& operator=(const path_storage&) = delete;
46     unsigned last_vertex(float* x, float* y) const;
47     unsigned prev_vertex(float* x, float* y) const;
48     void move_to(float x, float y);
49@@ -116,12 +120,12 @@ private:
50     void allocate_block(unsigned nb);
51     unsigned char* storage_ptrs(float** xy_ptr);
52 private:
53-    unsigned        m_total_vertices;
54-    unsigned        m_total_blocks;
55-    unsigned        m_max_blocks;
56-    float**   m_coord_blocks;
57-    unsigned char** m_cmd_blocks;
58-    unsigned        m_iterator;
59+    unsigned        m_total_vertices = 0;
60+    unsigned        m_total_blocks = 0;
61+    unsigned        m_max_blocks = 0;
62+    float**         m_coord_blocks = nullptr;
63+    unsigned char** m_cmd_blocks = nullptr;
64+    unsigned        m_iterator = 0;
65 };
66 inline unsigned path_storage::vertex(float* x, float* y)
67 {
68