49 Commits

Author SHA1 Message Date
Alex Sakhartchouk
9b9902ddbb Updating parts of font cache as needed instead of the entire map.
Change-Id: If9a37e10197255122acdb5b10a0c356edd942d67
2010-07-23 14:45:49 -07:00
Romain Guy
51769a68a5 Cleanup, added properties for the FontRenderer.
Change-Id: I909c74815d3ac394438ad8071d17fef5401dbeed
2010-07-23 00:28:00 -07:00
Romain Guy
bd0e6aa0ff Add a way to query GL extensions.
Change-Id: Ic27dbf72289dacf641b640a749fbd40c12cd474f
2010-07-22 18:52:24 -07:00
Romain Guy
09147fbdc8 Add support for text culling.
Change-Id: Ibf0adacdc5c64d40a8000b21d7cb0797d63efe29
2010-07-22 13:08:20 -07:00
Romain Guy
694b519ac6 Add text rendering.
Change-Id: Ibe5a9fa844d531b31b55e43de403a98d49f659b9
2010-07-21 21:33:20 -07:00
Romain Guy
a1db574036 Add preliminary support for text rendering.
Change-Id: I547eb631dbda24d13960d54b4144fb8908fd8a49
2010-07-20 16:37:27 -07:00
Romain Guy
c0ac193b94 Add support for linear gradients.
Change-Id: Id15329da065045b3f06fdaed615f33cd57608496
2010-07-19 18:44:05 -07:00
Romain Guy
f9764a4f53 Add program for linear gradient.
This change adds a new DrawLinearGradientProgram class to enable the drawing
of linear gradients. Two new vertex and fragment shaders are introduced,
based on DrawTextureProgram's shaders.

Change-Id: I885afc076bb6cef8cd3962ae21a086fa6a03bf96
2010-07-16 23:18:27 -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
Romain Guy
1e79386ba3 Optimize textures binding.
The renderer is still changing textures' wrap modes every time, this will require
a latter optimization.

Change-Id: I3eb92cb8c886c4a692b7f0ca759911f9371d4d2c
2010-07-16 15:07:42 -07:00
Romain Guy
079ba2c85b Improve clip support (add intersect, union and replace.)
This change also modifies the way the clip is stored. The clip is now
always stored in screen-space coordinates.

Change-Id: I96375784d82dfe975bc6477a159e6866e7052487
2010-07-16 14:12:24 -07:00
Romain Guy
d27977d1a9 Add support for BitmapShader.
This change also fixes an issue with the clip and layers.

Change-Id: I5fd9832098d8cf7ae8eb781ff9bffe7defaea279
2010-07-15 14:44:42 -07:00
Romain Guy
3d58c03de0 Do not apply transforms when using drawColor().
This fixes an issue in the way the clip transformations were applied.

Change-Id: I91e7b5d15baf244d1280e48938282bb33609081d
2010-07-14 16:35:43 -07:00
Romain Guy
594f406514 Enable 32-bits only assets.
Go away dithering!

Change-Id: Iee5ee2e9430606e732d9b0abb3adc9f68275bd6d
2010-07-13 17:41:31 -07:00
Romain Guy
a979474f15 Cleanup: remove unnecessary parameters.
Change-Id: I5956ef1db6be28a01369387aaeeb65a94656c48c
2010-07-13 11:37:54 -07:00
Romain Guy
92429d9266 Fix premultiplied alpha.
Change-Id: I08da422c5350503e1f4f27b9890f15a813d0c6c7
2010-07-12 20:27:17 -07:00
Romain Guy
6926c72e25 Correctly support pre-multiplied alpha, optimizations, more stuff.
Add support for the following drawing functions:
- drawBitmap(int[]...)
- drawPaint()

Optimizes shader state changes by enabling/disabling attribute arrays
only when needed.

Adds quick rejects when drawing trivial shapes to avoid unnecessary
OpenGL operations.

Change-Id: Ic2c6c2ed1523d08a63a8c95601a1ec40b6c7fbc9
2010-07-12 20:20:03 -07:00
Romain Guy
260e102162 Optimize shader binding changes.
This change also cleans up the internal API a little bit by using mat4
everywhere instead of float[16] (for the ortho matrix for instance.)

