亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gameswf_shape.cpp

?? 一個開源的嵌入式flash播放器的源代碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
// gameswf_shape.cpp	-- Thatcher Ulrich <tu@tulrich.com> 2003// This source code has been donated to the Public Domain.  Do// whatever you want with it.// Quadratic bezier outline shapes, the basis for most SWF rendering.#include "gameswf_shape.h"#include "gameswf_impl.h"#include "gameswf_log.h"#include "gameswf_render.h"#include "gameswf_stream.h"#include "gameswf_tesselate.h"#include "base/tu_file.h"#include <float.h>#define DEBUG_DISPLAY_SHAPE_PATHS#ifdef DEBUG_DISPLAY_SHAPE_PATHS	// For debugging only!	bool	gameswf_debug_show_paths = false;#endif // DEBUG_DISPLAY_SHAPE_PATHSnamespace gameswf{	static float	s_curve_max_pixel_error = 1.0f;	void	set_curve_max_pixel_error(float pixel_error)	{		s_curve_max_pixel_error = fclamp(pixel_error, 1e-6f, 1e6f);	}	float	get_curve_max_pixel_error()	{		return s_curve_max_pixel_error;	}	//	// edge	//	edge::edge()		:		m_cx(0), m_cy(0),		m_ax(0), m_ay(0)	{}	edge::edge(float cx, float cy, float ax, float ay)		:		m_cx(cx), m_cy(cy),		m_ax(ax), m_ay(ay)	{	}	void	edge::tesselate_curve() const	// Send this segment to the tesselator.	{		tesselate::add_curve_segment(m_cx, m_cy, m_ax, m_ay);	}	bool	edge::is_straight() const	{		return m_cx == m_ax && m_cy == m_ay;	}	//	// path	//	path::path()		:		m_new_shape(false)	{		reset(0, 0, 0, 0, 0);	}	path::path(float ax, float ay, int fill0, int fill1, int line)	{		reset(ax, ay, fill0, fill1, line);	}	void	path::reset(float ax, float ay, int fill0, int fill1, int line)	// Reset all our members to the given values, and clear our edge list.	{		m_ax = ax;		m_ay = ay;		m_fill0 = fill0;		m_fill1 = fill1;		m_line = line;		m_edges.resize(0);		assert(is_empty());	}	bool	path::is_empty() const	// Return true if we have no edges.	{		return m_edges.size() == 0;	}	bool	path::point_test(float x, float y)	// Point-in-shape test.  Return true if the query point is on the filled	// interior of this shape.	{		if (m_edges.size() <= 0)		{			return false;		}		if (m_fill0 < 0)		{			// No interior fill.						// @@ This isn't quite right due to some paths			// doing double-duty with both fill0 and fill1			// styles.			// TODO: get rid of this stupid fill0/fill1			// business -- a path should always be			// counterclockwise and have one fill.  For			// input paths with fill1, generate a separate			// reversed path with fill set to fill1.			// Group all paths with the same fill into a			// path group; do the point_test on the whole			// group.			return false;		}		// Shoot a horizontal ray from (x,y) to the right, and		// count the number of edge crossings.  An even number		// of crossings means the point is outside; an odd		// number means it's inside.		float x0 = m_ax;		float y0 = m_ay;		int ray_crossings = 0;		for (int i = 0, n = m_edges.size(); i < n; i++)		{			const edge& e = m_edges[i];			float x1 = e.m_ax;			float y1 = e.m_ay;			if (e.is_straight()) {				// Straight-line case.								// See if (x0,y0)-(x1,y1) crosses (x,y)-(infinity,y)							// Does the segment straddle the horizontal ray?				bool cross_up = (y0 < y && y1 >= y);				bool cross_down = (!cross_up) && (y0 > y && y1 <= y);				if (cross_up || cross_down)				{					// Straddles.									// Is the crossing point to the right of x?					float dy = y1 - y0;					// x_intercept = x0 + (x1 - x0) * (y - y0) / dy;					float x_intercept_times_dy = x0 * dy + (x1 - x0) * (y - y0);					float x_times_dy = x * dy;					// text x_intercept > x									// factor out the division; two cases depending on sign of dy					if (cross_up)					{						assert(dy > 0);						if (x_intercept_times_dy > x * dy)						{							ray_crossings++;						}					}					else					{						// dy is negative; reverse the inequality test						assert(dy < 0);						if (x_intercept_times_dy < x * dy)						{							ray_crossings++;						}					}				}			}			else			{				// Curve case.				float cx = e.m_cx;				float cy = e.m_cy;				// Find whether & where the curve crosses y				if ((y0 < y && y1 < y && cy < y)				    || (y0 > y && y1 > y && cy > y))				{					// All above or all below -- no possibility of crossing.				}				else if (x0 < x && x1 < x && cx < x)				{					// All to the left -- no possibility of crossing to the right.				}				else				{					// Find points where the curve crosses y.					// Quadratic bezier is:					//					// p = (1-t)^2 * a0 + 2t(1-t) * c + t^2 * a1					//					// We need to solve for x at y.										// Use the quadratic formula.					// Numerical Recipes suggests this variation:					// q = -0.5 [b +sgn(b) sqrt(b^2 - 4ac)]					// x1 = q/a;  x2 = c/q;					float A = y1 + y0 - 2 * cy;					float B = 2 * (cy - y0);					float C = y0 - y;					float rad = B * B - 4 * A * C;					if (rad < 0)					{						// No real solutions.					}					else					{						float q;						float sqrt_rad = sqrtf(rad);						if (B < 0) {							q = -0.5f * (B - sqrt_rad);						} else {							q = -0.5f * (B + sqrt_rad);						}						// The old-school way.						// float t0 = (-B + sqrt_rad) / (2 * A);						// float t1 = (-B - sqrt_rad) / (2 * A);						if (A != 0)						{							float t0 = q / A;							if (t0 >= 0 && t0 < 1) {								float x_at_t0 =									x0 + 2 * (cx - x0) * t0 + (x1 + x0 - 2 * cx) * t0 * t0;								if (x_at_t0 > x) {									ray_crossings++;								}							}						}						if (q != 0)						{							float t1 = C / q;							if (t1 >= 0 && t1 < 1) {								float x_at_t1 =									x0 + 2 * (cx - x0) * t1 + (x1 + x0 - 2 * cx) * t1 * t1;								if (x_at_t1 > x) {									ray_crossings++;								}							}						}					}				}			}			x0 = x1;			y0 = y1;		}		if (ray_crossings & 1)		{			// Odd number of ray crossings means the point			// is inside the poly.			return true;		}		return false;	}	void	path::tesselate() const	// Push this path into the tesselator.	{		tesselate::begin_path(			m_fill0 - 1,			m_fill1 - 1,			m_line - 1,			m_ax, m_ay);		for (int i = 0; i < m_edges.size(); i++)		{			m_edges[i].tesselate_curve();		}		tesselate::end_path();	}	// Utility.	void	write_coord_array(tu_file* out, const array<Sint16>& pt_array)	// Dump the given coordinate array into the given stream.	{		int	n = pt_array.size();		out->write_le32(n);		for (int i = 0; i < n; i++)		{			out->write_le16((Uint16) pt_array[i]);		}	}	void	read_coord_array(tu_file* in, array<Sint16>* pt_array)	// Read the coordinate array data from the stream into *pt_array.	{		int	n = in->read_le32();		pt_array->resize(n);		for (int i = 0; i < n; i ++)		{			(*pt_array)[i] = (Sint16) in->read_le16();		}	}	//	// mesh	//		mesh::mesh()	{	}	void	mesh::set_tri_strip(const point pts[], int count)	{		m_triangle_strip.resize(count * 2);	// 2 coords per point				// convert to ints.		for (int i = 0; i < count; i++)		{			m_triangle_strip[i * 2] = Sint16(pts[i].m_x);			m_triangle_strip[i * 2 + 1] = Sint16(pts[i].m_y);		}//		m_triangle_strip.resize(count);//		memcpy(&m_triangle_strip[0], &pts[0], count * sizeof(point));	}	void	mesh::display(const base_fill_style& style, float ratio) const	{		// pass mesh to renderer.		if (m_triangle_strip.size() > 0)		{			style.apply(0, ratio);			render::draw_mesh_strip(&m_triangle_strip[0], m_triangle_strip.size() >> 1);		}	}	void	mesh::output_cached_data(tu_file* out)	// Dump our data to *out.	{		write_coord_array(out, m_triangle_strip);	}		void	mesh::input_cached_data(tu_file* in)	// Slurp our data from *out.	{		read_coord_array(in, &m_triangle_strip);	}	//	// line_strip	//	line_strip::line_strip()	// Default constructor, for array<>.		:		m_style(-1)	{}	line_strip::line_strip(int style, const point coords[], int coord_count)	// Construct the line strip (polyline) made up of the given sequence of points.		:		m_style(style)	{		assert(style >= 0);		assert(coords != NULL);		assert(coord_count > 1);//		m_coords.resize(coord_count);//		memcpy(&m_coords[0], coords, coord_count * sizeof(coords[0]));		m_coords.resize(coord_count * 2);	// 2 coords per vert				// convert to ints.		for (int i = 0; i < coord_count; i++)		{			m_coords[i * 2] = Sint16(coords[i].m_x);			m_coords[i * 2 + 1] = Sint16(coords[i].m_y);		}	}	void	line_strip::display(const base_line_style& style, float ratio) const	// Render this line strip in the given style.	{		assert(m_coords.size() > 1);		assert((m_coords.size() & 1) == 0);		style.apply(ratio);		render::draw_line_strip(&m_coords[0], m_coords.size() >> 1);	}	void	line_strip::output_cached_data(tu_file* out)	// Dump our data to *out.	{		out->write_le32(m_style);		write_coord_array(out, m_coords);	}		void	line_strip::input_cached_data(tu_file* in)	// Slurp our data from *out.	{		m_style = in->read_le32();		read_coord_array(in, &m_coords);	}	// Utility: very simple greedy tri-stripper.  Useful for	// stripping the stacks of trapezoids that come out of our	// tesselator.	struct tri_stripper	{		// A set of strips; we'll join them together into one		// strip during the flush.		array< array<point> >	m_strips;		int	m_last_strip_used;		tri_stripper()			: m_last_strip_used(-1)		{		}		void	add_trapezoid(const point& l0, const point& r0, const point& l1, const point& r1)		// Add two triangles to our strip.		{			// See if we can attach this mini-strip to an existing strip.			if (l0.bitwise_equal(r0) == false)			{				// Check the next strip first; trapezoids will				// tend to arrive in rotating order through				// the active strips.				assert(m_last_strip_used >= -1 && m_last_strip_used < m_strips.size());				int i = m_last_strip_used + 1, n = m_strips.size();				for ( ; i < n; i++)				{					array<point>&	str = m_strips[i];					assert(str.size() >= 3);	// should have at least one tri already.									int	last = str.size() - 1;					if (str[last - 1].bitwise_equal(l0) && str[last].bitwise_equal(r0))					{						// Can join these tris to this strip.						str.push_back(l1);						str.push_back(r1);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产免费成人在线视频| 欧美性欧美巨大黑白大战| 欧美tk丨vk视频| 久久机这里只有精品| 欧美不卡激情三级在线观看| 精品一区二区日韩| 欧美成人福利视频| 成人中文字幕电影| 中文字幕一区二区视频| 在线观看日韩国产| 日韩精品视频网站| 日韩精品中文字幕在线不卡尤物| 美女视频网站久久| 精品福利一二区| 成人一区在线观看| 亚洲一二三四区| 欧美电影免费提供在线观看| 国产精品1区二区.| 亚洲男女毛片无遮挡| 欧美亚洲丝袜传媒另类| 美女在线一区二区| 中文字幕国产一区二区| 成人看片黄a免费看在线| 亚洲国产精品视频| 91精品国产一区二区三区蜜臀| 国产综合成人久久大片91| 国产精品久久三区| 在线播放91灌醉迷j高跟美女| 精品系列免费在线观看| 亚洲欧美在线观看| 欧美一级日韩一级| 91污在线观看| 蜜桃精品在线观看| 亚洲色图在线看| 91精品国产入口| 99热在这里有精品免费| 男女激情视频一区| 亚洲欧美综合网| 日韩视频一区二区三区在线播放| 成人黄色在线网站| 秋霞午夜鲁丝一区二区老狼| 中文字幕一区二区三区av| 8v天堂国产在线一区二区| 成人精品视频一区二区三区| 免费观看成人av| 亚洲视频电影在线| 国产亚洲欧美一级| 欧美一区二区三区视频在线| 色婷婷亚洲精品| 激情久久五月天| 亚洲成a人v欧美综合天堂| 久久精品亚洲麻豆av一区二区| 欧美男生操女生| 色诱视频网站一区| 福利视频网站一区二区三区| 蜜桃久久精品一区二区| 亚洲午夜免费电影| 亚洲婷婷在线视频| 国产午夜精品久久久久久免费视| 在线综合视频播放| 在线看国产一区| 99精品视频一区二区| 成人一区二区视频| 国产精品99久| 国产精品白丝av| 国产另类ts人妖一区二区| 久久av老司机精品网站导航| 亚洲bt欧美bt精品| 亚洲123区在线观看| 亚洲国产日产av| 亚洲综合成人网| 一区二区三区国产豹纹内裤在线 | 国产美女在线观看一区| 香蕉影视欧美成人| 亚洲电影在线免费观看| 亚洲午夜久久久久久久久电影网 | 欧美极品另类videosde| 久久婷婷国产综合国色天香| 精品国产免费久久| 精品国产一区a| 2017欧美狠狠色| 久久蜜桃av一区精品变态类天堂| 日韩免费视频一区二区| 欧美精品一区二| 久久日一线二线三线suv| 久久久亚洲综合| 日本一区二区免费在线观看视频| 久久精品欧美一区二区三区不卡 | 欧美一三区三区四区免费在线看| 欧美一区二区视频免费观看| 日韩一区二区三区在线观看| 日韩一级成人av| 欧美人妖巨大在线| 欧美一区二区三区白人| 欧美sm美女调教| 久久九九99视频| 亚洲同性gay激情无套| 一区二区三区在线播| 丝袜a∨在线一区二区三区不卡| 日韩国产在线一| 久久成人久久爱| 国产成人免费xxxxxxxx| 99热精品一区二区| 欧美美女一区二区三区| 日韩欧美一二区| 国产调教视频一区| 洋洋成人永久网站入口| 奇米888四色在线精品| 国产高清不卡一区二区| 欧美午夜不卡在线观看免费| 日韩欧美你懂的| 中文字幕日本乱码精品影院| 亚洲高清免费一级二级三级| 蜜桃精品视频在线| 成人手机电影网| 欧美在线|欧美| 精品久久一区二区| 亚洲欧美电影院| 蜜臀av在线播放一区二区三区| 国产经典欧美精品| 欧美综合一区二区三区| 精品免费国产二区三区| 一区二区三区在线不卡| 国产精品综合在线视频| 91福利国产精品| 亚洲精品一区二区三区影院| 伊人夜夜躁av伊人久久| 国内精品写真在线观看| 在线一区二区三区四区五区| 337p粉嫩大胆噜噜噜噜噜91av| 成人欧美一区二区三区| 国产一区二区中文字幕| 欧美人伦禁忌dvd放荡欲情| 国产欧美一区二区三区网站| 午夜精品久久久久久久蜜桃app| 成人福利视频网站| 91精品在线免费| 亚洲美女视频一区| 高清国产一区二区| 51精品视频一区二区三区| 中文字幕亚洲区| 国产一区福利在线| 在线不卡免费欧美| 一区二区三区.www| 国产成人av电影在线| 日韩欧美的一区| 午夜天堂影视香蕉久久| 91小宝寻花一区二区三区| 国产精品午夜春色av| 久久黄色级2电影| 欧美日韩国产另类不卡| 亚洲精品国产品国语在线app| 顶级嫩模精品视频在线看| 精品欧美一区二区在线观看| 日日夜夜精品视频天天综合网| 色婷婷精品久久二区二区蜜臀av| 国产精品久久久久久久久搜平片 | 欧美午夜精品久久久| 亚洲欧美视频一区| 99免费精品视频| 欧美国产激情二区三区| 国产精品自拍毛片| 欧美va日韩va| 激情av综合网| 久久嫩草精品久久久精品| 韩国一区二区视频| 欧美精品免费视频| 亚洲成人av福利| 51久久夜色精品国产麻豆| 婷婷综合另类小说色区| 欧美日韩午夜精品| 亚洲va欧美va国产va天堂影院| 欧美性做爰猛烈叫床潮| 一区二区三区视频在线看| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 1区2区3区精品视频| 成人动漫一区二区在线| ㊣最新国产の精品bt伙计久久| 99re66热这里只有精品3直播| 中文字幕一区二| 在线免费观看一区| 天天做天天摸天天爽国产一区 | 久久精品在线免费观看| 成人免费看黄yyy456| 亚洲日本电影在线| 欧美唯美清纯偷拍| 久国产精品韩国三级视频| 久久噜噜亚洲综合| 99在线视频精品| 一区二区理论电影在线观看| 欧美群妇大交群中文字幕| 热久久国产精品| 国产网红主播福利一区二区| 91美女视频网站| 日精品一区二区三区| 久久精品欧美一区二区三区麻豆| 色综合天天视频在线观看 | 麻豆精品视频在线观看| 国产日本欧洲亚洲| 日本国产一区二区|