115 Commits

Author SHA1 Message Date
Owen Lin
0ab9851308 Fix a initialization bug in BitmapRegionDecoder.
Change-Id: I6c1151fd34970a84d4de52d664d9a5dc464892c5
2010-09-29 23:12:44 +08:00
Wei-Ta Chen
a23cdda0a5 am ac487f70: am 6b849e21: Unhide BitmapRegionDecoder.
Merge commit 'ac487f708f7b58dbd4f3021b520c6ed5975daebe'

* commit 'ac487f708f7b58dbd4f3021b520c6ed5975daebe':
  Unhide BitmapRegionDecoder.
2010-09-22 23:06:55 -07:00
Wei-Ta Chen
6b849e2123 Unhide BitmapRegionDecoder.
1. Rename LargeBitmap to BitmapRegionDecoder
2. Move the instantiations of BitmapRegionDecoder out of BitmapFactory.
3. Remove the use of MemoryFile in BitmapRegionDecoder, since MemoryFile's API had been modified in master. Otherwise, the change will break the master build.
4. Move AssetStreamAdaptor, AutoFDSeek and nullObjectReturn to Utils.h because BitmapFactory.cpp and BitmapRegionDecoder.cpp both need to use these utility functions.

Most of the modifications, except for (2) and (3), were reviewed in https://android-git.corp.google.com/g/#change,64716 .
However, that change broke the master build due to (3) and was reverted eventually.
So, instead of withdrawing this change and waiting for that change to be checked in again, I merge the two changes into one.

Change-Id: I2202c0fbbbd6d6676bbd9637e690023ea4099c40
2010-09-23 13:56:52 +08:00
Romain Guy
ddb80bebb0 Add support for circular gradients to the GL renderer.
This change also adds full support for local transformation matrices on
sweep and radial gradients.

Change-Id: Id8773bc0766575190e3f3d51984fc5e57b266c3f
2010-09-21 16:48:50 -07:00
Romain Guy
ee916f14cb Add support for SweepGradient in the GL renderer.
Change-Id: I7aa397ed4e34655ead9ba1f5b4ce087665e0f022
2010-09-20 17:54:17 -07:00
Joseph Wen
94b19d3706 am 94db0238: am 219eb7ec: Merge "Fix bug in JNI BitmapFactory" into gingerbread
Merge commit '94db0238a3b6cba3cbf0e037af74e898a4741204'

* commit '94db0238a3b6cba3cbf0e037af74e898a4741204':
  Fix bug in JNI BitmapFactory
2010-09-10 02:39:10 -07:00
Joseph Wen
219eb7ec84 Merge "Fix bug in JNI BitmapFactory" into gingerbread 2010-09-10 02:32:05 -07:00
Joseph Wen
2dcfbefbbe Fix bug in JNI BitmapFactory
In nativeCreateLargeBitmapFromFileDescriptor() if the file descriptor
can not be rewinded isShareable should be set to false.

Change-Id: I7dd545c9d52d21c226e11b8921e35a1d9bba9515
2010-09-10 17:24:15 +08:00
Romain Guy
9584a542e3 Merge "Purge Skia objects from GL caches as needed." 2010-09-08 18:06:11 -07:00
Romain Guy
a2341a9f6a Purge Skia objects from GL caches as needed.
Change-Id: I754c671cf790ad5ae8bf047ad328034217da4ecc
2010-09-08 18:04:33 -07:00
Romain Guy
53e7ae9065 Merge "Fix possible infinite loop when purging textures." 2010-09-08 15:16:13 -07:00
Romain Guy
9aaa8269a3 Fix possible infinite loop when purging textures.
Change-Id: Ib05b398ae03e734da2dab0496df416fed4570b1c
2010-09-08 15:15:43 -07:00
Elliott Hughes
cfa5903926 am 664c48e9: am 4c7d3f28: Merge "Remove dead code: NIOBuffer." into gingerbread
Merge commit '664c48e991a70d07646d54125e97f579f3a33be4'

* commit '664c48e991a70d07646d54125e97f579f3a33be4':
  Remove dead code: NIOBuffer.
2010-09-08 10:38:41 -07:00
Wei-Ta Chen
7b29804ba2 am 8fc6f8b2: am 1b214be9: Merge "Revert "Rename LargeBitmap to BitmapRegionDecoder for having a better API."" into gingerbread
Merge commit '8fc6f8b2152564cab6ede025644f9bc3ee61ce16'