Change-Id: I35924c7dc17bad17f30307118d5ed437c2ed37e0
2010-07-12 14:43:40 -07:00
Romain Guy
0b9db91c3d Remove math from the vertex shader.
Change-Id: I02847a60a8734bf8b3d29ec12e76297795095e38
2010-07-09 18:53:25 -07:00
Romain Guy
16202fc974 Fix alpha blending and improve fragment shaders performance.
Change-Id: Ib74f6941d25ca6f6a41708e541174eaa7e8d9bc2
2010-07-09 16:13:28 -07:00
Romain Guy
fb5e23c327 Refactoring to move vertex computing to the Patch class.
This change is mostly cleanup to keep less code in OpenGLRenderer.

Change-Id: I954375143b2943829457ab470423729b60b844f5
2010-07-09 13:52:56 -07:00
Romain Guy
82ba814ca0 Optimize blending state changes.
Change-Id: I7c22a8aecccb8b5abfcf7243f049a4ef3cf3979a
2010-07-09 13:25:56 -07:00
Romain Guy
f7f93556c8 Draw n-patches using OpenGL.
Currently only tested with title bars and buttons.

Change-Id: I8263a9281898dc0e943b1b8412827fe55639b9d6
2010-07-08 19:19:07 -07:00
Romain Guy
f18fd99b5c Create FBOs in LayerCache.
This moves a bit of code away from OpenGLRenderer and matches
what happens with the TextureCache.

Change-Id: I3c67f54f83d7240770daa015861c0e75a1dd8c42
2010-07-08 11:45:51 -07:00
Romain Guy
deba785f12 Add support to draw 9patches in OpenGL.
This change only adds the necessary API and stubs. The implementation
will be added in another change.

Change-Id: Ie50b8aff5868e78796cee331df15bdbf990d2ea1
2010-07-07 17:55:03 -07:00
Romain Guy
6c81893c62 Simpler way to deal with the FBO multi-cache.
This change removes the need for the SortedList and instead just
add a generated id to each FBO stored in the cache. This is an
artificial way to store several FBOs with the same dimensions.

Change-Id: I9638364e9bdc0f2391261937a0c86096f20505bf
2010-07-07 15:15:32 -07:00
Romain Guy
5f0c6a4839 Optimize FBO cache.
This change introduces a new generational cache called GenerationMultiCache
that can store several values with the same key. This can be used to use
multiple layers of the same size at the same time, without recreating them
over and over again.

Change-Id: I425466a20908b862c5f464a0f9e582ec18cbd7ac
2010-07-07 13:06:26 -07:00
Romain Guy
dda570201a Add a layer (FBO) cache.
The cache is used to draw layers so that a new
texture does not have to be recreated every time
a call to saveLayer() happens.

The FBO cache used a KeyedVector, which is a bad
idea. The cache should be able to store several
FBOs of the same size (this happens a lot during
scrolling with fading edges for instance.) This
will be changed in a future CL.

Change-Id: Ic316189e625f0dbcf0d273a71cc981a433d48726
2010-07-06 12:00:33 -07:00
Romain Guy
7d139ba2c3 Remove extra leftover logs and use uint32_t instead of unsigned int.
Change-Id: I944f82fe3255de38dc04048cc8bd861f578f01a7
2010-07-02 11:20:34 -07:00
Romain Guy
121e224256 Track the size in memory of the texture cache.
The texture cache was previously checking the number of stored textures. This was
not very useful as this could easily lead to an abuse of memory. The new cache
instead tracks the total size occupied in RAM by the cached textures. When a new
texture is generated, older textures are kicked out as needed.

Change-Id: Ib27142f4a018d5bf84774c1fb6f45a67a85f20bc
2010-07-01 18:26:52 -07:00
Romain Guy
f86ef57f8b Don't use full screen FBOs, this dramatically increase performance.
The next step will be to add an FBO cache to avoid churning memory on every
frame we draw. This change also adds support for drawBitmap(Bitmap, Matrix, Paint).

Change-Id: I7825cdcf0cad9bffe6219e05d8328a53d4a6e583
2010-07-01 15:27:21 -07:00
Romain Guy
8ba548f81d Add implementation for drawBitmap(Bitmap, Rect, Rect, Paint)
Change-Id: I10904d2325a5431d15801aebcec1048715678e8c
2010-06-30 19:21:21 -07:00
Romain Guy
c1396e93b6 Add implementation for drawBitmap().
Change-Id: Iada9325f3c5642b61c2e0c4cd80bcfbc92cb491e
2010-06-30 17:56:19 -07:00
Romain Guy
fe8809471a Remove unnecessary return and add bitmap generation ID tracking.
Change-Id: Icf5e0635e789f5ea53268c22fad51cf733b5b1a6
2010-06-30 16:05:32 -07:00
Romain Guy
364703c6fa Fix the build.
Change-Id: I08bd6daf25351daca3ae552e1cfcfce85eefa73b
2010-06-30 15:51:03 -07:00
Romain Guy
ce0537b800 Add hooks for drawBitmap().
Change-Id: I58e962c3a8b2bc75c2605fe369ad3002579d86e0

