如何使用Bitma pregionDe codeR $ C $的安卓2.2.2(升级Froyo)C? [英] How can I use BitmapRegionDecoder code in android 2.2.2 (Froyo)?

查看:260
本文介绍了如何使用Bitma pregionDe codeR $ C $的安卓2.2.2(升级Froyo)C?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在读回答不同的问题对SO,其中@RomainGuy评论说,人们可以(请纠正我,如果我从早期版本更高版本的Andr​​oid的释义错误)回港code。具体来说,我感兴趣的背移植$ C $下Bitma pregionDe $ C $从Android版本2.3.3(姜饼)至2.2.2版(升级Froyo)CR。

I was reading an answer to a different question on SO, in which @RomainGuy commented that one could (please correct me if I'm paraphrasing incorrectly) back-port code from later versions of android to earlier versions. Specifically, I am interested in back-porting code for BitmapRegionDecoder from Android version 2.3.3 (Gingerbread) to version 2.2.2 (Froyo).

我会宁愿问的问题更一般地,什么是最好的做法/从Android系统旧版本的更新版本时,背移植code,应避免什么,但是计算器暗示,我的问题可能会被关闭,过于主观。

I would have rather asked the question more generally as what is the best practice / what should be avoided when back-porting code from newer versions of Android to older versions, but stackoverflow hinted that my question might be closed as being too subjective.

也许,如果有足够的兴趣的话题,这个问题可能是蜕变成一个更一般的one..possibly社区维基?

Maybe if there is enough interest in the topic, this question could be "morphed" into a more general one..possibly a community wiki?

在任何情况下,我会AP preciate任何深入了解这是怎么done..whether具体到我的使用情况,或更一般建议。不要在Java类中调用本地方法把问题复杂化(不一定涉及的NDK)?

In any case, I would appreciate any insight into how this is done..whether specific to my use case, or more general advice. Do calls to native methods from within the java class complicate the matter (necessarily involving the NDK)?

如果这确实是可能的(合理)来摘樱桃和后端端口code以这种方式,我想很多人会发现它非常有用知道如何。

If it is indeed possible (and reasonable) to cherry-pick and back-port code in this way, I think many would find it very useful to know how.

推荐答案

由于@hackbod提到 Bitma pregionDe codeR 是基于外部 Skia的库。然而,这可能是一个优势。

As @hackbod mentioned BitmapRegionDecoder is based on external skia library. Yet it's may be a benefit.

让我们来看看原始出处:

Let's examine original source:

  • Bitma pregionDe coder.java 。通常会定义围绕本地方法的包装:

  • BitmapRegionDecoder.java. Mostly defines wrappers around native methods:

private static native Bitmap nativeDecodeRegion(int lbm,
    int start_x, int start_y, int width, int height,
    BitmapFactory.Options options);
private static native int nativeGetWidth(int lbm);
private static native int nativeGetHeight(int lbm);
private static native void nativeClean(int lbm);
// ...multiply nativeNewInstance overloads follow

类不使用任何新的Java API,我们就需要的backport。

Class doesn't use any new Java APIs we'd need to backport.

Bitma pregionDe coder.cpp 。头文件,它包括由那些具present在升级Froyo 除了这两个:

BitmapRegionDecoder.cpp. Header files it includes consist of ones which are present in Froyo except these two:

  • AutoDe codeCancel.h 。它使用的唯一的一行:

  • AutoDecodeCancel.h. The only line it's used in:

AutoDecoderCancel   adc(options, decoder);

本类处理 SkDe codeR 实例的生命周期。这是一小片code,并且很好地后移植。

This class handles SkDecoder instances lifecycle. It's a small piece of code and may be well back-ported.

SkBitma pregionDe coder.h

作为文件名的状态,这是一个核心组成部分。事实上,所有的previous是一种围绕它的包装中。好消息是,我们可能不会需要备份端口,因为它应该有可能采取整体 Skia的库从 Gingerbeard ,并在升级Froyo ,因为它是外部的,不包含任何新的依赖。

As filename states this is a core component. In fact, all previous were a kind of wrappers around it. The good news is that we may not need to back-port it as it should be possible to take a whole skia library from the Gingerbeard and compile it under Froyo as it is external and doesn't contain any new dependencies.

P.S。我其实没有潜入深海,在code所以请纠正我,如果有什么事,我忽视了。

P.S. I didn't actually dive deep in the code so please correct me if there's anything I overlooked.

来源$我们需要的是位于下面的分支库ç$ C 的Froyo发布姜饼-MR4发布

Source code we need is located in following repositories on branches froyo-release and gingerbread-mr4-release:

  • 外部Skia的库库
    • 在头文件在包括/芯包含/图像
    • External skia library repository
      • Header files are in include/core and include/images
      • 在Java的code:图形/爪哇/安卓/图形/ Bitma pregionDe coder.java
      • 在本地code:核心/ JNI /安卓/图形/...
      • Java code: graphics/java/android/graphics/BitmapRegionDecoder.java
      • Native code: core/jni/android/graphics/...

      这篇关于如何使用Bitma pregionDe codeR $ C $的安卓2.2.2(升级Froyo)C?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