Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

macOS: Don't round-trip still images through encoding - #7812

Merged
kkaefer merged 2 commits into
masterfrom
7812-macos-image-encoding
Jan 26, 2017
Merged

kkaefer merged 2 commits into
masterfrom
7812-macos-image-encoding

Conversation

@kkaefer

@kkaefer kkaefer commented Jan 25, 2017

Copy link
Copy Markdown
Member

When calling encodePNG, on the bytes of the textures, only to decompress it in the very next line:

std::string png = encodePNG(_mbglView->readStillImage());
NSData *data = [[NSData alloc] initWithBytes:png.data() length:png.size()];
NSImage *image = [[NSImage alloc] initWithData:data];

Instead, we can just use the data we already have to initialize the NSImage without going through the compression/decompression routine.

@kkaefer

kkaefer commented Jan 23, 2017

Copy link
Copy Markdown
Member Author

Similar uses are on iOS in UIImage+MGLAdditions.mm

@kkaefer kkaefer mentioned this pull request Jan 23, 2017
@kkaefer

kkaefer commented Jan 23, 2017

Copy link
Copy Markdown
Member Author

Related: #7813

@friedbunny friedbunny added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Jan 24, 2017
@mention-bot

Copy link
Copy Markdown

@kkaefer, thanks for your PR! By analyzing this pull request, we identified @1ec5, @jfirebaugh and @boundsj to be potential reviewers.

@kkaefer
kkaefer requested a review from 1ec5 January 25, 2017 16:29

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Love the use of stack-based memory management for the Core Graphics types.

@1ec5

1ec5 commented Jan 25, 2017

Copy link
Copy Markdown
Contributor

Looks like some non-SDK targets need to be updated, though:

▸ Linking mbgl-test

❌  ld: symbol(s) not found for architecture x86_64



❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)


** BUILD FAILED **


The following build commands failed:
	Ld build/macos/Debug/mbgl-test normal x86_64
(1 failure)
make: *** [test] Error 65

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants