139 Commits

Author SHA1 Message Date
Romain Guy
5e7c469c7a Make sure 9patches are not filtered when not necessary
Bug #5383406

Change-Id: I061c8069a4d9f4eaf45671283710b564639eeb32
2011-10-20 20:33:07 -07:00
Romain Guy
a9dc86b21d Correctly apply transforms when getting a TextureView's bitmap
Bug #5439406

Change-Id: I271a9a2e38f5b3600dc158f8f442a6b0893f472b
2011-10-11 14:06:21 -07:00
Romain Guy
2a9fa89643 Don't build display lists for views with a layer.
This could cause the draw() code of views to be invoked too often
or worse, called with the wrong canvas. For instance, a view backed
by a software layer could get its draw() method called to record a
display list. Using a software layer is the recommended way to use
drawing operations not supported in hardware. Since we would
sometimes call the draw() method with the hardware backend anyway,
the app could crash by executing an unsupported operation.

Change-Id: Ib5f9a3a4c6f3efff5e0162ecd73d2dffe06e30a6
2011-09-28 16:50:02 -07:00
Romain Guy
407ec78b82 Add OpenGL backend to ImageWallpaper
Bug #5204874

Currently disabled.

Change-Id: I5e7b35dce2981b0691f107e39c6394b260466543
2011-08-24 17:06:58 -07:00
Romain Guy
302a9df1d5 Add an API to set the transform on a TextureView's surface texture.
Bug #5156689

Change-Id: I635a625885c9b832a60d44ece0de7613ceb84109
2011-08-16 13:55:02 -07:00
Grace Kloba
402f055303 Add a return value for SurfaceTextureListener#onSurfaceTextureDestroyed.
If returns true, the SurfaceTexture will be released by TextureView.
If returns false, the client needs to release the SurfaceTexture.

Change-Id: I946f71e337ad4170c168854ac27e028b82489c8c
2011-08-09 18:47:17 -07:00
Romain Guy
bd496bc3d4 Paint style and stroke width affect text rendering.
Bug #5112207

Change-Id: Ic34037ace21a5058ba23dd15e51aae58c998454d
2011-08-02 17:32:41 -07:00
Romain Guy
0965a3244b Allow Canvas.setBitmap() to receive a null Bitmap.
Change-Id: I6096f0b44866e532ccd96a29c816bf34d48c1dc2
2011-08-01 17:39:21 -07:00
Romain Guy
b50149825f Correctly apply linear filter to drawBitmap(Rect, Rect)
Change-Id: I1049282e1996b1020c92cb7bec46e9f28e94e967
2011-07-28 15:40:47 -07:00
Romain Guy
7eabe55db6 Add looper profiling to adb shell am
To profile the looper, run the following command:

adb shell am profile looper start <process> <file>
adb shell am profile looper stop <process>

Change-Id: I781f156e473d7bdbb6d13aaffeeaae88bc01a69f
2011-07-21 14:56:34 -07:00
Romain Guy
3c2c9e4e0d Update TextureView.lockCanvas() test.
Change-Id: Ib0f613fcd6ba64a696936e4e2b386b96d76b828a
2011-07-18 17:45:04 -07:00
Romain Guy
6be3d5561c Add lock/unlockCanvas to TextureView
With this change, TextureView has feature parity with SurfaceView.

Change-Id: I4ef2da33420fc9590f868636ae72a5a6de61965b
2011-07-18 15:02:06 -07:00
Romain Guy
f9284695e8 Add new ViewDebug APIs to profile the event queue.
Change-Id: I225bf288780b0244f459316e2765cfa29cd22c89
2011-07-15 11:25:11 -07:00
Romain Guy
5fccb70de9 Add test for bug #4970944
Change-Id: I3e7287bc406ff497a49cf823cee53b1a943a74a9
2011-07-11 18:23:09 -07:00
Romain Guy
cfacbeadff Cleanup
Change-Id: I2a9dc34e907b4c6e60f8c2999150b22015012e74
2011-07-07 21:33:41 -07:00
Romain Guy
ec19b4a764 Use NEAREST filtering mode for TextureView.getBitmap().
Change-Id: I4649062bbdf18ebba7924bdf578f39ad8f6576ac
2011-07-07 21:27:14 -07:00
Romain Guy
9ace8f5e79 Use NEAREST filtering for layers whenever possible.
Change-Id: Id5bee1bd4a322cf93e8000b08e18f1e1b058648e
2011-07-07 20:50:11 -07:00
Romain Guy
f61970fc79 Add an API to query maximum bitmap/texture size on Canvas.
Change-Id: I2c576c9a4ecad9f33cc6636bcbc29786acdf052d
2011-07-07 14:10:06 -07:00
Romain Guy
595c18b07a Add test case for driver issue
Change-Id: I0411bf9c8e114ce388e619170fb4c2b1c6fd80f9
2011-06-29 17:20:38 -07:00
Romain Guy
d0d0705994 Update GLTextureView sample to do something real.
Change-Id: I55a62434ae0b602522221689626f6b4155bd0d91
2011-06-24 18:51:28 -07:00
Romain Guy
4a5a71518a Don't set texture parameters on every frame.
Change-Id: Iec368405ad6a4ccfd569a0b3b4d681871a770396
2011-06-24 17:53:53 -07:00
Romain Guy
80429c4585 Properly tear down TextureView
Change-Id: Ic23cd9257889d0abe8cc3fc1d04a66d0505e383e
2011-06-24 17:20:32 -07:00
Romain Guy
02ccac69fd Code cleanup
Change-Id: I64c346004e0adf9a776d0315534d4fe445f0c0ca
2011-06-24 13:20:23 -07:00
Grace Kloba
cf559377b7 Add onSurfaceTextureUpdated to the TextureView listener.
The app needs a way to throttle the producer side. Expose this to enable it.

Change-Id: I04b6a3fc444117a9fc2449fb87c3c834247c8ef1
2011-06-22 23:05:40 -07:00
Romain Guy
1ec3a58bcd Prevent possible NPE in TextureView
Change-Id: I539813d614c7eb1f68dad6b605cbad5b5144c5e9
2011-06-22 21:01:58 -07:00
Romain Guy
a9489274d6 Add the ability to specify the opacity of a TextureView
TextureView assumes its content is opaque by default.

Change-Id: Iba873423566a5b67c388081838bd910dceba32ba
2011-06-22 20:58:11 -07:00
Romain Guy
d6b2a00dd4 Add error checking to LayerRenderer::copyLayer
This method is invoked by TextureView.getBitmap() and failures must be
caught to avoid leaving the GL context in a potentially bad state.

Change-Id: I620de395ba1bc20154de58c81963223dc55cac78
2011-06-17 17:45:59 -07:00
Romain Guy
98029c825b Fix rendering issue with paths when the stroke width is 0
Change-Id: I5d8ac23dc69e9e17df4ef6b5195186b5207e2524
2011-06-17 15:47:07 -07:00
Romain Guy
77a811610f Add TextureView.getBitmap()
This API can be used to get a Bitmap copy of the content of a
TextureView.

Change-Id: I07522216c353720fba5cab333174f58f484eb911
2011-06-14 17:06:53 -07:00
Romain Guy
54be1cdf3d Batch glCopyTexImage() calls to get about 15 fps back on SGX.
Change-Id: I04079e070739c1e46df3e90fc388c335e2a7d2b9
2011-06-13 19:04:27 -07:00
Romain Guy
451ce44a18 Add onSurfaceTextureDestroyed() callback.
This is needed for Renderscript and it also makes implementations
of TextureView cleaner. This change also hooks up the onSurfaceTextureSizeCHanged()
callback whenever the view size changes.

Change-Id: I2f972ee4504d800329defefacf32cf20547d31a3
2011-06-10 15:44:09 -07:00
Romain Guy
f09ef51889 Fix issue with drawColor(color, Mode.Clear)
Change-Id: I486b24a5b609c6f8adb0276037ddb24af2b888b2
2011-05-27 11:43:46 -07:00
Romain Guy
1e59f9d10d Fix texture coordinates for sub-bitmap rendering.
Change-Id: I05a31775e03f5b223a55a5144d420351abac89be
2011-05-26 18:39:34 -07:00
Romain Guy
f504a2fa14 Correctly implement the CLEAR xfermode.
The previous implementation was using glBlendFunc with the parameters
GL_ZERO/GL_ZERO which doesn't work for text, paths and other alpha
sources (anti-aliasing.) The correct implementation is GL_ZERO/
GL_ONE_MINUS_SRC_ALPHA.

Change-Id: I4cca65e57b6a37bbf5a41d382cb0648ee8e11e79
2011-05-26 16:40:55 -07:00
Romain Guy
f9be16a9d4 Rename test to be able to launch it on crespo.
Change-Id: Ieb3e1f6a2e3effe5c4042ad170f195244c7e2158
2011-05-25 17:49:11 -07:00
Chet Haase
44984ea0cb Enable large font rendering with GPU acceleration
Change-Id: I7b022100fb0762613f9cf7753dbb0217e1e75f8d
2011-05-19 16:39:37 -07:00
Chet Haase
858aa93ddb Antialiasing for rectangles
Change-Id: I7ca6931606541ddd504bd5db7f8dc04b9cde8cd9
2011-05-12 14:55:29 -07:00
Chet Haase
99ecdc480d Fix for scaled AA lines
Previously, the translucent boundary of AA lines would be scaled
by the line's transform. It should always be exactly one pixel wide
in screen space. This fix accounts for scaling for the boundary
region, and fixes some AA calculations that make wide/AA lines
more correct.