* commit '8fc6f8b2152564cab6ede025644f9bc3ee61ce16':
  Revert "Rename LargeBitmap to BitmapRegionDecoder for having a better API."
2010-09-07 22:10:58 -07:00
Wei-Ta Chen
340ce75b44 Revert "Rename LargeBitmap to BitmapRegionDecoder for having a better API."
This reverts commit 50ba3d2c09a9131f3578d271adf2bc8258ca1742.
2010-09-08 10:44:21 +08:00
Wei-Ta Chen
50cb7dc458 am a295a390: am b356f8ac: Merge "Rename LargeBitmap to BitmapRegionDecoder for having a better API." into gingerbread
Merge commit 'a295a3908befeb9dd30203c612d95411d68492ed'

* commit 'a295a3908befeb9dd30203c612d95411d68492ed':
  Rename LargeBitmap to BitmapRegionDecoder for having a better API.
2010-09-07 18:52:21 -07:00
Elliott Hughes
edf7223bc2 Remove dead code: NIOBuffer.
Working on speeding up our NIO implementation, I came across this suboptimal
code. Happily, it turns out to be unused.

Bug: 2935622
Change-Id: I07ae6e573d63e439f496d55af215b34598d8258a
2010-09-07 15:42:23 -07:00
Wei-Ta Chen
50ba3d2c09 Rename LargeBitmap to BitmapRegionDecoder for having a better API.
Move AssetStreamAdaptor, AutoFDSeek and nullObjectReturn to Utils.h because
BitmapFactory.cpp and BitmapRegionDecoder.cpp both need to use these utility functions.

Change-Id: I3e60c7fe4abd0289e1384e69a08fd20fe6fb0e10
2010-09-07 21:02:13 +08:00
Wei-Ta Chen
ce53603a4f am 9f7257f0: am 8d124f70: Merge "Fix a bug, where one thread is using JNIEnv associated with another thread." into gingerbread
Merge commit '9f7257f0a14cd17d8b55bc3bd1584dac2f9dd1b2'

* commit '9f7257f0a14cd17d8b55bc3bd1584dac2f9dd1b2':
  Fix a bug, where one thread is using JNIEnv associated with another thread.
2010-08-21 09:39:51 -07:00
Romain Guy
18ef37258d DO NOT MERGE. Fix the build.
Change-Id: I3322faa948af015f7d8df31b9a4c281f5311f067
2010-08-19 15:15:19 -07:00
Romain Guy
4f0a8df9fe Fix the build.
Change-Id: I71e77cb3c124b31b81d952dc3897ebc414a1f701
2010-08-19 15:10:54 -07:00
Romain Guy
288471d8a5 DO NOT MERGE. Load assets in place instead of deferring until draw.
Before this change, all framework assets would be decoded at drawing time
outside of zygote. This was forcing all apps to re-decode the assets and
zygote to keep an in-memory copy of each asset. This behavior is now
opt-in by setting the inPurgeable flag on BitmapFactory.Options.

Change-Id: Ief823139163d8071b8ee1267746622faf52eb8ec
2010-08-19 15:02:31 -07:00
Romain Guy
207b3ab604 Load assets in place instead of deferring until draw.
Before this change, all framework assets would be decoded at drawing time
outside of zygote. This was forcing all apps to re-decode the assets and
zygote to keep an in-memory copy of each asset. This behavior is now
opt-in by setting the inPurgeable flag on BitmapFactory.Options.

Change-Id: Ic703f57adb26b2a701ecff0a653d35a93e26d47c
2010-08-19 14:41:16 -07:00
Wei-Ta Chen
291303ba3d Fix a bug, where one thread is using JNIEnv associated with another thread.
We see abort messages like this when using JavaPixelAllocator and JavaMemoryUsageReporter.
W/dalvikvm(  680): JNI WARNING: threadid=2 using env from threadid=10
W/dalvikvm(  680):              in Landroid/graphics/LargeBitmap;.nativeClean (I)V (CallVoidMethodV)

To fix it, we keep JavaVM, rather than JNIEnv, in JavaPixelAllocator and JavaMemoryUsageReporter,
because JavaVM allows us to get the JNIEnv corresponds to the current thread.

