History log of /frameworks/base/core/jni/android/graphics/Movie.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6ba30b85ddfbe37c338ee8dde3dd33322eb38d47 15-Jul-2014 Behdad Esfahbod <behdad@google.com> Add android.Paint that inherits SkPaint

The idea is that extra paint parameters that only affect text layout
(not rendering) will go in android.Paint instead of going into
SkPaintOptionsAndroid. We will eventually move those out of SkPaint
too.

This is currently implemented in PaintImpl.cpp. Will be renamed when
current Paint.cpp that has JNI bits is moved to android_graphics_Paint.cpp.

Change-Id: Iba66c34dea5da503a13b9c864cb9f2211ac4ba7d
/frameworks/base/core/jni/android/graphics/Movie.cpp
2e0103eb340822f9d580c1aa8492bae8394b8243 04-Apr-2014 Leon Scroggins III <scroggo@google.com> Remove SkFloatToScalar.

Now that SkScalar is always float (it may someday be double, but
float to double is trivial), remove callers of SkFloatToScalar,
which is deprecated in Skia.

BUG:13694396

Change-Id: I524a9bb6f7702bc810bac55fb9d2cd5361a01cf7
/frameworks/base/core/jni/android/graphics/Movie.cpp
6606d16e097480e061546306cc95a729f5dccae8 16-Jan-2014 Narayan Kamath <narayan@google.com> am 6706888e: am 775667c0: am 03e8be75: am 8796ab7f: am bb35356d: Merge changes Id54087dd,I946325e4,I2a2b2e68

* commit '6706888e24aee04c2c914c44e5ef5b1510cf8013':
AArch64: Use long for pointers in BitmapRegionDecoder
AArch64: Use long for pointers in Movie class
AArch64: Add AssetInputStream.getNativeAsset
dcaf5593ddbfe8e1cacaf07813b1e827ba4dba8c 08-Jan-2014 Ashok Bhat <ashok.bhat@arm.com> AArch64: Use long for pointers in Movie class

For storing pointers, long is used in Movie class,
as native pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use
of jint instead of int in JNI function prototypes)

Change-Id: I946325e4af6cb9282012bebdaee89e1117d8797b
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
/frameworks/base/core/jni/android/graphics/Movie.cpp
b9c58ab617c257dbece105167b21e94faad67320 03-Dec-2013 Leon Scroggins III <scroggo@google.com> Merge AssetStream with AssetStreamAdaptor.

Add enums to the constructor for AssetStreamAdaptor to choose the
different behaviors used by the (former) two different classes.

The old clients of AssetStream now get the following features of
AssetStreamAdaptor
- Debugging statements on error.
- The stream is an SkStreamRewindable.
- getLength() returns the correct value, and the old way of getting
the length (read(NULL, 0)) is no longer implemented, since it is
no longer used.
- isAtEnd() returns the correct value. ToT Skia makes it pure virtual,
so some implementation is necessary.

Change-Id: I2a5395914e4f53830aaefee396556459083a1c56
/frameworks/base/core/jni/android/graphics/Movie.cpp
7315f1baee19476363235127bc1438e2a291fa15 11-Sep-2013 Leon Scroggins III <scroggo@google.com> Use a native buffer for decoding images.

Fixes BUG:10725383

Depends on https://googleplex-android-review.git.corp.google.com/#/c/357300/
in external/skia.

