亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日本在线观看不卡视频| 亚洲风情在线资源站| 色88888久久久久久影院按摩| 亚洲日本va午夜在线电影| 欧美午夜影院一区| 老司机一区二区| 国产精品进线69影院| 欧美日韩国产综合一区二区 | 精品国产一区二区三区四区四| 成人性视频免费网站| 亚洲一区二区三区自拍| www激情久久| 欧美日韩国产在线观看| 日本强好片久久久久久aaa| 精品日韩一区二区三区| 在线观看视频一区二区| 国产呦萝稀缺另类资源| 亚洲国产成人91porn| 国产日韩欧美激情| 欧美欧美欧美欧美首页| av一二三不卡影片| 久久www免费人成看片高清| 亚洲激情在线激情| 久久噜噜亚洲综合| 欧美日韩1区2区| 99国产精品久久久久久久久久| 狂野欧美性猛交blacked| 亚洲精品视频在线观看免费 | 精品视频1区2区3区| 国产成人精品免费视频网站| 日韩极品在线观看| 亚洲一区二区欧美| 国产精品免费aⅴ片在线观看| 日韩欧美一区在线| 色av成人天堂桃色av| 成人看片黄a免费看在线| 极品尤物av久久免费看| 天天综合色天天综合| 亚洲女人****多毛耸耸8| 国产午夜精品福利| 精品国产伦一区二区三区观看方式| 欧美在线观看视频一区二区| eeuss国产一区二区三区| 国产精品一区二区久久不卡 | 7777精品伊人久久久大香线蕉经典版下载 | 在线视频你懂得一区| 国产aⅴ精品一区二区三区色成熟| 日韩国产欧美视频| 亚洲国产精品久久人人爱蜜臀 | 成人午夜短视频| 国产综合久久久久影院| 老鸭窝一区二区久久精品| 日韩高清不卡一区二区三区| 亚洲成人一区二区| 亚洲成人av电影在线| 亚洲成人av在线电影| 中文字幕一区二区三区四区| 久久久美女艺术照精彩视频福利播放| 日韩一区二区不卡| 精品美女被调教视频大全网站| 欧美久久久久久久久| 777奇米四色成人影色区| 欧美一区二区三区免费视频| 欧美精品第1页| 欧美精品在欧美一区二区少妇| 欧美日韩视频在线观看一区二区三区 | 成人高清在线视频| 成人免费黄色大片| www.欧美色图| 在线免费观看日韩欧美| 91在线观看地址| 成人手机电影网| 不卡视频免费播放| 色狠狠一区二区| 精品视频在线看| 日韩欧美激情在线| 久久先锋影音av鲁色资源网| 久久蜜臀中文字幕| 亚洲天堂2014| 国产精品成人一区二区艾草| 中文字幕一区二区三区在线不卡| 亚洲色图.com| 丝袜亚洲另类丝袜在线| 国产真实乱偷精品视频免| 国产精品中文字幕日韩精品| 成人app软件下载大全免费| 欧美亚洲高清一区| 制服.丝袜.亚洲.另类.中文| 久久久久国色av免费看影院| 国产精品美女视频| 亚洲国产成人av好男人在线观看| 美女视频第一区二区三区免费观看网站| 韩日精品视频一区| 91蝌蚪porny九色| 欧美一区二区在线视频| 国产欧美日本一区二区三区| 亚洲精品高清视频在线观看| 久久er精品视频| 97se亚洲国产综合在线| 在线成人av影院| 国产精品情趣视频| 亚洲天堂2014| 日本vs亚洲vs韩国一区三区二区| 国产91在线观看| 欧美伦理视频网站| 日本一区二区在线不卡| 天天综合日日夜夜精品| 成人免费黄色大片| 日韩亚洲欧美一区二区三区| 欧美激情在线看| 图片区日韩欧美亚洲| 成人国产精品免费网站| 日韩精品一区二| 亚洲成人综合视频| 99久久精品99国产精品| 久久新电视剧免费观看| 午夜精品福利视频网站| av在线不卡免费看| 欧美精品精品一区| 中文字幕一区不卡| 久久97超碰国产精品超碰| 欧美三级视频在线播放| 国产精品高潮久久久久无| 麻豆成人综合网| 欧美性受xxxx黑人xyx| 国产精品色婷婷久久58| 麻豆一区二区99久久久久| 欧美中文字幕久久| 亚洲三级免费电影| 国产+成+人+亚洲欧洲自线| 欧美大片在线观看一区| 亚洲v中文字幕| 色悠悠亚洲一区二区| 久久久99精品免费观看不卡| 久久精品国产亚洲a| 欧美一区二区三区视频在线观看 | 久久免费看少妇高潮| 激情成人综合网| 亚洲精品在线三区| 国产乱码精品1区2区3区| 久久久影院官网| 国产不卡视频在线观看| 日本一二三四高清不卡| 99精品视频在线观看| 亚洲美女在线一区| 欧美日韩不卡一区二区| 毛片不卡一区二区| 久久精品在线免费观看| av激情成人网| 亚洲大片在线观看| 日韩三级在线免费观看| 国产成人亚洲综合a∨猫咪| 国产精品免费久久| 欧美日韩在线亚洲一区蜜芽| 日韩黄色在线观看| 久久精品欧美日韩精品| 99久久er热在这里只有精品66| 亚洲在线视频网站| 日韩亚洲欧美高清| 成人精品一区二区三区四区| 亚洲一区二区三区小说| 欧美一卡二卡在线观看| 福利一区在线观看| 一区二区在线免费观看| 欧美变态凌虐bdsm| zzijzzij亚洲日本少妇熟睡| 亚洲午夜一区二区| 久久蜜桃av一区二区天堂 | 成人av网站在线观看| 亚洲一区视频在线| 精品国产一区二区三区久久影院| 丰满少妇在线播放bd日韩电影| 亚洲精品第1页| 精品国产一区二区在线观看| 一本一本久久a久久精品综合麻豆| 日本网站在线观看一区二区三区 | 精品少妇一区二区三区在线视频| 国产iv一区二区三区| 婷婷国产在线综合| 国产精品欧美精品| 欧美一区二区三区在线观看| 91在线观看污| 经典三级一区二区| 亚洲成精国产精品女| 国产女人18水真多18精品一级做| 欧美日韩精品系列| 成人高清免费在线播放| 麻豆一区二区三区| 亚洲国产欧美日韩另类综合| 欧美国产一区二区| 欧美一区二区三区在| 91国产成人在线| 成人av在线观| 国产一区二区免费视频| 午夜欧美在线一二页| 亚洲精品福利视频网站| 国产精品视频免费| 337p日本欧洲亚洲大胆色噜噜| 欧美日产国产精品| 91黄视频在线|