Skip to content

Commit

Permalink
Fix MapSnapshotter icon loading (#2967)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zverik authored Oct 29, 2024
1 parent e95e0e1 commit 75ed159
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
/platform/android/MapLibreAndroidTestApp/.cxx
/platform/android/MapLibreAndroidTestApp/build
/platform/android/.gradle
/platform/android/buildSrc/.gradle
/platform/android/buildSrc/build
/platform/android/x86
/platform/android/x86_64
/cmake-build-debug
Expand Down Expand Up @@ -58,3 +60,5 @@ cache.sqlite-journal
out.png
/test/android/app/.cxx
/test/android/app/build
/test/android/local.properties
/render-test/android/local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.widget.TextView
import androidx.annotation.Keep
import androidx.annotation.UiThread
import androidx.core.content.res.ResourcesCompat
import androidx.core.graphics.drawable.toBitmap
import org.maplibre.android.R
import org.maplibre.android.attribution.AttributionLayout
import org.maplibre.android.attribution.AttributionMeasure
Expand Down Expand Up @@ -568,7 +569,7 @@ open class MapSnapshotter(context: Context, options: Options) {
* @return the scaled large logo
*/
private fun createScaledLogo(snapshot: Bitmap): Logo {
val logo = BitmapFactory.decodeResource(context.resources, R.drawable.maplibre_logo_icon, null)
val logo = context.resources.getDrawable(R.drawable.maplibre_logo_icon, null)?.toBitmap()!!
val scale = calculateLogoScale(snapshot, logo)
val matrix = Matrix()
matrix.postScale(scale, scale)
Expand Down

0 comments on commit 75ed159

Please sign in to comment.