Skip to content

Commit

Permalink
[render] remove useless template arguments in Renderer class
Browse files Browse the repository at this point in the history
  • Loading branch information
alemuntoni committed Jan 7, 2025
1 parent cc1755c commit 3266617
Showing 1 changed file with 18 additions and 51 deletions.
69 changes: 18 additions & 51 deletions vclib/render/include/vclib/render/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ class Renderer :
public CanvasT<Renderer<WindowManagerT, CanvasT, Drawers...>>,
public Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>...
{
using WindowManagerType =
WindowManagerT<Renderer<WindowManagerT, CanvasT, Drawers...>>;
using CanvasType = CanvasT<Renderer<WindowManagerT, CanvasT, Drawers...>>;
using WindowManagerType = WindowManagerT<Renderer>;
using CanvasType = CanvasT<Renderer>;

static_assert(
WindowManagerConcept<WindowManagerType>,
Expand All @@ -76,9 +75,7 @@ class Renderer :
"class that satisfies the CanvasConcept.");

static_assert(
(DrawerConcept<
Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>> &&
...),
(DrawerConcept<Drawers<Renderer>> && ...),
"All the Drawer types must satisfy the DrawerConcept.");

KeyModifiers mKeyModifiers = {KeyModifier::NO_MODIFIER};
Expand Down Expand Up @@ -124,7 +121,7 @@ class Renderer :
width * WindowManagerType::dpiScale().x(),
height * WindowManagerType::dpiScale().y(),
WindowManagerType::displayId()),
Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>(
Drawers<Renderer>(
width * WindowManagerType::dpiScale().x(),
height * WindowManagerType::dpiScale().y())...
{
Expand All @@ -137,9 +134,7 @@ class Renderer :
void wmInit()
{
CanvasType::onInit();
(static_cast<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>*>(
this)
->onInit(CanvasType::viewId()),
(static_cast<Drawers<Renderer>*>(this)->onInit(CanvasType::viewId()),
...);
}

Expand All @@ -150,10 +145,7 @@ class Renderer :
// call the onResize member function of each Drawer object.
// NOTE: use static_cast<Drawers*>(this)->function() to call the
// right VIRTUAL function of the Drawer object.
(static_cast<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>*>(
this)
->onResize(width, height),
...);
(static_cast<Drawers<Renderer>*>(this)->onResize(width, height), ...);
}

void wmPaint() { CanvasType::onPaint(); }
Expand All @@ -175,10 +167,7 @@ class Renderer :
}
};

(lambda.template
operator()<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>>(
this),
...);
(lambda.template operator()<Drawers<Renderer>>(this), ...);
}

void wmKeyRelease(Key::Enum key)
Expand All @@ -193,10 +182,7 @@ class Renderer :
}
};

(lambda.template
operator()<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>>(
this),
...);
(lambda.template operator()<Drawers<Renderer>>(this), ...);
}

void wmMouseMove(double x, double y)
Expand All @@ -211,10 +197,7 @@ class Renderer :
}
};

(lambda.template
operator()<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>>(
this),
...);
(lambda.template operator()<Drawers<Renderer>>(this), ...);
}

void wmMousePress(MouseButton::Enum button, double x, double y)
Expand All @@ -229,10 +212,7 @@ class Renderer :
}
};

(lambda.template
operator()<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>>(
this),
...);
(lambda.template operator()<Drawers<Renderer>>(this), ...);
}

void wmMouseRelease(MouseButton::Enum button, double x, double y)
Expand All @@ -247,10 +227,7 @@ class Renderer :
}
};

(lambda.template
operator()<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>>(
this),
...);
(lambda.template operator()<Drawers<Renderer>>(this), ...);
}

void wmMouseDoubleClick(MouseButton::Enum button, double x, double y)
Expand All @@ -267,10 +244,7 @@ class Renderer :
}
};

(lambda.template
operator()<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>>(
this),
...);
(lambda.template operator()<Drawers<Renderer>>(this), ...);
}

void wmMouseScroll(double x, double y)
Expand All @@ -286,10 +260,7 @@ class Renderer :
}
};

(lambda.template
operator()<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>>(
this),
...);
(lambda.template operator()<Drawers<Renderer>>(this), ...);
}

/***** Member functions called by CanvasType *****/
Expand All @@ -300,9 +271,7 @@ class Renderer :
// call the onDraw member function of each Drawer object.
// NOTE: use static_cast<Drawers*>(this)->function() to call the
// right VIRTUAL function of the Drawer object.
(static_cast<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>*>(
this)
->onDraw(CanvasType::viewId()),
(static_cast<Drawers<Renderer>*>(this)->onDraw(CanvasType::viewId()),
...);
}

Expand All @@ -311,9 +280,8 @@ class Renderer :
// call the onDrawContent member function of each Drawer object.
// NOTE: use static_cast<Drawers*>(this)->function() to call the
// right VIRTUAL function of the Drawer object.
(static_cast<Drawers<Renderer<WindowManagerT, CanvasT, Drawers...>>*>(
this)
->onDrawContent(CanvasType::viewId()),
(static_cast<Drawers<Renderer>*>(this)->onDrawContent(
CanvasType::viewId()),
...);
}

Expand Down Expand Up @@ -354,8 +322,7 @@ template<
template<typename> typename... Drawers>
class Renderer<WindowManagerT, CanvasT, Drawers...>::WM
{
using WindowManagerType =
WindowManagerT<Renderer<WindowManagerT, CanvasT, Drawers...>>;
using WindowManagerType = WindowManagerT<Renderer>;

friend WindowManagerType;

Expand Down Expand Up @@ -541,7 +508,7 @@ template<
template<typename> typename... Drawers>
class Renderer<WindowManagerT, CanvasT, Drawers...>::CNV
{
using CanvasType = CanvasT<Renderer<WindowManagerT, CanvasT, Drawers...>>;
using CanvasType = CanvasT<Renderer>;

friend CanvasType;

Expand Down

0 comments on commit 3266617

Please sign in to comment.