Skip to content

Comments

Fix ICairoShim interface: replace volatile with virtual#613

Merged
highperformancecoder merged 3 commits intomasterfrom
copilot/fix-icairoshim-interface
Feb 18, 2026
Merged

Fix ICairoShim interface: replace volatile with virtual#613
highperformancecoder merged 3 commits intomasterfrom
copilot/fix-icairoshim-interface

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

The ICairoShim interface in engine/cairoShim.h incorrectly used volatile instead of virtual for all pure virtual method declarations.

Changes

  • Replaced volatile with virtual for all 23 method declarations
  • Added virtual destructor virtual ~ICairoShim() = default;

Before/After

// Before
class ICairoShim {
public:
  volatile void moveTo(double x, double y)=0;
  volatile void lineTo(double x, double y)=0;
  // ... 21 more volatile methods
};

// After  
class ICairoShim {
public:
  virtual ~ICairoShim() = default;
  virtual void moveTo(double x, double y)=0;
  virtual void lineTo(double x, double y)=0;
  // ... 21 more virtual methods
};

Prerequisite for upcoming Item::draw refactoring work.

Original prompt

Fix ICairoShim Interface: Change volatile to virtual

Objective

Fix the ICairoShim interface in engine/cairoShim.h by changing all volatile keywords to virtual. The interface was incorrectly defined with volatile instead of virtual for pure virtual methods.

File to Update

engine/cairoShim.h (commit 7177383)

Changes Required

  1. Replace all volatile with virtual on lines 20-54 for all pure virtual method declarations
  2. Add a virtual destructor to the interface:
    virtual ~ICairoShim() = default;

Current Code (Incorrect)

class ICairoShim
{
public:
  volatile void moveTo(double x, double y)=0;
  volatile void lineTo(double x, double y)=0;
  // ... all other methods with volatile
};

Expected Code (Correct)

class ICairoShim
{
public:
  virtual ~ICairoShim() = default;
  virtual void moveTo(double x, double y)=0;
  virtual void lineTo(double x, double y)=0;
  virtual void relMoveTo(double x, double y)=0;
  virtual void relLineTo(double x, double y)=0;
  virtual void arc(double x, double y, double radius, double start, double end)=0;

  virtual void setLineWidth(double)=0;

  // paths
  virtual void newPath()=0;
  virtual void closePath()=0;
  virtual void fill()=0;
  virtual void clip()=0;
  virtual void stroke()=0;
  virtual void strokePreserve()=0;

  // sources
  virtual void setSourceRGB(double r, double g, double b)=0;
  virtual void setSourceRGBA(double r, double g, double b, double a)=0;
  
  // text. Argument is in UTF8 encoding
  virtual void showText(const std::string&)=0;
  virtual void setTextExtents(const std::string&)=0;
  virtual double textWidth() const=0;
  virtual double textHeight() const=0;

  // matrix transformation
  virtual void identityMatrix()=0;
  virtual void translate(double x, double y)=0;
  virtual void scale(double sx, double sy)=0;
  virtual void rotate(double angle)=0; ///< angle in radians

  // context manipulation
  virtual void save()=0;
  virtual void restore()=0;
};

Notes

  • This is a prerequisite fix for the main refactoring task
  • All methods should be pure virtual (=0)
  • The interface is in the minsky namespace
  • After this fix, the interface will be ready for use in CairoShimCairo and the Item::draw refactoring

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


This change is Reviewable

Copilot AI and others added 2 commits February 18, 2026 21:46
…destructor

Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ICairoShim interface by changing volatile to virtual Fix ICairoShim interface: replace volatile with virtual Feb 18, 2026
@highperformancecoder highperformancecoder marked this pull request as ready for review February 18, 2026 22:04
Copilot AI review requested due to automatic review settings February 18, 2026 22:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical bug in the ICairoShim interface where all method declarations incorrectly used the volatile keyword instead of virtual. This change corrects the interface definition to properly support polymorphism as intended.

Changes:

  • Replaced volatile with virtual for all 24 pure virtual method declarations in ICairoShim
  • Added a virtual destructor to the interface following C++ best practices
  • Unrelated package-lock.json modifications adding "peer": true flags

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
engine/cairoShim.h Fixed interface by replacing volatile with virtual for all methods and added virtual destructor
package-lock.json Added "peer": true flags to @types/node and typescript dependencies (unrelated to main fix)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@highperformancecoder highperformancecoder merged commit 75b2e19 into master Feb 18, 2026
12 checks passed
@highperformancecoder highperformancecoder deleted the copilot/fix-icairoshim-interface branch February 18, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants