MCPcopy Create free account
hub / github.com/AshampooSystems/boden / sizeForSpace

Method sizeForSpace

framework/ui/platforms/android/src/ImageViewCore.cpp:24–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 void ImageViewCore::imageLoaded(int width, int height) { _imageSize = Size{(double)width, (double)height}; }
23
24 Size ImageViewCore::sizeForSpace(Size availableSpace) const
25 {
26 Size result = _imageSize;
27
28 if (availableSpace.width > availableSpace.height) {
29 float factor = result.width / result.height;
30 result.width = availableSpace.height * factor;
31 result.height = availableSpace.height;
32 } else {
33 float factor = result.height / result.width;
34 result.width = availableSpace.width;
35 result.height = availableSpace.width * factor;
36 }
37 return result;
38 }
39}
40
41extern "C" JNIEXPORT void JNICALL Java_io_boden_android_NativeImageView_native_1imageLoaded(JNIEnv *env,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected