minor
This commit is contained in:
		
							parent
							
								
									79fa3d8048
								
							
						
					
					
						commit
						7039d00e61
					
				|  | @ -31,6 +31,7 @@ namespace kiwano | |||
| 		: opacity_(1.f) | ||||
| 		, collecting_status_(false) | ||||
| 		, antialias_(true) | ||||
| 		, fast_global_transform_(true) | ||||
| 		, text_antialias_(TextAntialias::GrayScale) | ||||
| 	{ | ||||
| 		status_.primitives = 0; | ||||
|  | @ -537,7 +538,7 @@ namespace kiwano | |||
| 
 | ||||
| 	Matrix3x2 RenderTarget::GetGlobalTransform() const | ||||
| 	{ | ||||
| 		return global_matrix_; | ||||
| 		return global_transform_; | ||||
| 	} | ||||
| 
 | ||||
| 	void RenderTarget::SetTransform(const Matrix3x2& matrix) | ||||
|  | @ -550,16 +551,37 @@ namespace kiwano | |||
| 
 | ||||
| 		if (SUCCEEDED(hr)) | ||||
| 		{ | ||||
| 			Matrix3x2 result = matrix * global_matrix_; | ||||
| 			if (fast_global_transform_) | ||||
| 			{ | ||||
| 				render_target_->SetTransform(DX::ConvertToMatrix3x2F(&matrix)); | ||||
| 
 | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				Matrix3x2 result = matrix * global_transform_; | ||||
| 				render_target_->SetTransform(DX::ConvertToMatrix3x2F(&result)); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		ThrowIfFailed(hr); | ||||
| 	} | ||||
| 
 | ||||
| 	void RenderTarget::SetGlobalTransform(const Matrix3x2& matrix) | ||||
| 	{ | ||||
| 		global_matrix_ = matrix; | ||||
| 		SetGlobalTransform(&matrix); | ||||
| 	} | ||||
| 
 | ||||
| 	void RenderTarget::SetGlobalTransform(const Matrix3x2* matrix) | ||||
| 	{ | ||||
| 		if (matrix) | ||||
| 		{ | ||||
| 			global_transform_ = *matrix; | ||||
| 			fast_global_transform_ = false; | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
| 			fast_global_transform_ = true; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	void RenderTarget::SetOpacity(Float32 opacity) | ||||
|  | @ -638,9 +660,12 @@ namespace kiwano | |||
| 
 | ||||
| 	bool RenderTarget::CheckVisibility(Rect const& bounds, Matrix3x2 const& transform) | ||||
| 	{ | ||||
| 		return Rect{ Point{}, reinterpret_cast<const Size&>(render_target_->GetSize()) }.Intersects( | ||||
| 			Matrix3x2(transform * global_matrix_).Transform(bounds) | ||||
| 		); | ||||
| 		Rect visible_size = { Point{}, reinterpret_cast<const Size&>(render_target_->GetSize()) }; | ||||
| 		if (fast_global_transform_) | ||||
| 		{ | ||||
| 			return visible_size.Intersects(transform.Transform(bounds)); | ||||
| 		} | ||||
| 		return visible_size.Intersects(Matrix3x2(transform * global_transform_).Transform(bounds)); | ||||
| 	} | ||||
| 
 | ||||
| 	void RenderTarget::SetCollectingStatus(bool collecting) | ||||
|  |  | |||
|  | @ -154,6 +154,10 @@ namespace kiwano | |||
| 			const Matrix3x2& matrix | ||||
| 		); | ||||
| 
 | ||||
| 		void SetGlobalTransform( | ||||
| 			const Matrix3x2* matrix | ||||
| 		); | ||||
| 
 | ||||
| 		// ÉèÖÿ¹¾â³Ýģʽ
 | ||||
| 		void SetAntialiasMode( | ||||
| 			bool enabled | ||||
|  | @ -164,6 +168,7 @@ namespace kiwano | |||
| 			TextAntialias mode | ||||
| 		); | ||||
| 
 | ||||
| 		// 检查边界是否在视区内
 | ||||
| 		bool CheckVisibility( | ||||
| 			Rect const& bounds, | ||||
| 			Matrix3x2 const& transform | ||||
|  | @ -200,6 +205,7 @@ namespace kiwano | |||
| 	protected: | ||||
| 		Float32							opacity_; | ||||
| 		bool							antialias_; | ||||
| 		bool							fast_global_transform_; | ||||
| 		mutable bool					collecting_status_; | ||||
| 		mutable Status					status_; | ||||
| 		TextAntialias					text_antialias_; | ||||
|  | @ -208,7 +214,7 @@ namespace kiwano | |||
| 		ComPtr<ID2D1SolidColorBrush>	default_brush_; | ||||
| 		ComPtr<ID2D1Brush>				current_brush_; | ||||
| 		ComPtr<ID2DDeviceResources>		device_resources_; | ||||
| 		Matrix3x2						global_matrix_; | ||||
| 		Matrix3x2						global_transform_; | ||||
| 	}; | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -732,7 +732,7 @@ namespace kiwano | |||
| 		{ | ||||
| 		case ResolutionMode::Fixed: | ||||
| 		{ | ||||
| 			SetGlobalTransform(Matrix3x2{}); | ||||
| 			SetGlobalTransform(nullptr); | ||||
| 			break; | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -470,7 +470,7 @@ namespace kiwano | |||
| 			font.italic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL, | ||||
| 			DWRITE_FONT_STRETCH_NORMAL, | ||||
| 			font.size, | ||||
| 			L"en-us", | ||||
| 			L"", | ||||
| 			&output | ||||
| 		); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue