The generator supports features that are not yet implement in the
renderer: color matrix, lighting, porterduff color blending and
composite shaders.
This change also adds support for repeated/mirrored non-power of 2
bitmap shaders.
Change-Id: I903a11a070c0eb9cc8850a60ef305751e5b47234
With this change, all the vertex and fragment shaders used by the GL
renderer are now generated based on a program description supplied
by the caller. This allows the renderer to generate a large number
of shaders without having to write all the possible combinations by
hand. The generated shaders are stored in a program cache.
Change-Id: If54d286e77ae021c724d42090da476df12a18ebb
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
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
The renderer is still changing textures' wrap modes every time, this will require
a latter optimization.
Change-Id: I3eb92cb8c886c4a692b7f0ca759911f9371d4d2c
This change also modifies the way the clip is stored. The clip is now
always stored in screen-space coordinates.
Change-Id: I96375784d82dfe975bc6477a159e6866e7052487
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
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
This change only adds the necessary API and stubs. The implementation
will be added in another change.
Change-Id: Ie50b8aff5868e78796cee331df15bdbf990d2ea1
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
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
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
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
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
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
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
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
The OpenGL ES 2.0 renderer can now draw colored rectangles. At least there's
something on screen now.
Change-Id: I80a13ccc1dd56784edf74f2670a364f30700234a
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
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
The current implementation of clipRect() does not apply local transformations
before setting the new clip.
Change-Id: I5997871bb638dfcd1a8ef96354846af52427e445