The alpha channel is applied by modulateAlpha(). Setting it to
mAlpha in ensureValidRect() locked the maximum alpha channel to
whatever value was set before layout. Setting it to BLACK
ensures it can be modulated later.
BUG: 10514848
Change-Id: If7a824410a66f1e9b648e20ee627bdf99a42ae78
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
Also remove dead code from OpenGLRenderer.cpp
Change-Id: I7eb54ca19e77ee3c32f1fe9513a031e6b2e115cf
(cherry picked from commit 5c7d5ab878b26f855175a3305a14ac12fcacf25e)
Bug: 9814370
To allow WebView.capturePicture() to return a subclass, we need to
ensure the subclass is always consulted when being drawn into a canvas.
Change-Id: Ia0357f95b6fafb3ac81e6bcfaef05739e619897a
* Make it clear that the Y-plane is not interleaved for YUV_420_888
* Make it clear that the U/V plane have the same stride
* Make it clear what the order of Y/U/V planes is
Change-Id: Id85d7c68e84382149dbf0e8b4e965ba2988326fe
- default value is "no mirroring"
- introduce android:autoMirrored as a new attribute for Drawable,
BitmapDrawable, LayerDrawable, StateListDrawable and NinePatchDrawable
- setting android:autoMirrored="true" means that the drawable will
be mirrored when the layout direction is RTL (right-to-left)
- also fix an issue with ImageView drawable layout direction not
updated correctly when RTL properties were changed
See bug #7034321 Need Drawable RTL support
Change-Id: If595ee5106c786f38e786d3a032e182f784a9d97
- Paint.setClassVariablesFrom(Paint paint) was using the same Shader
for the copy as the initial Paint. Make sure that we are using a copy.
- implement a copy() API for shaders
See bug #7034321 Need Drawable RTL support
Change-Id: I4b9cee386edc72ad670723266333b85f4d2b0ab8
Quite a few things going on in this commit:
- Enable bitmap strikes by default in Paint objects.
The SkPaint parameter that enables bitmap strikes was not previously
included in DEFAULT_PAINT_FLAGS. This effectively disabled bitmap
fonts. Oops! It's for the best, though, as additional work was needed
in Skia to make bitmap fonts work anyway.
- Complain if TEXTURE_BORDER_SIZE is not 1.
Our glyph cache code does not currently handle any value other than 1
here, including zero. I've added a little C preprocessor check to
prevent future engineers (including especially future-me) from
thinking that they can change this value without updating the related
code.
- Add GL_RGBA support to hwui's FontRenderer and friends
This also happened to involve some refactoring for convenience and
cleanliness.
Bug: 9577689
Change-Id: I0abd1e5a0d6623106247fb6421787e2c2f2ea19c
Path ops can be used to combine two paths instances in a single path
object. The following operations can be used:
- Difference
- Reverse difference
- Union
- XOR
- Intersection
To use the API:
Path p1 = createCircle();
Path p2 = createRect();
Path result = new Path();
result.op(p1, p2, Path.Op.DIFFERENCE);
This code will subtract the rectangle from the circle and generate
the resulting path in "result."
Change-Id: Ic25244665b6691a7df0b0002a09da73d937b553b