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

Android: Replace libpng/libjpeg-turbo/libwebp with BitmapFactory - #7329

Closed
kkaefer wants to merge 1 commit into
masterfrom
7329-android-image-decoding
Closed

kkaefer wants to merge 1 commit into
masterfrom
7329-android-image-decoding

Conversation

@kkaefer

@kkaefer kkaefer commented Dec 12, 2016 •

Copy link
Copy Markdown
Member

In #2354, we captured that we want to replace these libs with a Java-based version. Here's how this will work:

  • Refactor util::Image to hide its implementation, in particular the data member
  • When compiling for Android, add an additional constructor that takes JNIEnv *env, jobject jbitmap, and then uses libjnigraphics to expose the bitmap information, and handle JNI object lifetime
  • Create an Android-specific implementation of util::decodeImage() that uses the JNI to call BitmapFactory::decodeByteArray for decompressing + premultiplying the image
  • Create an Android-specific version of util::encodePNG() that uses the JNI/Bitmap/BitmapFactory to create a Java Bitmap + compress it to PNG

/cc @mapbox/android

@kkaefer kkaefer added the Android Mapbox Maps SDK for Android label Dec 7, 2016
don't allow direct access to internal data pointer in preparation for integration with Android's managed Bitmap object
@mention-bot

Copy link
Copy Markdown

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

@kkaefer kkaefer added the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Dec 12, 2016
std::equal(data.get(), data.get() + bytes(), rhs.data.get(),
rhs.data.get() + rhs.bytes());
}
uint8_t* data() const { return blob_.get(); }

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.

Should be two methods:

const uint8_t* data() const { return blob_.get(); }
      uint8_t* data()       { return blob_.get(); }

@kkaefer

kkaefer commented Jan 26, 2017

Copy link
Copy Markdown
Member Author

superseded by #7828

@kkaefer kkaefer closed this Jan 26, 2017
@kkaefer
kkaefer deleted the 7329-android-image-decoding branch January 26, 2017 15:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Android Mapbox Maps SDK for Android ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants