Exemple #1
0
void MCStack::view_setfullscreen(bool p_fullscreen)
{
	bool t_fullscreen = view_getfullscreen();
	
	m_view_fullscreen = p_fullscreen;
	
	// IM-2014-01-16: [[ StackScale ]] Reopen the window after changing fullscreen
	if (t_fullscreen != view_getfullscreen())
	{
		reopenwindow();
		
		// IM-2014-01-16: [[ StackScale ]] Update view transform after changing view property
		view_update_transform();
	}
}
Exemple #2
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();
}
Exemple #3
0
void MCStack::view_setfullscreen(bool p_fullscreen)
{
	bool t_fullscreen = view_getfullscreen();
	
	// IM-2014-02-12: [[ Bug 11783 ]] We may also need to reset the fonts on Windows when
	//   fullscreen is changed
	bool t_ideal_layout;
	t_ideal_layout = getuseideallayout();

	m_view_fullscreen = p_fullscreen;
	
	// IM-2014-01-16: [[ StackScale ]] Reopen the window after changing fullscreen
	if (t_fullscreen != view_getfullscreen())
	{
		// IM-2014-05-27: [[ Bug 12321 ]] Work out here whether or not we need to purge fonts
		if ((t_ideal_layout != getuseideallayout()) && opened)
			m_purge_fonts = true;

		reopenwindow();
		
		// IM-2014-05-27: [[ Bug 12321 ]] Move view transform update to reopenwindow() to allow stack rect to be reset correctly before reopening
	}
}
Exemple #4
0
void MCStack::view_configure(bool p_user)
{
	MCRectangle t_view_rect;
	mode_getrealrect(t_view_rect);

	// IM-2014-09-23: [[ Bug 13349 ]] If window geometry change occurs while there's a pending resize
	//    then use the requested rect rather than the new one.
	if (m_view_need_resize)
		t_view_rect = m_view_rect;
	
	if (!MCU_equal_rect(t_view_rect, m_view_rect))
	{
		// IM-2014-02-13: [[ StackScale ]] Test if the view size has changed
		bool t_resize;
		t_resize = t_view_rect.width != m_view_rect.width || t_view_rect.height != m_view_rect.height;
		
		m_view_rect = t_view_rect;
		
		view_on_rect_changed();
		
		if (view_getfullscreen())
		{
			// IM-2014-01-16: [[ StackScale ]] recalculate fullscreenmode transform after view rect change
			view_update_transform();
		}
		else
		{
			uint32_t t_current_width, t_current_height;
			t_current_width = m_view_adjusted_stack_rect.width;
			t_current_height = m_view_adjusted_stack_rect.height;
			
			// IM-2014-01-16: [[ StackScale ]] set the stack rects to the scaled down view rect
			m_view_requested_stack_rect = m_view_adjusted_stack_rect = MCRectangleGetTransformedBounds(m_view_rect, MCGAffineTransformInvert(m_view_transform));
			
			// IM-2014-02-13: [[ StackScale ]] If the view size has not changed then make sure
			//   the stack size also remains the same
			if (!t_resize)
			{
				//restore current logical width & height
				m_view_requested_stack_rect.width = m_view_adjusted_stack_rect.width = t_current_width;
				m_view_requested_stack_rect.height = m_view_adjusted_stack_rect.height = t_current_height;
			}
			
			// IM-2014-02-06: [[ ShowAll ]] Update the visible stack rect
			m_view_stack_visible_rect = MCRectangleMake(0, 0, m_view_adjusted_stack_rect.width, m_view_adjusted_stack_rect.height);
		}
	}
	configure(p_user);
}
Exemple #5
0
// IM-2014-01-16: [[ StackScale ]] Utility method to calculate new rects and view transform
void MCStack::view_calculate_viewports(const MCRectangle &p_stack_rect, MCRectangle &r_adjusted_stack_rect, MCRectangle &r_view_rect, MCGAffineTransform &r_transform)
{
	MCRectangle t_view_rect;

	MCGAffineTransform t_transform;
	t_transform = MCGAffineTransformMakeScale(m_view_content_scale, m_view_content_scale);
	
	MCRectangle t_stack_rect;
	
	// IM-2014-01-16: [[ StackScale ]] Constrain stack size within the min/max size
	t_stack_rect = constrainstackrect(p_stack_rect);
	
	// IM-2014-01-16: [[ StackScale ]] transform stack rect using scale factor
	// IM-2014-02-13: [[ StackScale ]] Use MCGRectangle to avoid resizing due to rounding errors
	MCGRectangle t_scaled_rect;
	t_scaled_rect = MCGRectangleApplyAffineTransform(MCRectangleToMCGRectangle(t_stack_rect), t_transform);

	t_scaled_rect = view_constrainstackviewport(t_scaled_rect);
	
	MCStackFullscreenMode t_mode;
	
	if (view_getfullscreen())
	{
		t_mode = m_view_fullscreenmode;
		
		const MCDisplay *t_display;
		t_display = MCscreen -> getnearestdisplay(MCGRectangleGetIntegerInterior(t_scaled_rect));

		t_view_rect = MCscreen->fullscreenrect(t_display);
		// IM-2013-12-19: [[ Bug 11590 ]] Removed adjustment of screen rect to 0,0 origin
	}
	else
	{
		t_mode = kMCStackFullscreenModeNone;
		t_view_rect = MCGRectangleGetIntegerInterior(t_scaled_rect);
	}
	
	// IM-2014-01-16: [[ StackScale ]] store adjusted rect in stack coords
	MCGRectangle t_adjusted;
	t_adjusted = MCGRectangleApplyAffineTransform(t_scaled_rect, MCGAffineTransformInvert(t_transform));
	
	r_adjusted_stack_rect = MCGRectangleGetIntegerRect(t_adjusted);
	
	r_view_rect = t_view_rect;
	
	// IM-2014-01-16: [[ StackScale ]] append scale transform to fullscreenmode transform
	r_transform = MCGAffineTransformConcat(view_get_stack_transform(t_mode, MCGRectangleGetIntegerBounds(t_scaled_rect), t_view_rect), t_transform);
}
Exemple #6
0
// IM-2014-02-13: [[ StackScale ]] Update to work with MCGRectangles
MCGRectangle MCStack::view_constrainstackviewport(const MCGRectangle &p_rect)
{
	// IM-2014-01-16: [[ StackScale ]] stack rect now constrained to min/max size elsewhere
	MCGRectangle t_stackrect;
	t_stackrect = p_rect;
	
	// MW-2012-10-04: [[ Bug 10436 ]] Make sure we constrain stack size to screen size
	//   if in fullscreen mode.
	MCGRectangle t_new_rect;
	if (view_getfullscreen())
	{
		const MCDisplay *t_display;
		t_display = MCscreen -> getnearestdisplay(MCGRectangleGetIntegerInterior(t_stackrect));
		
		switch (m_view_fullscreenmode)
		{
			case kMCStackFullscreenResize:
				// resize stack to fullscreen rect
				t_new_rect = MCRectangleToMCGRectangle(MCscreen->fullscreenrect(t_display));
				break;
				
			case kMCStackFullscreenNoScale:
				// center rect on screen
				t_new_rect = MCGRectangleCenterOnRect(t_stackrect, MCRectangleToMCGRectangle(MCscreen->fullscreenrect(t_display)));
				break;
				
			case kMCStackFullscreenExactFit:
			case kMCStackFullscreenLetterbox:
			case kMCStackFullscreenNoBorder:
			case kMCStackFullscreenShowAll:
				// scaling modes should return the requested stack rect
				t_new_rect = t_stackrect;
				break;
				
			default:
				MCAssert(false);
		}
	}
	else
	{
		// IM-2014-02-28: [[ Bug 11844 ]] Don't constrain stack rect here unless fullscreen
		t_new_rect = t_stackrect;
	}
	
	return t_new_rect;
}
Exemple #7
0
void MCStack::view_sync_window_geometry(void)
{
	if (view_getfullscreen())
	{
		// if the view is fullscreen then reconfigure
		view_configure(True);
	}
	else
	{
		// otherwise reset the window rect which may have changed as a result of scaling

		// IM-2014-01-24: [[ HiDPI ]] Change to use logical coordinates - device coordinate conversion no longer needed
		/* CODE REMOVED */
		
		// IM-2013-10-08: [[ FullscreenMode ]] Update window size hints when setting the view geometry.
		setsizehints();
		view_setgeom(m_view_rect);
		
		view_on_rect_changed();
	}
}
Exemple #8
0
void MCStack::view_render(MCGContextRef p_target, MCRectangle p_rect)
{
    if (getextendedstate(ECS_DONTDRAW))
        return;
    
    // redraw borders if visible

	// scale & position stack redraw rect
	// update stack region
	// IM-2014-01-16: [[ StackScale ]] Transform redraw rect to stack coords in all cases
		MCRectangle t_update_rect;
		t_update_rect = MCRectangleGetTransformedBounds(p_rect, MCGAffineTransformInvert(m_view_transform));
		
		MCGContextSave(p_target);
		MCGContextConcatCTM(p_target, m_view_transform);
		
	if (view_getfullscreen())
	{
		
		// IM-2013-12-19: [[ ShowAll ]] Check if the view background needs to be drawn
		// IM-2013-12-20: [[ ShowAll ]] Draw the stack into its viewport
		if (!MCU_rect_in_rect(t_update_rect, m_view_stack_visible_rect))
		{
			// IM-2013-10-08: [[ FullscreenMode ]] draw the view backdrop if the render area
			// falls outside the stack rect
			/* OVERHAUL - REVISIT: currently just draws black behind the stack area */
			MCGContextAddRectangle(p_target, MCRectangleToMCGRectangle(t_update_rect));
			MCGContextSetFillRGBAColor(p_target, 0.0, 0.0, 0.0, 1.0);
			MCGContextFill(p_target);
		}

		t_update_rect = MCU_intersect_rect(t_update_rect, m_view_stack_visible_rect);
		
		MCGContextClipToRect(p_target, MCRectangleToMCGRectangle(t_update_rect));
	}

		render(p_target, t_update_rect);
		MCGContextRestore(p_target);
	}