本文整理汇总了C++中FVector2D::ClampAxes方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector2D::ClampAxes方法的具体用法?C++ FVector2D::ClampAxes怎么用?C++ FVector2D::ClampAxes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FVector2D
的用法示例。
在下文中一共展示了FVector2D::ClampAxes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetViewportSize
void FWebBrowserWindow::SetViewportSize(FVector2D WindowSize)
{
// Magic number for texture size, can't access GetMax2DTextureDimension easily
FIntPoint ClampedWindowSize = WindowSize.ClampAxes(1, 2048).IntPoint();
if (ViewportSize != ClampedWindowSize)
{
FIntPoint OldViewportSize = MoveTemp(ViewportSize);
TArray<uint8> OldTextureData = MoveTemp(TextureData);
ViewportSize = ClampedWindowSize;
TextureData.SetNumZeroed(ViewportSize.X * ViewportSize.Y * 4);
// copy row by row to avoid texture distortion
const int32 WriteWidth = FMath::Min(OldViewportSize.X, ViewportSize.X) * 4;
const int32 WriteHeight = FMath::Min(OldViewportSize.Y, ViewportSize.Y);
for (int32 RowIndex = 0; RowIndex < WriteHeight; ++RowIndex)
{
FMemory::Memcpy(TextureData.GetData() + ViewportSize.X * RowIndex * 4, OldTextureData.GetData() + OldViewportSize.X * RowIndex * 4, WriteWidth);
}
if (UpdatableTexture != nullptr)
{
UpdatableTexture->ResizeTexture(ViewportSize.X, ViewportSize.Y);
UpdatableTexture->UpdateTexture(TextureData);
}
if (IsValid())
{
InternalCefBrowser->GetHost()->WasResized();
}
}
}