Change-Id: I30df2d5d96315bf3e7ff30be9735282fd5439a39
2011-05-06 12:10:54 -07:00
Romain Guy
df0a7fbdcf Merge "Allows to render with an OpenGL context inside a TextureView." 2011-05-02 18:33:26 -07:00
Romain Guy
8f0095cd33 Allows to render with an OpenGL context inside a TextureView.
Change-Id: I59453f7fc3997f0502a1c5d325d37fed376fabc7
2011-05-02 18:32:29 -07:00
Chet Haase
99585adeb4 Line endcaps for AA lines are now antialiased.
Also fixed other minor issues with AA and line rendering.

Change-Id: Icd4638d27c70e2ee0f28b5d9a2b97d8b29e8ac4d
2011-05-02 15:08:38 -07:00
Romain Guy
ad44445c77 Merge "New widget: TextureView Bug #4343984" 2011-04-28 18:47:01 -07:00
Romain Guy
aa6c24c21c New widget: TextureView
Bug #4343984

TextureView can be used to render media content (video, OpenGL,
RenderScript) inside a View.

The key difference with SurfaceView is that TextureView does
not create a new Surface. This gives the ability to seamlessly
transform, animate, fade, etc. a TextureView, which was hard
if not impossible to do with a SurfaceView.
A TextureView also interacts perfectly with ScrollView,
ListView, etc. It allows application to embed media content
in a much more flexible way than before.

For instance, to render the camera preview at 50% opacity,
all you need to do is the following:

mTextureView.setAlpha(0.5f);
Camera c = Camera.open();
c.setPreviewTexture(mTextureView.getSurfaceTexture());
c.startPreview();

TextureView uses a SurfaceTexture to get the job done. More
APIs are required to make it easy to create OpenGL contexts
for a TextureView. It can currently be done with a bit of
JNI code.

Change-Id: Iaa7953097ab5beb8437bcbbfa03b2df5b7f80cd7
2011-04-28 18:46:19 -07:00
Chet Haase
8a5cc92a15 Fix various hw-accelerated line/point bugs
All accelerated lines are now rendered as quads. Hairlines used to
be rendered as GL_LINES, but these lines don't render the same as our
non-accelerated lines, so we're using quads for everything. Also, fixed
a bug in the way that we were offsetting quads (and not offseting points)
to ensure that our lines/points actuall start on the same pixels as
Skia's.

Change-Id: I51b923cc08a9858444c430ba07bc8aa0c83cbe6a
2011-04-27 14:23:29 -07:00
Romain Guy
740bf2bb2e Apply shaders/filters to text drop shadows.
Bug #4318323

This change also fixes the fact that shaders were not modulated
by the paint's color when drawing paths.

Change-Id: Id88804143aea06c895d4cbcdbe106d660230aa5a
2011-04-26 15:33:10 -07:00
Romain Guy
3a03eeedaf Update shader text to test with drop shadows.
Change-Id: Iefdf116846c9b5649d1561a9d80d66d1c3acfeca
2011-04-26 14:04:08 -07:00
Chet Haase
5b0200bd47 Enable anti-aliasing for hw-accelerated lines
Draw anti-aliased lines with OpenGL by constructing a quad with
a border that fades out (to mimic fragment coverage).

Change-Id: Ib81a3e62d663acdf1b46b401ac4aa7ee9855cc7e
2011-04-21 11:47:05 -07:00
Romain Guy
1a81aea814 Update GL textures when changing a Bitmap's pixels
Bug #4146495

Change-Id: I4fe3f8501373b86b164af11ae51642b140035bb8
2011-03-21 15:30:27 -07:00
Romain Guy
ed6fcb034b Add support for drawPoint() and drawPoints().
Change-Id: I01bef50c08ec3160f8d40dc060b2cf6c2e4d7639
2011-03-21 13:11:49 -07:00
Romain Guy
7b5b6abf85 Fix rendering artifact in edge fades.
Bug #4092053

The problem always existed but was made visible by partial invalidation.
When saving a layer, the renderer would try to postpone glClear()
operations until the next drawing command. This however does not work
since the clip might have changed. The fix is rather simple and
simply gets rid of this "optimization" (that turned out to be
usless anyway given how View issues saveLayer() calls.)

This change also fixes an issue with gradients (color stops where
not properly computed when using a null stops array) and optimizes
display lists rendering (quickly rejects larger portions of the
tree to avoid executing unnecessary code.)

Change-Id: I0f5b5f6e1220d41a09cc2fa84c212b0b4afd9c46
2011-03-14 18:05:08 -07:00