# HG changeset patch # User Matti Hamalainen # Date 1535036476 -10800 # Node ID 7a9dc175ece52c81df2508f309f3e810fae8c91e # Parent 0dec83e42d90045e088ffa3257e5d32e9dc89821 Use dst = src.slice(0) instead of Processing arrayCopy(src, dst) for cloning arrays. Should be faster, but if not, this can be reverted later. diff -r 0dec83e42d90 -r 7a9dc175ece5 buffers.pde --- a/buffers.pde Thu Aug 23 17:27:50 2018 +0300 +++ b/buffers.pde Thu Aug 23 18:01:16 2018 +0300 @@ -23,9 +23,9 @@ void store_undo() { if (g_spare) - arrayCopy(g_map, g_undobs[g_uindex[g_spare]]); + g_undobs[g_uindex[g_spare]] = g_map.slice(0); else - arrayCopy(g_map, g_undob[g_uindex[g_spare]]); + g_undob[g_uindex[g_spare]] = g_map.slice(0); g_uindex[g_spare]++; if (g_uindex[g_spare] > UNDOSTEPS) @@ -50,18 +50,18 @@ return; if (g_spare) - arrayCopy(g_map, g_undobs[g_uindex[g_spare]]); + g_undobs[g_uindex[g_spare]] = g_map.slice(0); else - arrayCopy(g_map, g_undob[g_uindex[g_spare]]); + g_undob[g_uindex[g_spare]] = g_map.slice(0); g_uindex[g_spare]--; if (g_uindex[g_spare] < 0) g_uindex[g_spare] = UNDOSTEPS; if (g_spare) - arrayCopy(g_undobs[g_uindex[g_spare]], g_map); + g_map = g_undobs[g_uindex[g_spare]].slice(0); else - arrayCopy(g_undob[g_uindex[g_spare]], g_map); + g_map = g_undob[g_uindex[g_spare]].slice(0); refreshpalette(); ustats(); @@ -78,9 +78,9 @@ g_uindex[g_spare] = 0; if (g_spare) - arrayCopy(g_undobs[g_uindex[g_spare]], g_map); + g_map = g_undobs[g_uindex[g_spare]].slice(0); else - arrayCopy(g_undob[g_uindex[g_spare]], g_map); + g_map = g_undob[g_uindex[g_spare]].slice(0); refreshpalette(); ustats(); @@ -89,9 +89,9 @@ void spare() //dpaint style spare page { - arrayCopy(g_sparepage, g_swappage); - arrayCopy(g_map, g_sparepage); - arrayCopy(g_swappage, g_map); + g_swappage = g_sparepage.slice(0); + g_sparepage = g_map.slice(0); + g_map = g_swappage.slice(0); mpSetTitle(g_spare ? sfilename : filename); @@ -110,10 +110,10 @@ switch (mode) { case 0: - arrayCopy(g_map, g_rmap); + g_rmap = g_map.slice(0); break; case 1: - arrayCopy(g_rmap, g_map); + g_map = g_rmap.slice(0); for (int i = 0; i < 1024; i++) { if (g_remdo[i] == 1) @@ -124,13 +124,13 @@ } break; case 2: - arrayCopy(g_map, g_brush); + g_brush = g_map.slice(0); break; case 3: - arrayCopy(g_map, g_sparepage); + g_sparepage = g_map.slice(0); break; case 4: - arrayCopy(g_sparepage, g_mapm); + g_mapm = g_sparepage.slice(0); break; } }