Change-Id: Ibd4b394a53dd3fdccc5a442eeb0dedf836479575
2010-08-19 12:21:44 +08:00
Joseph Wen
1b10d3d235 am 81dcea60: am f1f48bc7: Do JPEG tile-based decoding.
Merge commit '81dcea6093dfcdadd52982505249a5eacf47a81b'

* commit '81dcea6093dfcdadd52982505249a5eacf47a81b':
  Do JPEG tile-based decoding.
2010-08-17 00:35:06 -07:00
Joseph Wen
f1f48bc7f2 Do JPEG tile-based decoding.
Change-Id: I5c1b4ac3c02eb4350ef0ba9a7877b22cfd730cfb
2010-08-17 14:34:02 +08:00
Romain Guy
1e45aae5de Add drop shadows.
Change-Id: Ic6a72409d4785968d1fbdff229f17ee5c00b240b
2010-08-13 19:41:14 -07:00
Romain Guy
48daa54d31 Add extra blending modes.
This change adds the following blending modes for shaders and color filters:
Add
Multiply
Screen
Overlay
Darken
Lighten

Change-Id: Iff22f5ce6041b43c71b1857d73013f5010ab3413
2010-08-10 21:42:40 -07:00
Romain Guy
61c8c9c5b2 Fix tons of bugs and add new text rendering support.
Change-Id: I326c66b10784006f6df2f12d38e120cef94cd0d7
2010-08-10 12:22:01 -07:00
Romain Guy
1639351139 Make libhwui entirely optional.
The makefile variable USE_OPENGL_RENDERER must be set to true to compile
libhwui and the related code in the JNI layer.

This change also removes obsolete APIs from Canvas that must not be used
and would be confusing if left in. These APIs were remnants of our first
attempt at an OpenGL renderer for the view hierarchy and had not been
taken out before Android 1.0 was released.

Change-Id: I2475ff1307212bab26c926724f3c508681c7dae1
2010-08-08 17:45:07 -07:00
Romain Guy
db1938e0e6 Add support for ColorFilters.
Color filters are fully supported and can be used with shaders.

Change-Id: Id90ccf1c81cb462f2431f366f3f8f710d7971e04
2010-08-02 18:50:56 -07:00
Romain Guy
06f96e2652 Refactor Skia shaders handling.
With this change, Skia shaders can easily be applied to any mesh. This change also
supports ComposeShader. For instance, this can be used to blend a gradient and a
bitmap togehter and paint a string of text with the result.

Change-Id: I701c2f9cf7f89b2ff58005e8a1d0d80ccf4a4aea
2010-07-30 19:18:16 -07:00
Romain Guy
9226298891 Fix text corruption when rendering RTL enabled text.
Change-Id: I5450fd9cad1c5a66875affdbcd34308aea4c36ac
2010-07-26 11:17:54 -07:00
Romain Guy
e8e62a4a03 Add text alignment support to drawText().
This change also integrates better support for RTL text.

Change-Id: I6da8f5cf5dc28ca7cf1b22e27b0d853c919e8481
2010-07-23 18:55:21 -07:00
Gilles Debunne
8cd48574a7 Fixed bug in BitmapFactory.decodeStream
Downloading images over a slow connection could result in errors and
null images.

The JavaInputStreamAdaptor::do_skip method was correctly called in a
loop (to handle the EOF case using read()), but the amount that was
skipped at each time was not decreased by the amount already skipped.

Bug http://code.google.com/p/android/issues/detail?id=6066

Cherry picked from master CL57808

Change-Id: Ie6856898b21ba31de1209e1f995b4ae784c919b9
2010-07-23 13:40:59 -07:00
Romain Guy
a1db574036 Add preliminary support for text rendering.
Change-Id: I547eb631dbda24d13960d54b4144fb8908fd8a49
2010-07-20 16:37:27 -07:00
Romain Guy
ea2604d966 Merge "Add plumbing to support gradients in OpenGL renderer." 2010-07-16 17:13:26 -07:00
Romain Guy
7fac2e1833 Add plumbing to support gradients in OpenGL renderer.
The LinearGradient class keeps a copy of the various parameters that
define the gradient. The copies are native arrays to avoid copying
Java arrays on every draw call. The gradient code path is implemented
until OpenGLRenderer::drawRect() (see TODO.) The actual gradient
implementation will be added in a latter change.

