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