Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1077: PdfPrinterGraphics2D does not override create #1093

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

mperktold
Copy link
Contributor

@mperktold mperktold commented Mar 5, 2024

Description of the new Feature/Bugfix

Override create() in PdfPrinterGraphics2D.
Introduces a copy constructor and a protected createChild method for this purpose. The createChild method only creates the new copy using the copy constructor, whereas create calls createChild and then adds the new copy to its kids before returning it.

This is just one of many possible designs. For example, a copyFrom (or copyTo) method could be used instead of a copy constructor, or we could delegate to the clone mechanism. Also, it would have been possible to add the kid directly in the copy constructor, so the createChild method would not be needed. However, I didn't like the idea of mutating the parameter of the copy constructor.

So in the end I chose this design because I think it this is the cleanest option, but of course it's up to you to change anything.

Related Issue: #1077

Unit-Tests for the new Feature/Bugfix

  • Unit-Tests added to reproduce the bug
  • Unit-Tests added to the added feature

Copy link

sonarqubecloud bot commented Mar 5, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@asturio asturio linked an issue Mar 5, 2024 that may be closed by this pull request
@asturio asturio merged commit a9cd4f1 into LibrePDF:master Mar 5, 2024
7 of 8 checks passed
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.

PdfPrinterGraphics2D does not override create
2 participants