MCPcopy Index your code
hub / github.com/MapServer/MapServer / addTileCache

Function addTileCache

maprendering.c:138–181  ·  view source on GitHub ↗

add a cached tile to the current image's cache */

Source from the content-addressed store, hash-verified

136
137/* add a cached tile to the current image's cache */
138tileCacheObj *addTileCache(imageObj *img,
139 imageObj *tile, symbolObj *symbol, symbolStyleObj *style, int width, int height) {
140 tileCacheObj *cachep;
141
142 if(img->ntiles >= MS_IMAGECACHESIZE) { /* remove last element, size stays the same */
143 cachep = img->tilecache;
144
145 /*go to the before last cache object*/
146 while(cachep->next && cachep->next->next) cachep = cachep->next;
147
148 /*free the last tile's data*/
149 msFreeImage(cachep->next->image);
150
151 /*reuse the last tile object*/
152 /* make the cache point to the start of the list*/
153 cachep->next->next = img->tilecache;
154 /* point the global cache to the new first */
155 img->tilecache = cachep->next;
156 /* the before last cache is now last, so it has no successor*/
157 cachep->next = NULL;
158
159 } else {
160 img->ntiles += 1;
161 cachep = (tileCacheObj*)malloc(sizeof(tileCacheObj));
162 MS_CHECK_ALLOC(cachep, sizeof(tileCacheObj), NULL);
163 cachep->next = img->tilecache;
164 img->tilecache = cachep;
165 }
166
167 cachep = img->tilecache;
168
169 cachep->image = tile;
170 cachep->outlinewidth = style->outlinewidth;
171 cachep->scale = style->scale;
172 cachep->rotation = style->rotation;
173 cachep->outlinewidth = style->outlinewidth;
174 if(style->color) MS_COPYCOLOR(&cachep->color,style->color);
175 if(style->outlinecolor) MS_COPYCOLOR(&cachep->outlinecolor,style->outlinecolor);
176 if(style->backgroundcolor) MS_COPYCOLOR(&cachep->backgroundcolor,style->backgroundcolor);
177 cachep->width = width;
178 cachep->height = height;
179 cachep->symbol = symbol;
180 return(cachep);
181}
182
183imageObj *getTile(imageObj *img, symbolObj *symbol, symbolStyleObj *s, int width, int height,
184 int seamlessmode) {

Callers 1

getTileFunction · 0.85

Calls 1

msFreeImageFunction · 0.85

Tested by

no test coverage detected