+struct GraphicsDepthCompareOp
+{
+ constexpr explicit GraphicsDepthCompareOp(DepthFunction::Type compareOp)
+ {
+ switch(compareOp)
+ {
+ case DepthFunction::NEVER:
+ op = Graphics::CompareOp::NEVER;
+ break;
+ case DepthFunction::LESS:
+ op = Graphics::CompareOp::LESS;
+ break;
+ case DepthFunction::EQUAL:
+ op = Graphics::CompareOp::EQUAL;
+ break;
+ case DepthFunction::LESS_EQUAL:
+ op = Graphics::CompareOp::LESS_OR_EQUAL;
+ break;
+ case DepthFunction::GREATER:
+ op = Graphics::CompareOp::GREATER;
+ break;
+ case DepthFunction::NOT_EQUAL:
+ op = Graphics::CompareOp::NOT_EQUAL;
+ break;
+ case DepthFunction::GREATER_EQUAL:
+ op = Graphics::CompareOp::GREATER_OR_EQUAL;
+ break;
+ case DepthFunction::ALWAYS:
+ op = Graphics::CompareOp::ALWAYS;
+ break;
+ }
+ }
+ Graphics::CompareOp op{Graphics::CompareOp::NEVER};
+};
+
+struct GraphicsStencilCompareOp
+{
+ constexpr explicit GraphicsStencilCompareOp(StencilFunction::Type compareOp)
+ {
+ switch(compareOp)
+ {
+ case StencilFunction::NEVER:
+ op = Graphics::CompareOp::NEVER;
+ break;
+ case StencilFunction::LESS:
+ op = Graphics::CompareOp::LESS;
+ break;
+ case StencilFunction::EQUAL:
+ op = Graphics::CompareOp::EQUAL;
+ break;
+ case StencilFunction::LESS_EQUAL:
+ op = Graphics::CompareOp::LESS_OR_EQUAL;
+ break;
+ case StencilFunction::GREATER:
+ op = Graphics::CompareOp::GREATER;
+ break;
+ case StencilFunction::NOT_EQUAL:
+ op = Graphics::CompareOp::NOT_EQUAL;
+ break;
+ case StencilFunction::GREATER_EQUAL:
+ op = Graphics::CompareOp::GREATER_OR_EQUAL;
+ break;
+ case StencilFunction::ALWAYS:
+ op = Graphics::CompareOp::ALWAYS;
+ break;
+ }
+ }
+ Graphics::CompareOp op{Graphics::CompareOp::NEVER};
+};
+
+struct GraphicsStencilOp
+{
+ constexpr explicit GraphicsStencilOp(StencilOperation::Type stencilOp)
+ {
+ switch(stencilOp)
+ {
+ case Dali::StencilOperation::KEEP:
+ op = Graphics::StencilOp::KEEP;
+ break;
+ case Dali::StencilOperation::ZERO:
+ op = Graphics::StencilOp::ZERO;
+ break;
+ case Dali::StencilOperation::REPLACE:
+ op = Graphics::StencilOp::REPLACE;
+ break;
+ case Dali::StencilOperation::INCREMENT:
+ op = Graphics::StencilOp::INCREMENT_AND_CLAMP;
+ break;
+ case Dali::StencilOperation::DECREMENT:
+ op = Graphics::StencilOp::DECREMENT_AND_CLAMP;
+ break;
+ case Dali::StencilOperation::INVERT:
+ op = Graphics::StencilOp::INVERT;
+ break;
+ case Dali::StencilOperation::INCREMENT_WRAP:
+ op = Graphics::StencilOp::INCREMENT_AND_WRAP;
+ break;
+ case Dali::StencilOperation::DECREMENT_WRAP:
+ op = Graphics::StencilOp::DECREMENT_AND_WRAP;
+ break;
+ }
+ }
+ Graphics::StencilOp op{Graphics::StencilOp::KEEP};
+};
+
+inline Graphics::Viewport ViewportFromClippingBox(const Uint16Pair& sceneSize, ClippingBox clippingBox, int orientation)
+{
+ Graphics::Viewport viewport{static_cast<float>(clippingBox.x), static_cast<float>(clippingBox.y), static_cast<float>(clippingBox.width), static_cast<float>(clippingBox.height), 0.0f, 0.0f};
+
+ if(orientation == 90 || orientation == 270)
+ {
+ if(orientation == 90)
+ {
+ viewport.x = sceneSize.GetY() - (clippingBox.y + clippingBox.height);
+ viewport.y = clippingBox.x;
+ }
+ else // orientation == 270
+ {
+ viewport.x = clippingBox.y;
+ viewport.y = sceneSize.GetX() - (clippingBox.x + clippingBox.width);
+ }
+ viewport.width = static_cast<float>(clippingBox.height);
+ viewport.height = static_cast<float>(clippingBox.width);
+ }
+ else if(orientation == 180)
+ {
+ viewport.x = sceneSize.GetX() - (clippingBox.x + clippingBox.width);
+ viewport.y = sceneSize.GetY() - (clippingBox.y + clippingBox.height);
+ }
+ return viewport;
+}
+
+inline Graphics::Rect2D RecalculateRect(Graphics::Rect2D rect, int orientation, Graphics::Viewport viewport)
+{
+ Graphics::Rect2D newRect;