Skip to content

Add View::Copy and Frame::Copy returning by value#349

Merged
ermig1979 merged 2 commits into
ermig1979:devfrom
Centimo:feature/view-frame-copy-by-value
May 20, 2026
Merged

Add View::Copy and Frame::Copy returning by value#349
ermig1979 merged 2 commits into
ermig1979:devfrom
Centimo:feature/view-frame-copy-by-value

Conversation

@Centimo
Copy link
Copy Markdown
Contributor

@Centimo Centimo commented May 18, 2026

Summary

Add Copy() overloads to View and Frame that return a new object by value, alongside the existing Clone() methods which return raw pointers the caller must delete.

Details

View::Clone() and Frame::Clone() return View* / Frame*, leaving ownership to the caller. This patch adds value-returning counterparts:

  • View<A> View<A>::Copy() const
  • View<A> View<A>::Copy(const Rectangle<ptrdiff_t>& rect) const
  • Frame<A> Frame<A>::Copy() const
  • Frame<A> Frame<A>::Copy(const Rectangle<ptrdiff_t>& rect) const

Implementation mirrors the existing Clone(): View::Copy() does row-wise memcpy into a freshly constructed View; Frame::Copy() constructs a new Frame and delegates to the global Simd::Copy(src, dst). The region overloads forward to Region(rect).Copy().

No changes to existing API.

Centimo added 2 commits May 18, 2026 03:39
Add new Copy() overloads (no args and with Rectangle) returning a new
View/Frame by value, alongside the existing pointer-returning Clone().
@ermig1979 ermig1979 merged commit f4bbcb8 into ermig1979:dev May 20, 2026
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