static off_t PixelIndex(FloatPixMapRef pm, FPMPoint pt)
{
	FPM_INTERNAL_ASSERT(pm != NULL);
	FPM_INTERNAL_ASSERT(PointInRange(pm, pt));
	
	return pm->width * pt.y + pt.x;
}
void FPMSetPixel(FloatPixMapRef pm, FPMPoint pt, FPMColor px)
{
	if (pm != NULL && PointInRange(pm, pt))
	{
		assert(pm->pixels != NULL);
		
		pm->pixels[PixelIndex(pm, pt)] = px;
	}
}
bool FPMPointInRange(FloatPixMapRef pm, FPMPoint pt)
{
	if (pm != NULL)
	{
		return PointInRange(pm, pt);
	}
	else
	{
		return false;
	}
}
FPMColor *FPMGetPixelPointer(FloatPixMapRef pm, FPMPoint pt)
{
	if (pm != NULL && PointInRange(pm, pt))
	{
		assert(pm->pixels != NULL);
		
		return pm->pixels + PixelIndex(pm, pt);
	}
	else
	{
		return NULL;
	}
}
FPMColor FPMGetPixel(FloatPixMapRef pm, FPMPoint pt)
{
	if (pm != NULL && PointInRange(pm, pt))
	{
		assert(pm->pixels != NULL);
		
		return pm->pixels[PixelIndex(pm, pt)];
	}
	else
	{
		return kFPMColorInvalid;
	}
}
void FDebugRenderSceneProxy::DrawDebugLabels(UCanvas* Canvas, APlayerController*)
{
	const FColor OldDrawColor = Canvas->DrawColor;
	const FFontRenderInfo FontRenderInfo = Canvas->CreateFontRenderInfo(true, false);
	const FFontRenderInfo FontRenderInfoWithShadow = Canvas->CreateFontRenderInfo(true, true);

	Canvas->SetDrawColor(FColor::White);

	UFont* RenderFont = GEngine->GetSmallFont();

	const FSceneView* View = Canvas->SceneView;
	for (auto It = Texts.CreateConstIterator(); It; ++It)
	{
		if (PointInView(It->Location, View))
		{
			const FVector ScreenLoc = Canvas->Project(It->Location);
			const FFontRenderInfo& FontInfo = TextWithoutShadowDistance >= 0 ? (PointInRange(It->Location, View, TextWithoutShadowDistance) ? FontRenderInfoWithShadow : FontRenderInfo) : FontRenderInfo;
			Canvas->DrawText(RenderFont, It->Text, ScreenLoc.X, ScreenLoc.Y, 1, 1, FontInfo);
		}
	}

	Canvas->SetDrawColor(OldDrawColor);
}