Add texture cache.

Change-Id: I1c0e5581d228869e114438258a1014e33e024ad7
2010-06-30 15:21:01 -07:00
Romain Guy
d55a86120d Add support for saveLayer().
saveLayer() is affected by the paint's alpha and xfermode.

Change-Id: I28693a9337052643adccdb4889a8f228d4e17903
2010-06-28 18:52:24 -07:00
Romain Guy
026c5e1670 Implement support for PorterDuff's blending modes.
The blending modes are currently hooked up only when drawing filled rects but the
code is reusable for other primitives. This will allow implementation of saveLayer().
This method is required to support the fade effects used throughout the standard
Android UI.

Change-Id: I396023d123436f16cdafc606e358e4eb80c9df2c
2010-06-28 17:12:22 -07:00
Romain Guy
5cbbce5357 Reduced the complexity of layers composition.
This change also refactors the code base a bit by moving classes out of
OpenGLRenderer into separate headers/implementations. This makes the code
more manageable.

This change also adds documentation for implementation methods. The
undocumented methods are simply Skia's Canvas methods.

Change-Id: I54c68b443580a0129251dddc1a7ac95813d5289e
2010-06-27 22:59:20 -07:00
Romain Guy
bd6b79b402 Add implementations for saveLayerAlpha() and textured rects.
Even though there's an implementation for textured rects, drawBitmap() is not
hooked up yet as it will require a good texture cache.

This method is implemented using FBOs. There's currently an issue either in the
driver or in the Canvas renderer that forces the FBO to be fullscreen, which is
extremely expensive and yields terrible performance.

Change-Id: I148419195e12d45653c60186938aa78c23a68e2c
2010-06-26 00:13:53 -07:00
Romain Guy
7ae7ac48aa Convert tabs to spaces.
Change-Id: I5d3ae48af79b19b6d293deff0521e4bb57d5114b
2010-06-25 13:46:18 -07:00
Romain Guy
c7d53494f1 Implement quickReject() and drawRect().
The OpenGL ES 2.0 renderer can now draw colored rectangles. At least there's
something on screen now.

Change-Id: I80a13ccc1dd56784edf74f2670a364f30700234a
2010-06-25 13:41:57 -07:00
Romain Guy
9d5316e3f5 Add colored rectangles implementation in OpenGLRenderer.
Drawing two rectangles one after the other discards the second one because of
Z buffering issues. This will be fixed in another changelist.

Change-Id: Ida1b3cde8a78e60cacc07e477abc44def527ff67
2010-06-24 19:30:36 -07:00
Romain Guy
f6a11b8a9e Add support for transformations.
This change adds partial support for the following transforms:
- scale()
- translate()
- rotate()
- setMatrix()
- getMatrix()

The transform is stored in a snapshot and saved/restored as needed.
The transform is currently not applied to the clip rect and is not
mapped to the vertex shader.

Change-Id: Id48993453311200804149917d0c126a4d0471226
2010-06-23 17:47:49 -07:00
Romain Guy
bb9524b6bd Add implementations for clipRect(), save() and restore().
The current implementation of clipRect() does not apply local transformations
before setting the new clip.

Change-Id: I5997871bb638dfcd1a8ef96354846af52427e445
2010-06-23 12:36:03 -07:00
Romain Guy
3e168335b3 Fix simulator build again.
Change-Id: Ifd204d64eaa4c356422e3363ec0a6e6aa61c52dc
2010-06-22 13:29:14 -07:00
Romain Guy
85bf02fc16 Fix the simulator build.
Change-Id: Ie404f7c2c308f0657f273af19a56e8c039b61898
2010-06-22 13:11:24 -07:00
Romain Guy
08ae317c21 Add glOrtho equivalent to the OpenGL ES 2.0 renderer.
Change-Id: I063dad3d81dab7833acb1e7a9c7121f8efd2a044
2010-06-21 19:35:50 -07:00
Romain Guy
e4d011201c Add libhwui, to hardware accelerate the Canvas API using OpenGL ES 2.0.
This is the initial checkin to setup the library and turn on OEGL ES 2.0
in ViewRoot, not a functional renderer.

Change-Id: I6655c54166e2967da2e21e7d6dcfba78bf113b44
2010-06-17 13:40:11 -07:00