MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenImageIO / get_tile

Method get_tile

src/libtexture/imagecache.cpp:2438–2462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2436
2437
2438ImageCache::Tile *
2439ImageCacheImpl::get_tile (ustring filename, int subimage, int miplevel,
2440 int x, int y, int z)
2441{
2442 ImageCachePerThreadInfo *thread_info = get_perthread_info ();
2443 ImageCacheFile *file = find_file (filename, thread_info);
2444 if (! file || file->broken())
2445 return NULL;
2446 const ImageSpec &spec (file->spec(subimage,miplevel));
2447 // Snap x,y,z to the corner of the tile
2448 int xtile = (x-spec.x) / spec.tile_width;
2449 int ytile = (y-spec.y) / spec.tile_height;
2450 int ztile = (z-spec.z) / spec.tile_depth;
2451 x = spec.x + xtile * spec.tile_width;
2452 y = spec.y + ytile * spec.tile_height;
2453 z = spec.z + ztile * spec.tile_depth;
2454 TileID id (*file, subimage, miplevel, x, y, z);
2455 if (find_tile(id, thread_info)) {
2456 ImageCacheTileRef tile(thread_info->tile);
2457 tile->_incref(); // Fake an extra reference count
2458 return (ImageCache::Tile *) tile.get();
2459 } else {
2460 return NULL;
2461 }
2462}
2463
2464
2465

Callers 4

ic_get_tile_testFunction · 0.80
ic_release_tile_testFunction · 0.80
ic_tile_pixels_testFunction · 0.80
retileMethod · 0.80

Calls 2

_increfMethod · 0.80
getMethod · 0.45

Tested by 3

ic_get_tile_testFunction · 0.64
ic_release_tile_testFunction · 0.64
ic_tile_pixels_testFunction · 0.64