nr-pixblock.cpp File Reference
Allocation/Setup of NRPixBlock objects. More...
Go to the source code of this file.
Defines | |
| #define | __NR_PIXBLOCK_C__ |
| #define | NR_TINY_MAX sizeof (unsigned char *) |
| Size of buffer that needs no allocation (default 4). | |
| #define | NR_4K_BLOCK 32 |
| #define | NR_16K_BLOCK 32 |
| #define | NR_64K_BLOCK 32 |
| #define | NR_256K_BLOCK 32 |
| #define | NR_256K 262144 |
| #define | NR_1M_BLOCK 32 |
| #define | NR_1M 1048576 |
Functions | |
| void | nr_pixblock_setup_fast (NRPixBlock *pb, NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear) |
| Pixbuf initialisation using homegrown memory handling ("pixelstore"). | |
| void | nr_pixblock_setup (NRPixBlock *pb, NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear) |
| Pixbuf initialisation using g_new. | |
| void | nr_pixblock_setup_extern (NRPixBlock *pb, NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, unsigned char *px, int rs, bool empty, bool clear) |
| Pixbuf initialisation with preset values. | |
| void | nr_pixblock_release (NRPixBlock *pb) |
| Frees memory taken by pixel data in NRPixBlock. | |
| NRPixBlock * | nr_pixblock_new (NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear) |
| Allocates NRPixBlock and sets it up. | |
| NRPixBlock * | nr_pixblock_new_fast (NR_PIXBLOCK_MODE mode, int x0, int y0, int x1, int y1, bool clear) |
| Allocates NRPixBlock and sets it up. | |
| NRPixBlock * | nr_pixblock_free (NRPixBlock *pb) |
| Frees all memory taken by pixblock. | |
| unsigned char * | nr_pixelstore_4K_new (bool clear, unsigned char val) |
| void | nr_pixelstore_4K_free (unsigned char *px) |
| unsigned char * | nr_pixelstore_16K_new (bool clear, unsigned char val) |
| void | nr_pixelstore_16K_free (unsigned char *px) |
| unsigned char * | nr_pixelstore_64K_new (bool clear, unsigned char val) |
| void | nr_pixelstore_64K_free (unsigned char *px) |
| unsigned char * | nr_pixelstore_256K_new (bool clear, unsigned char val) |
| void | nr_pixelstore_256K_free (unsigned char *px) |
| unsigned char * | nr_pixelstore_1M_new (bool clear, unsigned char val) |
| void | nr_pixelstore_1M_free (unsigned char *px) |
Variables | |
| static unsigned char ** | nr_4K_px = NULL |
| static unsigned int | nr_4K_len = 0 |
| static unsigned int | nr_4K_size = 0 |
| static unsigned char ** | nr_16K_px = NULL |
| static unsigned int | nr_16K_len = 0 |
| static unsigned int | nr_16K_size = 0 |
| static unsigned char ** | nr_64K_px = NULL |
| static unsigned int | nr_64K_len = 0 |
| static unsigned int | nr_64K_size = 0 |
| static unsigned char ** | nr_256K_px = NULL |
| static unsigned int | nr_256K_len = 0 |
| static unsigned int | nr_256K_size = 0 |
| static unsigned char ** | nr_1M_px = NULL |
| static unsigned int | nr_1M_len = 0 |
| static unsigned int | nr_1M_size = 0 |
Detailed Description
Allocation/Setup of NRPixBlock objects.
Pixel store functions.
Authors: (C) 1999-2002 Lauris Kaplinski <lauris@kaplinski.com> 2008, Jasper van de Gronde <th.v.d.gonde@hccnet.nl>
This code is in the Public Domain
Definition in file nr-pixblock.cpp.
Define Documentation
| #define __NR_PIXBLOCK_C__ |
Definition at line 1 of file nr-pixblock.cpp.
| #define NR_16K_BLOCK 32 |
Definition at line 310 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_16K_free().
| #define NR_1M 1048576 |
Definition at line 414 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_1M_new().
| #define NR_1M_BLOCK 32 |
Definition at line 413 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_1M_free().
| #define NR_256K 262144 |
Definition at line 379 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_256K_new().
| #define NR_256K_BLOCK 32 |
Definition at line 378 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_256K_free().
| #define NR_4K_BLOCK 32 |
Definition at line 276 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_4K_free().
| #define NR_64K_BLOCK 32 |
Definition at line 344 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_64K_free().
| #define NR_TINY_MAX sizeof (unsigned char *) |
Size of buffer that needs no allocation (default 4).
Definition at line 20 of file nr-pixblock.cpp.
Referenced by nr_pixblock_setup(), and nr_pixblock_setup_fast().
Function Documentation
| NRPixBlock* nr_pixblock_free | ( | NRPixBlock * | pb | ) |
Frees all memory taken by pixblock.
- Returns:
- NULL
Definition at line 265 of file nr-pixblock.cpp.
References nr_pixblock_release(), and NULL.
Referenced by Inkscape::Filters::FilterGaussian::render(), and Inkscape::Filters::FilterComposite::render().
00266 { 00267 nr_pixblock_release (pb); 00268 00269 g_free (pb); 00270 00271 return NULL; 00272 }
| NRPixBlock* nr_pixblock_new | ( | NR_PIXBLOCK_MODE | mode, | |
| int | x0, | |||
| int | y0, | |||
| int | x1, | |||
| int | y1, | |||
| bool | clear | |||
| ) |
Allocates NRPixBlock and sets it up.
- Returns:
- Pointer to fresh pixblock. Calls g_new() and nr_pixblock_setup(). FIXME: currently unused, delete? JG: Should be used more often! (To simplify memory management.)
Definition at line 220 of file nr-pixblock.cpp.
References NRPixBlock::data, nr_pixblock_setup(), NR_PIXBLOCK_SIZE_TINY, NRPixBlock::px, and NRPixBlock::size.
00221 { 00222 NRPixBlock *pb; 00223 00224 pb = g_new (NRPixBlock, 1); 00225 if (!pb) return 0; 00226 00227 nr_pixblock_setup (pb, mode, x0, y0, x1, y1, clear); 00228 if (pb->size!=NR_PIXBLOCK_SIZE_TINY && !pb->data.px) { 00229 g_free(pb); 00230 return 0; 00231 } 00232 00233 return pb; 00234 }
| NRPixBlock* nr_pixblock_new_fast | ( | NR_PIXBLOCK_MODE | mode, | |
| int | x0, | |||
| int | y0, | |||
| int | x1, | |||
| int | y1, | |||
| bool | clear | |||
| ) |
Allocates NRPixBlock and sets it up.
- Returns:
- Pointer to fresh pixblock. Calls g_new() and nr_pixblock_setup().
Definition at line 243 of file nr-pixblock.cpp.
References NRPixBlock::data, nr_pixblock_setup_fast(), NR_PIXBLOCK_SIZE_TINY, NRPixBlock::px, and NRPixBlock::size.
Referenced by Inkscape::Filters::FilterGaussian::render(), and Inkscape::Filters::FilterComposite::render().
00244 { 00245 NRPixBlock *pb; 00246 00247 pb = g_new (NRPixBlock, 1); 00248 if (!pb) return 0; 00249 00250 nr_pixblock_setup_fast (pb, mode, x0, y0, x1, y1, clear); 00251 if (pb->size!=NR_PIXBLOCK_SIZE_TINY && !pb->data.px) { 00252 g_free(pb); 00253 return 0; 00254 } 00255 00256 return pb; 00257 }
| void nr_pixblock_release | ( | NRPixBlock * | pb | ) |
Frees memory taken by pixel data in NRPixBlock.
- Parameters:
-
pb Pointer to pixblock.
- Precondition:
- pb and pb->data.px point to valid addresses.
According to pb->size, one of the functions for freeing the pixelstore is called. May be called regardless of how pixbuf was set up.
Definition at line 182 of file nr-pixblock.cpp.
References NRPixBlock::data, NR_PIXBLOCK_SIZE_16K, NR_PIXBLOCK_SIZE_1M, NR_PIXBLOCK_SIZE_256K, NR_PIXBLOCK_SIZE_4K, NR_PIXBLOCK_SIZE_64K, NR_PIXBLOCK_SIZE_BIG, NR_PIXBLOCK_SIZE_STATIC, NR_PIXBLOCK_SIZE_TINY, nr_pixelstore_16K_free(), nr_pixelstore_1M_free(), nr_pixelstore_256K_free(), nr_pixelstore_4K_free(), nr_pixelstore_64K_free(), NRPixBlock::px, and NRPixBlock::size.
Referenced by clonetiler_trace_pick(), nr_arena_glyphs_group_render(), nr_arena_item_invoke_render(), nr_arena_render_paintserver_fill(), nr_arena_shape_clip(), nr_arena_shape_render(), nr_gdk_draw_gray_garbage(), nr_gdk_draw_rgba32_solid(), nr_pixblock_draw_line_rgba32(), nr_pixblock_free(), Inkscape::Filters::FilterMorphology::render(), Inkscape::Filters::FilterMerge::render(), Inkscape::Filters::FilterImage::render(), Inkscape::Filters::FilterGaussian::render(), Inkscape::Filters::FilterDisplacementMap::render(), Inkscape::Filters::FilterComponentTransfer::render(), Inkscape::Filters::FilterColorMatrix::render(), Inkscape::Filters::FilterBlend::render(), render_pixbuf(), sp_canvas_arena_render(), sp_canvas_paint_single_buffer(), sp_dropper_context_root_handler(), sp_export_get_rows(), sp_flood_do_flood_fill(), sp_font_preview_expose(), sp_gradient_image_update(), sp_icon_doc_icon(), sp_pat_fill(), sp_pattern_painter_free(), Inkscape::Filters::FilterTurbulence::update_pixbuffer(), and Inkscape::Filters::FilterTurbulence::~FilterTurbulence().
00183 { 00184 switch (pb->size) { 00185 case NR_PIXBLOCK_SIZE_TINY: 00186 break; 00187 case NR_PIXBLOCK_SIZE_4K: 00188 nr_pixelstore_4K_free (pb->data.px); 00189 break; 00190 case NR_PIXBLOCK_SIZE_16K: 00191 nr_pixelstore_16K_free (pb->data.px); 00192 break; 00193 case NR_PIXBLOCK_SIZE_64K: 00194 nr_pixelstore_64K_free (pb->data.px); 00195 break; 00196 case NR_PIXBLOCK_SIZE_256K: 00197 nr_pixelstore_256K_free (pb->data.px); 00198 break; 00199 case NR_PIXBLOCK_SIZE_1M: 00200 nr_pixelstore_1M_free (pb->data.px); 00201 break; 00202 case NR_PIXBLOCK_SIZE_BIG: 00203 g_free (pb->data.px); 00204 break; 00205 case NR_PIXBLOCK_SIZE_STATIC: 00206 break; 00207 default: 00208 break; 00209 } 00210 }
| void nr_pixblock_setup | ( | NRPixBlock * | pb, | |
| NR_PIXBLOCK_MODE | mode, | |||
| int | x0, | |||
| int | y0, | |||
| int | x1, | |||
| int | y1, | |||
| bool | clear | |||
| ) |
Pixbuf initialisation using g_new.
After allocating memory, the buffer is cleared if the clear flag is set.
- Parameters:
-
pb Pointer to the pixbuf struct. mode Indicates grayscale/RGB/RGBA. clear True if buffer should be cleared.
- Precondition:
- x1>=x0 && y1>=y0 && pb!=NULL FIXME: currently unused except for nr_pixblock_new and pattern tiles, replace with _fast and delete?
Definition at line 101 of file nr-pixblock.cpp.
References NRPixBlock::area, NRPixBlock::data, NRPixBlock::empty, h, NRPixBlock::mode, NR_PIXBLOCK_MODE_A8, NR_PIXBLOCK_MODE_R8G8B8, NR_PIXBLOCK_SIZE_BIG, NR_PIXBLOCK_SIZE_TINY, NR_TINY_MAX, NRPixBlock::p, NRPixBlock::px, NRPixBlock::rs, NRPixBlock::size, NRPixBlock::visible_area, dxf_input::w, NRRectL::x0, NRRectL::x1, NRRectL::y0, and NRRectL::y1.
Referenced by nr_pixblock_new(), and sp_pattern_painter_new().
00102 { 00103 int w, h, bpp; 00104 size_t size; 00105 00106 w = x1 - x0; 00107 h = y1 - y0; 00108 bpp = (mode == NR_PIXBLOCK_MODE_A8) ? 1 : (mode == NR_PIXBLOCK_MODE_R8G8B8) ? 3 : 4; 00109 00110 size = bpp * w * h; 00111 00112 if (size <= NR_TINY_MAX) { 00113 pb->size = NR_PIXBLOCK_SIZE_TINY; 00114 if (clear) memset (pb->data.p, 0x0, size); 00115 } else { 00116 pb->size = NR_PIXBLOCK_SIZE_BIG; 00117 pb->data.px = g_new (unsigned char, size); 00118 if (clear) memset (pb->data.px, 0x0, size); 00119 } 00120 00121 pb->mode = mode; 00122 pb->empty = 1; 00123 pb->visible_area.x0 = pb->area.x0 = x0; 00124 pb->visible_area.y0 = pb->area.y0 = y0; 00125 pb->visible_area.x1 = pb->area.x1 = x1; 00126 pb->visible_area.y1 = pb->area.y1 = y1; 00127 pb->rs = bpp * w; 00128 }
| void nr_pixblock_setup_extern | ( | NRPixBlock * | pb, | |
| NR_PIXBLOCK_MODE | mode, | |||
| int | x0, | |||
| int | y0, | |||
| int | x1, | |||
| int | y1, | |||
| unsigned char * | px, | |||
| int | rs, | |||
| bool | empty, | |||
| bool | clear | |||
| ) |
Pixbuf initialisation with preset values.
After copying all parameters into the NRPixBlock struct, the pixel buffer is cleared if the clear flag is set.
- Parameters:
-
pb Pointer to the pixbuf struct. mode Indicates grayscale/RGB/RGBA. clear True if buffer should be cleared.
- Precondition:
- x1>=x0 && y1>=y0 && pb!=NULL
- Todo:
- How do you recognise if
px was an uncleared tiny buffer?
Definition at line 140 of file nr-pixblock.cpp.
References NRPixBlock::area, NRPixBlock::data, NRPixBlock::empty, NRPixBlock::mode, NR_PIXBLOCK_MODE_A8, NR_PIXBLOCK_MODE_R8G8B8, NR_PIXBLOCK_SIZE_STATIC, NULL, NRPixBlock::px, NRPixBlock::rs, NRPixBlock::size, NRPixBlock::visible_area, dxf_input::w, NRRectL::x0, NRRectL::x1, voronoi::y, NRRectL::y0, and NRRectL::y1.
Referenced by clonetiler_trace_pick(), nr_arena_item_invoke_render(), Inkscape::Filters::FilterImage::render(), render_pixbuf(), sp_canvas_arena_render(), sp_canvas_paint_single_buffer(), sp_export_get_rows(), sp_flood_do_flood_fill(), sp_font_preview_expose(), sp_generate_internal_bitmap(), sp_gradient_image_update(), sp_icon_doc_icon(), and sp_pat_fill().
00141 { 00142 int w, bpp; 00143 00144 w = x1 - x0; 00145 bpp = (mode == NR_PIXBLOCK_MODE_A8) ? 1 : (mode == NR_PIXBLOCK_MODE_R8G8B8) ? 3 : 4; 00146 00147 pb->size = NR_PIXBLOCK_SIZE_STATIC; 00148 pb->mode = mode; 00149 pb->empty = empty; 00150 pb->visible_area.x0 = pb->area.x0 = x0; 00151 pb->visible_area.y0 = pb->area.y0 = y0; 00152 pb->visible_area.x1 = pb->area.x1 = x1; 00153 pb->visible_area.y1 = pb->area.y1 = y1; 00154 pb->data.px = px; 00155 pb->rs = rs; 00156 00157 g_assert (pb->data.px != NULL); 00158 if (clear) { 00159 if (rs == bpp * w) { 00162 if (pb->data.px) 00163 memset (pb->data.px, 0x0, bpp * (y1 - y0) * w); 00164 } else { 00165 int y; 00166 for (y = y0; y < y1; y++) { 00167 memset (pb->data.px + (y - y0) * rs, 0x0, bpp * w); 00168 } 00169 } 00170 } 00171 }
| void nr_pixblock_setup_fast | ( | NRPixBlock * | pb, | |
| NR_PIXBLOCK_MODE | mode, | |||
| int | x0, | |||
| int | y0, | |||
| int | x1, | |||
| int | y1, | |||
| bool | clear | |||
| ) |
Pixbuf initialisation using homegrown memory handling ("pixelstore").
Pixbuf sizes are differentiated into tiny, <4K, <16K, <64K, and more, with each type having its own method of memory handling. After allocating memory, the buffer is cleared if the clear flag is set. Intended to reduce memory fragmentation.
- Parameters:
-
pb Pointer to the pixbuf struct. mode Indicates grayscale/RGB/RGBA. clear True if buffer should be cleared.
- Precondition:
- x1>=x0 && y1>=y0 && pb!=NULL
Definition at line 35 of file nr-pixblock.cpp.
References NRPixBlock::area, NRPixBlock::data, NRPixBlock::empty, h, NRPixBlock::mode, NR_PIXBLOCK_MODE_A8, NR_PIXBLOCK_MODE_R8G8B8, NR_PIXBLOCK_SIZE_16K, NR_PIXBLOCK_SIZE_1M, NR_PIXBLOCK_SIZE_256K, NR_PIXBLOCK_SIZE_4K, NR_PIXBLOCK_SIZE_64K, NR_PIXBLOCK_SIZE_BIG, NR_PIXBLOCK_SIZE_TINY, nr_pixelstore_16K_new(), nr_pixelstore_1M_new(), nr_pixelstore_256K_new(), nr_pixelstore_4K_new(), nr_pixelstore_64K_new(), NR_TINY_MAX, NULL, NRPixBlock::p, NRPixBlock::px, NRPixBlock::rs, NRPixBlock::size, NRPixBlock::visible_area, dxf_input::w, NRRectL::x0, NRRectL::x1, NRRectL::y0, and NRRectL::y1.
Referenced by main(), nr_arena_glyphs_group_render(), nr_arena_item_get_background(), nr_arena_item_invoke_render(), nr_arena_render_paintserver_fill(), nr_arena_shape_clip(), nr_arena_shape_render(), nr_gdk_draw_gray_garbage(), nr_gdk_draw_rgba32_solid(), nr_pixblock_draw_line_rgba32(), nr_pixblock_new_fast(), Inkscape::Filters::Filter::render(), Inkscape::Filters::FilterTurbulence::render(), Inkscape::Filters::FilterTile::render(), Inkscape::Filters::FilterSpecularLighting::render(), Inkscape::Filters::FilterOffset::render(), Inkscape::Filters::FilterMorphology::render(), Inkscape::Filters::FilterMerge::render(), Inkscape::Filters::FilterImage::render(), Inkscape::Filters::FilterGaussian::render(), Inkscape::Filters::FilterFlood::render(), Inkscape::Filters::FilterDisplacementMap::render(), Inkscape::Filters::FilterDiffuseLighting::render(), Inkscape::Filters::FilterConvolveMatrix::render(), Inkscape::Filters::FilterComposite::render(), Inkscape::Filters::FilterComponentTransfer::render(), Inkscape::Filters::FilterColorMatrix::render(), Inkscape::Filters::FilterBlend::render(), sp_canvas_paint_single_buffer(), sp_dropper_context_root_handler(), sp_dyna_draw_brush(), sp_font_preview_expose(), and Inkscape::Filters::FilterTurbulence::update_pixbuffer().
00036 { 00037 int w, h, bpp; 00038 size_t size; 00039 00040 w = x1 - x0; 00041 h = y1 - y0; 00042 bpp = (mode == NR_PIXBLOCK_MODE_A8) ? 1 : (mode == NR_PIXBLOCK_MODE_R8G8B8) ? 3 : 4; 00043 00044 size = bpp * w * h; 00045 00046 if (size <= NR_TINY_MAX) { 00047 pb->size = NR_PIXBLOCK_SIZE_TINY; 00048 if (clear) memset (pb->data.p, 0x0, size); 00049 } else if (size <= 4096) { 00050 pb->size = NR_PIXBLOCK_SIZE_4K; 00051 pb->data.px = nr_pixelstore_4K_new (clear, 0x0); 00052 } else if (size <= 16384) { 00053 pb->size = NR_PIXBLOCK_SIZE_16K; 00054 pb->data.px = nr_pixelstore_16K_new (clear, 0x0); 00055 } else if (size <= 65536) { 00056 pb->size = NR_PIXBLOCK_SIZE_64K; 00057 pb->data.px = nr_pixelstore_64K_new (clear, 0x0); 00058 } else if (size <= 262144) { 00059 pb->size = NR_PIXBLOCK_SIZE_256K; 00060 pb->data.px = nr_pixelstore_256K_new (clear, 0x0); 00061 } else if (size <= 1048576) { 00062 pb->size = NR_PIXBLOCK_SIZE_1M; 00063 pb->data.px = nr_pixelstore_1M_new (clear, 0x0); 00064 } else { 00065 pb->size = NR_PIXBLOCK_SIZE_BIG; 00066 pb->data.px = NULL; 00067 if (size > 100000000) { // Don't even try to allocate more than 100Mb (5000x5000 RGBA 00068 // pixels). It'll just bog the system down even if successful. FIXME: 00069 // Can anyone suggest something better than the magic number? 00070 g_warning ("%lu bytes requested for pixel buffer, I won't try to allocate that.", (long unsigned) size); 00071 return; 00072 } 00073 pb->data.px = g_try_new (unsigned char, size); 00074 if (pb->data.px == NULL) { // memory allocation failed 00075 g_warning ("Could not allocate %lu bytes for pixel buffer!", (long unsigned) size); 00076 return; 00077 } 00078 if (clear) memset (pb->data.px, 0x0, size); 00079 } 00080 00081 pb->mode = mode; 00082 pb->empty = 1; 00083 pb->visible_area.x0 = pb->area.x0 = x0; 00084 pb->visible_area.y0 = pb->area.y0 = y0; 00085 pb->visible_area.x1 = pb->area.x1 = x1; 00086 pb->visible_area.y1 = pb->area.y1 = y1; 00087 pb->rs = bpp * w; 00088 }
| void nr_pixelstore_16K_free | ( | unsigned char * | px | ) |
Definition at line 333 of file nr-pixblock.cpp.
References NR_16K_BLOCK, nr_16K_len, nr_16K_px, and nr_16K_size.
Referenced by nr_pixblock_release(), and sp_font_preview_expose().
00334 { 00335 if (nr_16K_len == nr_16K_size) { 00336 nr_16K_size += NR_16K_BLOCK; 00337 nr_16K_px = g_renew (unsigned char *, nr_16K_px, nr_16K_size); 00338 } 00339 00340 nr_16K_px[nr_16K_len] = px; 00341 nr_16K_len += 1; 00342 }
| unsigned char* nr_pixelstore_16K_new | ( | bool | clear, | |
| unsigned char | val | |||
| ) |
Definition at line 316 of file nr-pixblock.cpp.
References nr_16K_len, and nr_16K_px.
Referenced by nr_pixblock_setup_fast(), and sp_font_preview_expose().
00317 { 00318 unsigned char *px; 00319 00320 if (nr_16K_len != 0) { 00321 nr_16K_len -= 1; 00322 px = nr_16K_px[nr_16K_len]; 00323 } else { 00324 px = g_new (unsigned char, 16384); 00325 } 00326 00327 if (clear) memset (px, val, 16384); 00328 00329 return px; 00330 }
| void nr_pixelstore_1M_free | ( | unsigned char * | px | ) |
Definition at line 437 of file nr-pixblock.cpp.
References NR_1M_BLOCK, nr_1M_len, nr_1M_px, and nr_1M_size.
Referenced by nr_pixblock_release(), and sp_canvas_paint_single_buffer().
00438 { 00439 if (nr_1M_len == nr_1M_size) { 00440 nr_1M_size += NR_1M_BLOCK; 00441 nr_1M_px = g_renew (unsigned char *, nr_1M_px, nr_1M_size); 00442 } 00443 00444 nr_1M_px[nr_1M_len] = px; 00445 nr_1M_len += 1; 00446 }
| unsigned char* nr_pixelstore_1M_new | ( | bool | clear, | |
| unsigned char | val | |||
| ) |
Definition at line 420 of file nr-pixblock.cpp.
References NR_1M, nr_1M_len, and nr_1M_px.
Referenced by nr_pixblock_setup_fast(), and sp_canvas_paint_single_buffer().
| void nr_pixelstore_256K_free | ( | unsigned char * | px | ) |
Definition at line 402 of file nr-pixblock.cpp.
References NR_256K_BLOCK, nr_256K_len, nr_256K_px, and nr_256K_size.
Referenced by nr_pixblock_release(), and sp_canvas_paint_single_buffer().
00403 { 00404 if (nr_256K_len == nr_256K_size) { 00405 nr_256K_size += NR_256K_BLOCK; 00406 nr_256K_px = g_renew (unsigned char *, nr_256K_px, nr_256K_size); 00407 } 00408 00409 nr_256K_px[nr_256K_len] = px; 00410 nr_256K_len += 1; 00411 }
| unsigned char* nr_pixelstore_256K_new | ( | bool | clear, | |
| unsigned char | val | |||
| ) |
Definition at line 385 of file nr-pixblock.cpp.
References NR_256K, nr_256K_len, and nr_256K_px.
Referenced by nr_pixblock_setup_fast(), and sp_canvas_paint_single_buffer().
00386 { 00387 unsigned char *px; 00388 00389 if (nr_256K_len != 0) { 00390 nr_256K_len -= 1; 00391 px = nr_256K_px[nr_256K_len]; 00392 } else { 00393 px = g_new (unsigned char, NR_256K); 00394 } 00395 00396 if (clear) memset (px, val, NR_256K); 00397 00398 return px; 00399 }
| void nr_pixelstore_4K_free | ( | unsigned char * | px | ) |
Definition at line 299 of file nr-pixblock.cpp.
References NR_4K_BLOCK, nr_4K_len, nr_4K_px, and nr_4K_size.
Referenced by nr_pixblock_release().
00300 { 00301 if (nr_4K_len == nr_4K_size) { 00302 nr_4K_size += NR_4K_BLOCK; 00303 nr_4K_px = g_renew (unsigned char *, nr_4K_px, nr_4K_size); 00304 } 00305 00306 nr_4K_px[nr_4K_len] = px; 00307 nr_4K_len += 1; 00308 }
| unsigned char* nr_pixelstore_4K_new | ( | bool | clear, | |
| unsigned char | val | |||
| ) |
Definition at line 282 of file nr-pixblock.cpp.
References nr_4K_len, and nr_4K_px.
Referenced by nr_pixblock_setup_fast().
| void nr_pixelstore_64K_free | ( | unsigned char * | px | ) |
Definition at line 367 of file nr-pixblock.cpp.
References NR_64K_BLOCK, nr_64K_len, nr_64K_px, and nr_64K_size.
Referenced by nr_pixblock_release(), and sp_export_png_file().
00368 { 00369 if (nr_64K_len == nr_64K_size) { 00370 nr_64K_size += NR_64K_BLOCK; 00371 nr_64K_px = g_renew (unsigned char *, nr_64K_px, nr_64K_size); 00372 } 00373 00374 nr_64K_px[nr_64K_len] = px; 00375 nr_64K_len += 1; 00376 }
| unsigned char* nr_pixelstore_64K_new | ( | bool | clear, | |
| unsigned char | val | |||
| ) |
Definition at line 350 of file nr-pixblock.cpp.
References nr_64K_len, and nr_64K_px.
Referenced by nr_pixblock_setup_fast(), and sp_export_png_file().
00351 { 00352 unsigned char *px; 00353 00354 if (nr_64K_len != 0) { 00355 nr_64K_len -= 1; 00356 px = nr_64K_px[nr_64K_len]; 00357 } else { 00358 px = g_new (unsigned char, 65536); 00359 } 00360 00361 if (clear) memset (px, val, 65536); 00362 00363 return px; 00364 }
Variable Documentation
unsigned int nr_16K_len = 0 [static] |
Definition at line 312 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_16K_free(), and nr_pixelstore_16K_new().
unsigned char** nr_16K_px = NULL [static] |
Definition at line 311 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_16K_free(), and nr_pixelstore_16K_new().
unsigned int nr_16K_size = 0 [static] |
Definition at line 313 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_16K_free().
unsigned int nr_1M_len = 0 [static] |
Definition at line 416 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_1M_free(), and nr_pixelstore_1M_new().
unsigned char** nr_1M_px = NULL [static] |
Definition at line 415 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_1M_free(), and nr_pixelstore_1M_new().
unsigned int nr_1M_size = 0 [static] |
Definition at line 417 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_1M_free().
unsigned int nr_256K_len = 0 [static] |
Definition at line 381 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_256K_free(), and nr_pixelstore_256K_new().
unsigned char** nr_256K_px = NULL [static] |
Definition at line 380 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_256K_free(), and nr_pixelstore_256K_new().
unsigned int nr_256K_size = 0 [static] |
Definition at line 382 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_256K_free().
unsigned int nr_4K_len = 0 [static] |
Definition at line 278 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_4K_free(), and nr_pixelstore_4K_new().
unsigned char** nr_4K_px = NULL [static] |
Definition at line 277 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_4K_free(), and nr_pixelstore_4K_new().
unsigned int nr_4K_size = 0 [static] |
Definition at line 279 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_4K_free().
unsigned int nr_64K_len = 0 [static] |
Definition at line 346 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_64K_free(), and nr_pixelstore_64K_new().
unsigned char** nr_64K_px = NULL [static] |
Definition at line 345 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_64K_free(), and nr_pixelstore_64K_new().
unsigned int nr_64K_size = 0 [static] |
Definition at line 347 of file nr-pixblock.cpp.
Referenced by nr_pixelstore_64K_free().
