summaryrefslogtreecommitdiff
path: root/layer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layer.cpp')
-rw-r--r--layer.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/layer.cpp b/layer.cpp
index d6c225b..5d3a4c0 100644
--- a/layer.cpp
+++ b/layer.cpp
@@ -21,21 +21,17 @@ FindSelectedLayerIndex(project_data *File, int16 NumberOfSelectedLayers)
static transform_info
CalculateTransforms(project_layer *Layer, comp_buffer *CompBuffer);
-static bool32
-TestPointInLayer(project_layer *Layer, comp_buffer *CompBuffer, v2 UV)
+static v2
+CompUVToLayerUV(project_layer *Layer, comp_buffer *CompBuffer, v2 CompUV)
{
- bool32 Result = false;
- real32 X = UV.x*CompBuffer->Width;
- real32 Y = UV.y*CompBuffer->Height;
+ real32 X = CompUV.x*CompBuffer->Width;
+ real32 Y = CompUV.y*CompBuffer->Height;
transform_info T = CalculateTransforms(Layer, CompBuffer);
real32 StartVectorX = X - T.OriginX;
real32 StartVectorY = Y - T.OriginY;
real32 LayerU = (StartVectorX * T.XAxisPX) + (StartVectorY * T.XAxisPY);
real32 LayerV = (StartVectorX * T.YAxisPX) + (StartVectorY * T.YAxisPY);
- if (LayerU <= 1.0f && LayerU >= 0.0f && LayerV <= 1.0f && LayerV >= 0.0f) {
- Result = true;
- }
- return Result;
+ return V2(LayerU, LayerV);
}
static void