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

OGL: Use unique_ptr instead of pointer when taking screenshot. #1161

Merged
merged 1 commit into from Nov 2, 2014
Merged

OGL: Use unique_ptr instead of pointer when taking screenshot. #1161

merged 1 commit into from Nov 2, 2014

Conversation

rohit-n
Copy link
Member

@rohit-n rohit-n commented Sep 26, 2014

No description provided.

@JMC47
Copy link
Contributor

JMC47 commented Sep 26, 2014

Can you at least say why this change was made? As a user of Dolphin, that matters to me, and I can't tell from the code alone.

bool success = TextureToPng(data, W*4, filename, W, H, false);
delete[] data;
FlipImageData(data.data(), W, H, 4);
bool success = TextureToPng(data.data(), W * 4, filename, W, H, false);

This comment was marked as off-topic.

@lioncash
Copy link
Member

@JMC47 Gets rid of explicit delete usage.

@JMC47
Copy link
Contributor

JMC47 commented Sep 26, 2014

Good enough for me.

@phire
Copy link
Member

phire commented Sep 27, 2014

Would be neater to use a unique_ptr to a u8[] instead of a vector.

@comex
Copy link
Contributor

comex commented Sep 30, 2014

Using a vector zeroes the memory for no reason. I doubt it matters, but don't do that.

@rohit-n
Copy link
Member Author

rohit-n commented Sep 30, 2014

I don't understand. Should the memory not be zero?
EDIT: Or, I assume the overhead in zeroing the memory should be avoided?

@lioncash
Copy link
Member

FWIW, I think this is fine with just a vector.

@comex
Copy link
Contributor

comex commented Oct 7, 2014

@rohit-n Yes, the latter.

@skidau
Copy link
Contributor

skidau commented Oct 29, 2014

@rohit-n would you please change this to a unique_ptr ?

@rohit-n
Copy link
Member Author

rohit-n commented Oct 29, 2014

@skidau I'll try this in the morning.

@rohit-n rohit-n changed the title OGL: Use vector instead of pointer when taking screenshot. OGL: Use unique_ptr instead of pointer when taking screenshot. Oct 30, 2014
@skidau
Copy link
Contributor

skidau commented Oct 30, 2014

@rohit-n would you please rebase on master?

@SizzlingCalamari
Copy link
Contributor

@rohit-n The pointer type needs to be

unique_ptr<u8[]>

not

unique_ptr<u8>

:)

@RisingFog
Copy link
Member

@SizzlingCalamari Welcome to Dolphin Sizzling :P

@SizzlingCalamari
Copy link
Contributor

@RisingFog Oh, Fog, small world huh? 🍕

skidau added a commit that referenced this pull request Nov 2, 2014
OGL: Use unique_ptr instead of pointer when taking screenshot.
@skidau skidau merged commit 59c673a into dolphin-emu:master Nov 2, 2014
@rohit-n rohit-n deleted the ogl-vector branch November 5, 2014 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
8 participants