Change-Id: I9300d250ef5e2e9c2e097c3116ee71dfc9d752d8
2010-07-16 17:10:13 -07:00
Gilles Debunne
fc224b3e53 Fixed bug in BitmapFactory.decodeStream
Downloading images over a slow connection could result in errors and
null images.

The JavaInputStreamAdaptor::do_skip method was correctly called in a
loop (to handle the EOF case using read()), but the amount that was
skipped at each time was not decreased by the amount already skipped.

Bug http://code.google.com/p/android/issues/detail?id=6066

Change-Id: Id897cdbe027e2d8c56df9fc399b3c92affb89c59
2010-07-15 18:12:50 -07:00
Doug Felt
f7cb1f75fd Support bidi/shaping for getTextPath
Move layout-related code into separate class since it's needed by both
canvas and paint.

Change-Id: Iba89a1d94d7cca650255ffa3cbc952b988a51b54
2010-07-12 13:50:08 -07:00
Doug Felt
4beb8ff717 Support bidi layout for drawTextOnPath.
Change-Id: Ie5867fdb66fe15336774e20d65fa63e0d05bf6fe
2010-07-07 14:58:03 -07:00
Romain Guy
0bbae08364 Add new API to check whether a Bitmap was modified.
Bitmap.getGenerationId() can be used by caches to find out if a Bitmap has been
modified. This simply exposes an existing Skia API.

This change also adds a small test app for Canvas hardware acceleration. The new
Bitmap API is required to implement a texture cache.

Change-Id: I8547b146cd14c8afe1a2327fcd6d71b1b1cb68fc
2010-06-15 18:03:40 -07:00
Doug Felt
0c702b88c5 Move shaping to native.
Add internal API (getTextRunAdvances) to Paint, use when measuring.
Add internal API (getTextRunCursor) to Paint, use when determining
valid cursor positions.

Remove java-level shaping code.  Remove 'prep' code in TextLine
(except for replacement text) since shaping now is done on the fly as
needed in native.

Provide explicit shaping context bounds to internal text measuring,
cursor movement, and rendering APIs.

Update for to changes in external API in ushape.h.

Change-Id: I146958b624802ce8553125e5c3c6c03031bc9608
2010-06-10 14:03:22 -07:00
Doug Felt
f47d7405bb Modify Canvas drawText to run bidi and shape.
Adds drawTextRun as internal API on Canvas and GraphicsOperations.
Adds implementation to implementors of GraphicsOperations.

Adds state and API on Paint to control the bidi algorithm when used
by Canvas.  This API is currently hidden.

The drawText changes are incomplete since shaping is not yet available
in the native code.

Change-Id: I4368048aef9545df0953a349381771603e04b619
2010-05-12 18:50:02 -07:00
Mike Reed
54900e8c05 update dox that we ignore the exact parameter on computeBounds
Change-Id: I6051210ea2a73b4d1c6cd631a285209ab130b4e5
2010-03-25 14:02:40 -04:00
Mike Reed
39f10ec7da If we detect a 9patch chunk, force the config chooser to avoid 565, with its pre-dithering madness
Change-Id: I0a2d1b094ccb16d479524779acec0216dc7a80ee
2010-03-24 10:12:35 -04:00
Mike Reed
36ad54acef force purgeability for assets
Change-Id: I1067cfb91846a05290ed26ce9a62eb82d3170719
http://b/issue?id=1860187
2010-03-10 13:11:47 -05:00
Chia-chi Yeh
aa86859b10 YuvImage: jpeg_set_quality() should be called after jpeg_set_defaults().
Change-Id: I6579ad9241dd5ee6aabf54e1a1128d17b4f6b3e6
2010-03-10 17:08:58 +08:00
Ficus Kirkpatrick
1a9c27c312 Add a LOG_TAG for android.graphics.Graphics JNI.
It occasionally logs when it fails an allocation but wasn't
defining one before.

Change-Id: Ifc41addc870eb126616ad44465638423d51568d9
2010-03-09 10:00:31 -08:00
Mike Reed
76d1e01d5e hidden api sameAs() to compare the pixels of 2 bitmaps for equality 2010-03-08 08:53:23 -05:00