diff --git a/src/render/gl3shader.h b/src/render/gl3shader.h index 86e87b45..9ac946ff 100644 --- a/src/render/gl3shader.h +++ b/src/render/gl3shader.h @@ -67,7 +67,7 @@ public: class Shader { public: - GLuint program; + GLuint program = 0; void Init(const std::string &vertexRes, const std::string &fragmentRes, @@ -104,7 +104,7 @@ public: Shader lightShader; Shader fillShader; - Shader *selectedShader; + Shader *selectedShader = NULL; void Init(); void Clear(); @@ -152,8 +152,8 @@ public: Shader shader; - const StippleAtlas *atlas; - StipplePattern pattern; + const StippleAtlas *atlas = NULL; + StipplePattern pattern = StipplePattern::CONTINUOUS; void Init(const StippleAtlas *atlas); void Clear(); @@ -192,8 +192,8 @@ public: Shader shader; - const StippleAtlas *atlas; - StipplePattern pattern; + const StippleAtlas *atlas = NULL; + StipplePattern pattern = StipplePattern::CONTINUOUS; void Init(const StippleAtlas *atlas); void Clear(); @@ -242,7 +242,7 @@ public: Shader colShader; Shader pointShader; - Shader *selectedShader; + Shader *selectedShader = NULL; void Init(); void Clear(); diff --git a/src/render/render.h b/src/render/render.h index 07eeca4d..ca838c4a 100644 --- a/src/render/render.h +++ b/src/render/render.h @@ -135,11 +135,10 @@ public: bool Equals(const Fill &other) const; }; - IdList strokes; - IdList fills; - BitmapFont bitmapFont; + IdList strokes = {}; + IdList fills = {}; + BitmapFont bitmapFont = {}; - Canvas() : strokes(), fills(), bitmapFont() {} virtual void Clear(); hStroke GetStroke(const Stroke &stroke); @@ -197,7 +196,7 @@ public: class UiCanvas { public: std::shared_ptr canvas; - bool flip; + bool flip = false; void DrawLine(int x1, int y1, int x2, int y2, RgbaColor color, int width = 1, int zIndex = 0); @@ -216,17 +215,14 @@ public: // A canvas that performs picking against drawn geometry. class ObjectPicker : public Canvas { public: - Camera camera; + Camera camera = {}; // Configuration. - Point2d point; - double selRadius; + Point2d point = {}; + double selRadius = 0.0; // Picking state. - double minDistance; - int maxZIndex; - uint32_t position; - - ObjectPicker() : camera(), point(), selRadius(), - minDistance(), maxZIndex(), position() {} + double minDistance = 0.0; + int maxZIndex = 0; + uint32_t position = 0; const Camera &GetCamera() const override { return camera; } @@ -261,18 +257,17 @@ public: // on the CPU. class SurfaceRenderer : public Canvas { public: - Camera camera; - Lighting lighting; + Camera camera = {}; + Lighting lighting = {}; // Chord tolerance, for converting beziers to pwl. - double chordTolerance; + double chordTolerance = 0.0; // Render lists. handle_map edges; handle_map beziers; - SMesh mesh; + SMesh mesh = {}; // State. - BBox bbox; + BBox bbox = {}; - SurfaceRenderer() : camera(), lighting(), chordTolerance(), mesh(), bbox() {} void Clear() override; // Canvas interface. @@ -323,15 +318,13 @@ public: class CairoRenderer : public SurfaceRenderer { public: - cairo_t *context; + cairo_t *context = NULL; // Renderer configuration. - bool antialias; + bool antialias = false; // Renderer state. struct { hStroke hcs; - } current; - - CairoRenderer() : context(), current() {} + } current = {}; void SelectStroke(hStroke hcs); void MoveTo(Vector p); @@ -353,8 +346,9 @@ public: // An offscreen renderer based on OpenGL framebuffers. class GlOffscreen { public: - unsigned int framebuffer; - unsigned int colorRenderbuffer, depthRenderbuffer; + unsigned int framebuffer = 0; + unsigned int colorRenderbuffer = 0; + unsigned int depthRenderbuffer = 0; std::vector data; bool Render(int width, int height, std::function renderFn);