Beispiel #1
0
void MCStack::view_update_transform(void)
{
	MCRectangle t_view_rect;
	MCGAffineTransform t_transform;
	
	// IM-2014-01-16: [[ StackScale ]] Use utility method to calculate new values
	view_calculate_viewports(m_view_requested_stack_rect, m_view_adjusted_stack_rect, t_view_rect, t_transform);
	
	// IM-2013-12-20: [[ ShowAll ]] Calculate new stack visible rect
	MCRectangle t_stack_visible_rect;
	t_stack_visible_rect = MCRectangleGetTransformedBounds(MCRectangleMake(0, 0, t_view_rect.width, t_view_rect.height), MCGAffineTransformInvert(t_transform));
	if (m_view_fullscreenmode == kMCStackFullscreenLetterbox || m_view_fullscreenmode == kMCStackFullscreenNoScale)
		t_stack_visible_rect = MCU_intersect_rect(t_stack_visible_rect, MCRectangleMake(0, 0, m_view_adjusted_stack_rect.width, m_view_adjusted_stack_rect.height));
	
	// IM-2013-10-03: [[ FullscreenMode ]] if the transform has changed, redraw everything
	// IM-2013-12-20: [[ ShowAll ]] if the stack viewport has changed, redraw everything
	if (!MCU_equal_rect(t_stack_visible_rect, m_view_stack_visible_rect) || !MCGAffineTransformIsEqual(t_transform, m_view_transform))
	{
		m_view_transform = t_transform;
		m_view_stack_visible_rect = t_stack_visible_rect;
		
		view_dirty_all();
	}
	
	// IM-2014-01-16: [[ StackScale ]] Update view rect if needed
	view_setrect(t_view_rect);
}
Beispiel #2
0
void MCStack::view_setcompositortilesize(uint32_t p_size)
{
	if (m_view_tilecache != nil)
	{
		MCTileCacheSetTileSize(m_view_tilecache, p_size);
		view_dirty_all();
	}
}
Beispiel #3
0
void MCStack::view_setcompositorcachelimit(uint32_t p_limit)
{
	if (m_view_tilecache != nil)
	{
		MCTileCacheSetCacheLimit(m_view_tilecache, p_limit);
		view_dirty_all();
	}
}
Beispiel #4
0
void MCStack::view_on_rect_changed(void)
{
	// IM-2013-10-03: [[ FullscreenMode ]] if the view rect has changed, update the tilecache geometry
	view_updatetilecacheviewport();
	
	if (view_getfullscreen())
		view_dirty_all();
}
Beispiel #5
0
void MCStack::view_setbackingscale(MCGFloat p_scale)
{
	if (p_scale == m_view_backing_scale)
		return;
	
	m_view_backing_scale = p_scale;

	// reset tilecache if the backing scale has changed
	view_updatetilecacheviewport();
	view_dirty_all();
}
Beispiel #6
0
void MCStack::view_setcompositortype(MCTileCacheCompositorType p_type)
{
	if (p_type == kMCTileCacheCompositorNone)
	{
		MCTileCacheDestroy(m_view_tilecache);
		m_view_tilecache = nil;
	}
	else
	{
		if (m_view_tilecache == nil)
		{
			MCTileCacheCreate(32, 4096 * 1024, m_view_tilecache);
			
			view_updatetilecacheviewport();
		}
		
		MCTileCacheSetCompositor(m_view_tilecache, p_type);
	}
	
	view_dirty_all();
}
Beispiel #7
0
void MCStack::view_setacceleratedrendering(bool p_value)
{
	// If we are turning accelerated rendering off, then destroy the tilecache.
	if (!p_value)
	{
		MCTileCacheDestroy(m_view_tilecache);
		m_view_tilecache = nil;
		
		// MW-2012-03-15: [[ Bug ]] Make sure we dirty the stack to ensure all the
		//   layer mode attrs are rest.
		view_dirty_all();
		
		return;
	}
	
	// If we are turning accelerated rendering on, and we already have a tile-
	// cache, then do nothing.
	if (m_view_tilecache != nil)
		return;
	
	// Otherwise, we configure based on platform settings.
	int32_t t_tile_size;
	int32_t t_cache_limit;
	MCTileCacheCompositorType t_compositor_type;
#ifdef _MAC_DESKTOP
	t_compositor_type = kMCTileCacheCompositorCoreGraphics;
	t_tile_size = 32;
	t_cache_limit = 32 * 1024 * 1024;
#elif defined(_WINDOWS_DESKTOP) || defined(_LINUX_DESKTOP)
	t_compositor_type = kMCTileCacheCompositorSoftware;
	t_tile_size = 32;
	t_cache_limit = 32 * 1024 * 1024;
#elif defined(_IOS_MOBILE) || defined(_ANDROID_MOBILE)
	t_compositor_type = kMCTileCacheCompositorStaticOpenGL;
	
	const MCDisplay *t_display;
	MCscreen -> getdisplays(t_display, false);
	
	MCRectangle t_viewport;
	t_viewport = t_display -> viewport;
	
	// IM-2014-01-30: [[ HiDPI ]] Use backing-surface size to determine small, medium, or large
	t_viewport = MCRectangleGetScaledBounds(t_viewport, view_getbackingscale());
	
	bool t_small_screen, t_medium_screen;
	t_small_screen = MCMin(t_viewport . width, t_viewport . height) <= 480 && MCMax(t_viewport . width, t_viewport . height) <= 640;
	t_medium_screen = MCMin(t_viewport . width, t_viewport . height) <= 768 && MCMax(t_viewport . width, t_viewport . height) <= 1024;
	
	if (t_small_screen)
		t_tile_size = 32, t_cache_limit = 16 * 1024 * 1024;
	else if (t_medium_screen)
		t_tile_size = 64, t_cache_limit = 32 * 1024 * 1024;
	else
		t_tile_size = 64, t_cache_limit = 64 * 1024 * 1024;
#endif
	
	MCTileCacheCreate(t_tile_size, t_cache_limit, m_view_tilecache);
	view_updatetilecacheviewport();
	MCTileCacheSetCompositor(m_view_tilecache, t_compositor_type);
	
	view_dirty_all();
}