Kaydet (Commit) 8ae07737 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Use 32bpp bitmaps on Android (and iOS)

Modify DocumentLoader correspondingly. Take Android bug 32588 into
account.

Ideal would be to extend the XDevice stuff, or something, so that one
could hand it a pre-allocated RGBA buffer into which the
drawing/rendering would go. Then one could get rid of the silly
convert-to-BMP phase, which prefixes the bitmap data with BMP and DIB
headers (and thus, I guess, has to copy and allocate another
copy). Will see.

Change-Id: I4597cd933db8faa8105dc8f19638d712d5d2238a
üst 92f23297
......@@ -116,6 +116,8 @@ public class Bootstrap extends NativeActivity
// documentation sucks.
public static native void twiddle_BGR_to_RGBA(byte[] source, int offset, int width, int height, ByteBuffer destination);
public static native void force_full_alpha(byte[] source, int offset, int size);
// This setup() method is called 1) in apps that use *this* class as their activity from onCreate(),
// and 2) should be called from other kinds of LO code using apps.
public static void setup(Activity activity)
......
......@@ -262,8 +262,10 @@ uninstall:
$(ANDROID_SDK_HOME)/platform-tools/adb uninstall $(APP_PACKAGE)
run:
# /data/local/tmp/sample-document.odt
adb shell am start -n org.libreoffice.android.examples/.DocumentLoader -e input /assets/test1.odt
clean: properties
$(ANT) clean
rm -rf assets libs $(SODEST) $(OBJLOCAL)
......@@ -1905,6 +1905,29 @@ Java_org_libreoffice_android_Bootstrap_twiddle_1BGR_1to_1RGBA(JNIEnv* env,
(*env)->ReleasePrimitiveArrayCritical(env, source, a, 0);
}
__attribute__ ((visibility("default")))
void
Java_org_libreoffice_android_Bootstrap_force_1full_1alpha(JNIEnv* env,
jobject clazz,
jbyteArray array,
jint offset,
jint size)
{
void *a = (*env)->GetPrimitiveArrayCritical(env, array, NULL);
jbyte *p = ((jbyte *) a) + offset;
int i;
(void) clazz;
for (i = 0; i < size; i += 4) {
p[3] = 0xFF;
p += 4;
}
(*env)->ReleasePrimitiveArrayCritical(env, array, a, 0);
}
__attribute__ ((visibility("default")))
JavaVM *
lo_get_javavm(void)
......
......@@ -702,7 +702,7 @@ public:
sal_uLong nSalFrameStyle,
SystemParentData *pSysParent )
: SvpSalFrame( pInstance, pParent, nSalFrameStyle,
true, basebmp::Format::TWENTYFOUR_BIT_TC_MASK,
true, basebmp::Format::THIRTYTWO_BIT_TC_MASK, // FIXME: Or THIRTYTWO_BIT_TC_MASK_ARGB?
pSysParent )
{
enableDamageTracker();
......
......@@ -59,6 +59,7 @@ bool SvpSalBitmap::Create( const Size& rSize,
case 16: nFormat = Format::SIXTEEN_BIT_LSB_TC_MASK; break;
#endif
case 24: nFormat = Format::TWENTYFOUR_BIT_TC_MASK; break;
// FIXME: Should this for Android be THIRTYTWO_BIT_TC_MASK_ARGB?
case 32: nFormat = Format::THIRTYTWO_BIT_TC_MASK; break;
}
B2IVector aSize( rSize.Width(), rSize.Height() );
......
......@@ -92,7 +92,12 @@ SvpSalFrame::SvpSalFrame( SvpSalInstance* pInstance,
m_aSystemChildData.nSize = sizeof( SystemChildData );
#if defined( UNX ) // FIXME: prolly redundant
m_aSystemChildData.pSalFrame = this;
#if defined(ANDROID) || defined(IOS)
// We want 32-bit RGBA bitmaps
m_aSystemChildData.nDepth = 32;
#else
m_aSystemChildData.nDepth = 24;
#endif
#endif
if( m_pParent )
......
......@@ -80,9 +80,13 @@ sal_Bool SvpSalVirtualDevice::SetSize( long nNewDX, long nNewDY )
#else
case 16: nFormat = Format::SIXTEEN_BIT_LSB_TC_MASK; break;
#endif
case 0:
case 24: nFormat = Format::TWENTYFOUR_BIT_TC_MASK; break;
case 32: nFormat = Format::THIRTYTWO_BIT_TC_MASK; break;
#if defined(ANDROID) || defined(IOS)
case 0: nFormat = Format::THIRTYTWO_BIT_TC_MASK; break;
#else
case 0: nFormat = Format::TWENTYFOUR_BIT_TC_MASK; break;
#endif
}
m_aDevice = aDevPal.empty()
? createBitmapDevice( aDevSize, false, nFormat )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment