void MCStack::view_updatetilecache(void) { if (m_view_tilecache == nil) return; // If the tilecache is not valid, flush it. if (!MCTileCacheIsValid(m_view_tilecache)) MCTileCacheFlush(m_view_tilecache); MCTileCacheBeginFrame(m_view_tilecache); curcard -> render(); // IM-2013-10-14: [[ FullscreenMode ]] Add tilecache scenery layer to render the view background // Final step is to render the background. Note that the background layer // really only needs to be the rect rounded outward to the nearest tile // boundaries, but 8192, 8192 is bigger than it can ever be at present so // is an easier alternative. MCTileCacheLayer t_bg_layer; t_bg_layer . id = m_view_bg_layer_id; t_bg_layer . region = MCRectangle32Make(0, 0, 8192, 8192); t_bg_layer . clip = MCRectangle32Make(0, 0, 8192, 8192); t_bg_layer . is_opaque = true; t_bg_layer . opacity = 255; t_bg_layer . ink = GXblendSrcOver; t_bg_layer . callback = view_device_render_background; t_bg_layer . context = this; MCTileCacheRenderScenery(m_view_tilecache, t_bg_layer); m_view_bg_layer_id = t_bg_layer . id; MCTileCacheEndFrame(m_view_tilecache); }
void MCCard::render(void) { MCTileCacheRef t_tiler; t_tiler = getstack() -> gettilecache(); bool t_reset_ids; t_reset_ids = MCTileCacheIsClean(t_tiler); if (getstate(CS_SIZE)) { MCTileCacheLayer t_fg_layer; t_fg_layer . id = m_fg_layer_id; t_fg_layer . region = selrect; t_fg_layer . is_opaque = false; t_fg_layer . opacity = 255; t_fg_layer . ink = GXblendSrcOver; t_fg_layer . callback = render_foreground; t_fg_layer . context = this; MCTileCacheRenderScenery(t_tiler, t_fg_layer); m_fg_layer_id = t_fg_layer . id; } else m_fg_layer_id = 0; MCObjptr *t_objptrs; t_objptrs = getobjptrs(); if (t_objptrs != nil) { MCObjptr *t_objptr; t_objptr = t_objptrs -> prev(); do { MCControl *t_control; t_control = t_objptr -> getref(); // If the tilecache is 'clean' then we must reset the attrs to // force a sync. if (t_reset_ids) t_control -> layer_resetattrs(); // Take note of whether the spriteness of a layer has changed. bool t_old_is_sprite; t_old_is_sprite = t_control -> layer_issprite(); // Sync the attributes, make sure we commit the new values. t_control -> layer_computeattrs(true); // Initialize the common layer props. MCTileCacheLayer t_layer; t_layer . id = t_control -> layer_getid(); t_layer . opacity = t_control -> getopacity(); t_layer . ink = t_control -> getink(); t_layer . context = t_control; // The opaqueness of a layer has already been computed. t_layer . is_opaque = t_control -> layer_isopaque(); // Now compute the layer's region/clip. if (!t_control -> getflag(F_VISIBLE) && !MCshowinvisibles) { // Invisible layers just have empty region/clip. t_layer . region = MCU_make_rect(0, 0, 0, 0); t_layer . clip = MCU_make_rect(0, 0, 0, 0); } else if (!t_control -> layer_isscrolling()) { // Non-scrolling layer's are the size of their effective rects. t_layer . region = t_control -> geteffectiverect(); t_layer . clip = t_layer . region; } else { // For a scrolling layer, the clip is the bounds of the control, while // the region we draw is the group's minrect. t_layer . region = t_control -> layer_getcontentrect(); t_layer . clip = t_control -> geteffectiverect(); } // Now render the layer - what method we use depends on whether the // layer is a sprite or not. if (t_control -> layer_issprite()) { // If the layer was not a sprite before, remove the scenery // layer that it was. if (!t_old_is_sprite && t_layer . id != 0) { MCTileCacheRemoveScenery(t_tiler, t_layer . id, t_control -> geteffectiverect()); t_layer . id = 0; } t_layer . callback = testtilecache_sprite_renderer; MCTileCacheRenderSprite(t_tiler, t_layer); } else { // If the layer was a sprite before, remove the sprite // layer that it was. if (t_old_is_sprite && t_layer . id != 0) { MCTileCacheRemoveSprite(t_tiler, t_layer . id); t_layer . id = 0; } t_layer . callback = testtilecache_scenery_renderer; MCTileCacheRenderScenery(t_tiler, t_layer); } // Upate the id. t_control -> layer_setid(t_layer . id); // Advance to the object below. t_objptr = t_objptr -> prev(); } while(t_objptr != t_objptrs -> prev()); } // Final step is to render the background. Note that the background layer // really only needs to be the rect rounded outward to the nearest tile // boundaries, but 8192, 8192 is bigger than it can ever be at present so // is an easier alternative. MCTileCacheLayer t_bg_layer; t_bg_layer . id = m_bg_layer_id; t_bg_layer . region = MCU_make_rect(0, 0, 8192, 8192); t_bg_layer . is_opaque = true; t_bg_layer . opacity = 255; t_bg_layer . ink = GXblendSrcOver; t_bg_layer . callback = render_background; t_bg_layer . context = this; MCTileCacheRenderScenery(t_tiler, t_bg_layer); m_bg_layer_id = t_bg_layer . id; }