diff --git a/uppsrc/Painter/BufferPainter.h b/uppsrc/Painter/BufferPainter.h index 6001211d4..241b083b1 100644 --- a/uppsrc/Painter/BufferPainter.h +++ b/uppsrc/Painter/BufferPainter.h @@ -192,7 +192,7 @@ private: Pointf path_min, path_max; }; - enum { BATCH_SIZE = 128 }; // must be 2^n + enum { BATCH_SIZE = 256 }; // must be 2^n Buffer paths; int path_index = 0; diff --git a/uppsrc/Painter/Rasterizer.cpp b/uppsrc/Painter/Rasterizer.cpp index 20e495a8a..b09ca33dd 100644 --- a/uppsrc/Painter/Rasterizer.cpp +++ b/uppsrc/Painter/Rasterizer.cpp @@ -46,10 +46,20 @@ void Rasterizer::Create(int cx, int cy, bool subpixel) void Rasterizer::Free() { - if(cell) - for(int i = 0; i <= sz.cy; i++) - if(cell[i].alloc != SVO_ALLOC) + if(cell) { + for(int i = min_y; i <= max_y; i++) { + if(cell[i].alloc != SVO_ALLOC) { MemoryFree(cell[i].ptr); + cell[i].alloc = SVO_ALLOC; + } + cell[i].count = 0; + } + if(cell[sz.cy].alloc != SVO_ALLOC) { // check overrun + MemoryFree(cell[sz.cy].ptr); + cell[sz.cy].alloc = SVO_ALLOC; + } + cell[sz.cy].count = 0; + } } void Rasterizer::Init() @@ -61,13 +71,7 @@ void Rasterizer::Init() void Rasterizer::Reset() { - for(int i = min_y; i <= max_y; i++) { - if(cell[i].alloc != SVO_ALLOC) { - MemoryFree(cell[i].ptr); - cell[i].alloc = SVO_ALLOC; - } - cell[i].count = 0; - } + Free(); Init(); } @@ -251,7 +255,7 @@ void Rasterizer::LineRaw(int x1, int y1, int x2, int y2) int dy = y2 - y1; int fy1 = y1 & 255; int fy2 = y2 & 255; - + Cell *c; int x_from, x_to; @@ -381,4 +385,4 @@ void Rasterizer::Render(int y, Rasterizer::Filler& g, bool evenodd) g.End(); } -} +} \ No newline at end of file