In the previous fix for BUG:8432093 and BUG:6493544
(https://googleplex-android-review.googlesource.com/#/c/346191/),
instead of calling mark on the provided input stream, we
copied the entire stream in native code (except in one case;
more details below), allowing rewind no matter how much of
the stream had been read. This was because two decoders
may rewind after reading an arbitrary amount of the stream:
SkImageDecoder_wbmp and SkImageDecoder_libjpeg.

It turns out that the jpeg decoder does not need this rewind
after arbitrary length (it is a failure recovery case, and
libjpeg has a default recovery we can use - the above referenced
CL in Skia uses the default).

Although the wbmp decoder could read any amount given a
stream with the "right" data, and then return false, such a
stream would not be a valid stream of another format, so it
is okay for this rewind to fail.

Further, the previous fix was inefficient in the common case
where the caller decodes just the bounds, resets, then decodes
the entire image (since we have copied the entire stream twice).
The copy also resulted in the crashes seen in BUG:10725383.

In this CL, buffer only the amount of input needed by
SkImageDecoder::Factory to determine the type of image decoder
needed. Do not mark the input stream provided by the caller,
so their mark (if any) can remain in tact. The new Skia class
SkFrontBufferedStream allows buffering just the beginning
of the stream.

core/jni/android/graphics/BitmapFactory.cpp:
Instead of calling GetRewindableStream (which has been removed),
call CreateJavaInputStreamAdaptor. Then wrap it in an
SkFrontBufferedStream, with a large enough buffer to determine
which type of image is used.

core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h:
core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp:
Remove mark, markSupported, and rewind. CreateJavaInputStreamAdaptor
now turns an SkStream which is not rewindable. If the caller
needs rewind that needs to be handled differently (for example,
by using SkFrontBufferedStream, as is done in BitmapFactory and
Movie.
Remove RewindableJavaStream and GetRewindableStream.
Remove code specific to ByteArrayInputStream, which makes slow
JNI calls. Instead, depend on the caller to buffer the input
in the general case. There is no reason to special case this
stream (especially since we already have decodeByteArray).
Remove CheckForAssetStream, which is now always special cased
in Java.

core/jni/android/graphics/Movie.cpp:
Call CreateJavaInputStreamAdaptor and use an SkFrontBufferedStream.
Add a native function for decoding an Asset, and remove old
call to CheckForAssetStream.

graphics/java/android/graphics/BitmapFactory.java:
Write a helper function for decoding a stream to consolidate
common code.
Buffer enough of the input so that SkImageDecoder::Factory
can rewind after having read enough to determine the type.
Unlike the old code, do NOT mark the caller's stream. This is
handled in native code. The caller's mark (if any) is left alone.

graphics/java/android/graphics/Movie.java:
Check for an Asset stream before passing to native, and
call a native function for handling the asset directly.

BUG:6493544
BUG:8432093
BUG:10725383

Change-Id: Ide74d3606ff4bb2a8c6cdbf11bae3f96696f331a
/frameworks/base/core/jni/android/graphics/Movie.cpp
ca32021b43f326af7d3f4ae041f8db297f98a518 20-Aug-2013 Leon Scroggins III <scroggo@google.com> Replace stream wrap-function w/ more specific ones

The current stream wrapper returns a potentially incorrect
value for a call to getLength(), is typically copied into
another stream (not always in the same way), and doesn't
always take advantage of its underlying data (like when it
is an Asset). The overall goal of this CL is to provide the
caller with something that is ready to use, depending on
what is asked for. If a copy is desired, the copy is made
before being returned to the caller.

core/jni/android/graphics/Bitmap.cpp:

Include SkStream.h, since it is no longer included by
CreateJavaOutputStreamAdaptor's header file.

core/jni/android/graphics/BitmapFactory.cpp:

Pass an SkStreamRewindable to decoding functions, as Skia
decoders will be updated to only take an SkStreamRewindable
(which makes more sense because they require rewinding).

Call the more specific GetRewindableStream to get a
rewindable stream.

Remove copyAssetToStream which has been moved to Utils.

In nativeDecodeAsset, pass forcePurgeable as allowPurgeable
in doDecode. Technically the old code worked, but it checked
the BitmapOptions again.

Remove getFDSize, which is no longer used.

core/jni/android/graphics/BitmapRegionDecoder.cpp:

Remove redundant buildSkMemoryStream. nativeNewInstanceFromStream
now calls CopyJavaInputStream, which handles the copy.

Copy the Asset directly, using common code, rather than creating
an AssetStreamAdaptor to copy.

core/jni/android/graphics/CreateJavaOutputStreamAdaptor.cpp:
core/jni/android/graphics/CreateJavaOutputStreamAdaptor.h:

Provide new interfaces to access data from a Java InputStream.
The new interfaces are more specific about what type of stream
is desired.

Use forward declarations where possible.

Remove doSize, which gives a misleading answer to the question
of how long the entire stream is.

TODO: Only call FindClass etc once.

core/jni/android/graphics/Movie.cpp:

Check for an asset stream, and use it if possible. Then call
GetRewindableStream if there is not an asset.
Remove the memory leak. Call DeleteLocalRef to delete the
allocated memory.

core/jni/android/graphics/Picture.cpp:

Call the new interface.

core/jni/android/graphics/Utils.cpp:
core/jni/android/graphics/Utils.h:

Make AssetStreamAdaptor inherit from SkStreamRewindable so it
can be passed to Skia decoding functions once they require it.

Add CopyAssetToStream (moved from BitmapFactory.cpp) so it can
be used by multiple files.

graphics/java/android/graphics/BitmapFactory.java:

Remove the call to mark, which is now done natively.

Remove the BufferedInputStream. Mark/reset is now handled
by native code.

Allow decodeStream to handle a FileInputStream by using the
FileDescriptor, if it is seekable. In decodeFileDescriptor,
call nativeDecodeStream instead of decodeStream so this new
functionality will not loop.

Call setDensityFromOptions in decodeFileDescriptor.

graphics/java/android/graphics/BitmapRegionDecoder.java:

Remove the BufferedInputStream. Mark/reset is now handled
by native code.

TODO: ADD TESTS!

Requires https://googleplex-android-review.googlesource.com/#/c/344317/

BUG=https://b.corp.google.com/issue?id=8432093

Change-Id: I4419b70b3482325c98ecc673dbfc4613f1b18581
/frameworks/base/core/jni/android/graphics/Movie.cpp
b13b9bdad2baf6ad1ec2e56b6b7598fa20f55fc4 18-Feb-2012 Mathias Agopian <mathias@google.com> frameworks/base refactoring.

step 2: move libutils headers to their new home: androidfw

Change-Id: I14624ba23db92a81f2cb929f104386e1fab293ef
/frameworks/base/core/jni/android/graphics/Movie.cpp
e7cb25916c70625e9086386293247ec604753d5c 02-May-2011 Conley Owens <cco3@android.com> am 1eb31b43: am 718516f3: am 9fd8e057: Merge "Fix memory leak of SkMovie class"

* commit '1eb31b434fdc325c55b65ecf1783c63b2fdfa669':
Fix memory leak of SkMovie class
cf6f7a0f006c0fcf59bb634cbe79f2a8500fd92a 13-Apr-2011 Elliott Hughes <enh@google.com> Don't allocate a raw object then call its constructor manually...

We can do this in one step.

Change-Id: Id6b70c83002038caf62fe89cc769eca54ae0c055
/frameworks/base/core/jni/android/graphics/Movie.cpp
8451b25a4422656bbd6657a5855e69c0f4d53c74 08-Apr-2011 Elliott Hughes <enh@google.com> Use jniThrowException for exception throwing from native code.

I'll do media and the generated gl stuff separately. Otherwise, this
cleans up all direct calls of ThrowNew/Throw except the one in the
binder that needs to remain.

Change-Id: I8f95a5f020f53b25926ad31ac0c9477ddf85d04b
/frameworks/base/core/jni/android/graphics/Movie.cpp
46e18c11d46a2bc1a46174f963d0ed1224d94cd2 06-Apr-2011 Brian Carlstrom <bdc@google.com> Don't use local ref for cached jclass reference in JNI code

Change-Id: Id45b2acb358a819f2fd332e99f3a095f6fc7299b
related-to-bug: 4241138
/frameworks/base/core/jni/android/graphics/Movie.cpp
08d7778f081aae745e6ad9e5350221b21dbf352e 28-Mar-2011 Kimiyoshi Kusaka <kusaka.kimiyoshi@sharp.co.jp> Fix memory leak of SkMovie class

Movie class doesn't have finalize method.
So memory leak of SkMovie class of native Skia occurs when Movie class is released.
I add finalize method to Movie class (Movie.java) and jni destructor method to SkMovie class (Movie.cpp).

Change-Id: I4dae9dd95f128cbfade50bef978b219ba99321dd
/frameworks/base/core/jni/android/graphics/Movie.cpp
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android/graphics/Movie.cpp
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/jni/android/graphics/Movie.cpp
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/jni/android/graphics/Movie.cpp
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/jni/android/graphics/Movie.cpp