532 Commits

Author SHA1 Message Date
Derek Sollenberger
674554fc36 Reapply "Refactor setting an SkPaint onto a hwui Layer."
This reverts commit 90d0c75e94a32fb7d993fae69762820aabc2fcbb.

Change-Id: Ie807761231edf7c848b019931dccbf466208c0be
2014-02-20 16:20:33 -05:00
ztenghui
ef94c6f88f Separate spot and ambient shadow strength setting
Change-Id: I4530e618b09a7f44b5382f8a40646c0ebf5f214c
2014-02-13 17:09:45 -08:00
Derek Sollenberger
76d3a1b8d0 Removing SkiaColorFilter and inspecting the native object directly.
bug: 10650594
Change-Id: I4fcf66d008765afa0e35d011f58bc792183cb74f
2014-02-07 17:06:14 -05:00
Derek Sollenberger
d44fbe55a9 Keep the SkPaint used when creating a layer.
This will allow us to inspect the paint for thing other than
color and xfermode, such as SkColorFilters and SkShaders.

bug: 10650594
Change-Id: I2c3ddd07a3966e1e77af34136307e2b59b2898c1
2014-02-07 13:33:29 -05:00
Chris Craik
a2fe7affd3 Add initial hidden outline APIs
Background drawable outline usage and drawable outline calculation
still to come.

Change-Id: I8c7539f1638f86e1f8eb11f4fe49f705f61d58ba
2014-01-30 16:04:16 -08:00
Chris Craik
5e1814e2eb Merge "Remove logging of DisplayList staleness" 2014-01-28 23:18:05 +00:00
Chris Craik
3783e70b55 Remove logging of DisplayList staleness
Change-Id: Ie6b3af3065d4d10ec0bc9b419223d3458d297ea8
2014-01-27 14:29:37 -08:00
Chris Craik
15a07a21eb Use path outlines to define shadow shapes
Fixes the simplifying assumption that shadow casters were always
rectangular.

Java side APIs + plumbing to pass down correct shapes still need to be added.

Change-Id: Ic4fee90af15679951a44bb5cc6ae454b98c4c194
2014-01-26 13:43:53 -08:00
Chris Craik
bb615a6ffb Clear root level reorder lists to prevent accessing stale DisplayLists
bug:12581401

Adds temporary logging which should log/crash earlier on incorrectly
reordering hierarchies.

Change-Id: Iee00940718c3cc868161e754aff93cd3b2747094
2014-01-24 15:01:40 -08:00
ztenghui
cc3c25622c Property support for light positioning.
Tune up the light size to make it look better.

Change-Id: I139a05f3dd53dacbe55759b91188f0e1cc2c7f80
2014-01-17 13:42:09 -08:00
Chris Craik
3197cded4e Map shadow light position globally
Change-Id: Ic3201cecdf5d2a1dd628e7e40aee912ef516d3b2
2014-01-16 14:03:39 -08:00
ztenghui
7b4516e7ea Calculate and show the shadow from a spot light.
Change-Id: Ia558852e8cde5d33866b22875eb501e4c6858819
2014-01-10 17:18:53 -08:00
Chris Craik
d218a92c0a Use const where possible for drawing parameters
They should never be modified by a Renderer, only read and copied.

Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
2014-01-03 13:55:08 -08:00
Chris Craik
564acf7c9b Fix Clang warnings/errors
Fix several build warnings (struct != class, int != size_t) and errors
(variable leng non-POD arrays).

Change-Id: I70b4e784365514303d8954bfcb1f39d7c22c1321
2014-01-02 16:52:32 -08:00
Chris Craik
d6b65f6771 Use const access to snapshot from OpenGLRenderer
Additionally, move clipping methods to StatefulBaseRenderer

Change-Id: Iff232bf16fc1ad3b7d89493da6d8915db7bc5e4f
2014-01-02 12:57:41 -08:00
Chris Craik
14e513058e Move Snapshot management to intermediate StatefulBaseRenderer class
The eventual goal is for the StatefulBaseRenderer to serve as the
common base class between the DisplayListRenderer and OpenGLRenderer.

This will separate DisplayList recording, Snapshot stack management,
and the GL in OpenGLRenderer.

Additionally, avoid sp<> parameters, and use const parameters in
several places, with the intent of greatly reducing the surface area
where renderer subclasses can modify snapshot stack.

Next steps:
-move bulk of clipping logic into StatefulBaseRenderer
-disable direct snapshot access

Change-Id: Ibc3c6747134ec7daf8ea535866239fa73b874390
2014-01-01 13:59:13 -08:00
Chris Craik
b458942bb6 Create abstract base class for OpenGLRenderer
This will eventually serve as a base class to allow
DisplayListRenderer to split off from OpenGLRenderer, and could
eventually support other rendering approaches, such as an
SkCanvas/SkPicture.

This will also be the main source of (implementation-independent)
documentation of the canvas/renderer methods.

Change-Id: I52047f338f5cf86a3b0b3002af7154bff5c3c227
2013-12-27 14:40:06 -08:00
Chris Craik
ba9b613437 Create private properties on GLCanvas for experimentation with 3d
Change-Id: I17772f61efce727cb4c1111f4d97f58c741786b8
2013-12-16 14:57:00 -08:00
ztenghui
55bfb4e728 Calculate and show Ambient shadow.
Basically we compute the shadow as a strip of triangles, whose alpha value
is the strength of the shadow.
We use the normal to extend the geometry.
And we use static function and try to avoid new/malloc in the computation.

Change-Id: I382286f1cad351bd5ff983f76f446c075819dcaf
2013-12-13 17:25:47 -08:00
Chris Craik
18809c063b Merge "3d view system!" 2013-12-13 21:55:50 +00:00
Chris Craik
f57776b2d1 3d view system!
True 3d transformations are now supported by DisplayLists and the
renderer, initially with the translationZ property on view.

Renderer operations used directly by DisplayList (formerly,
clip/save/restore/saveLayer) are now more simply managed by allocating
them temporarily on the handler's allocator, which exists for a single
frame. This is much simpler than continuing to expand the pool of
pre-allocated DisplayListOps now that more operations are called
directly by DisplayList, especially with z ordered drawing.

Still TODO:
-APIs for camera positioning, shadows
-Make Z apis public, and expose through XML
-Make invalidation / input 3d aware

Change-Id: I95fe6fa03f9b6ddd34a7e0c6ec8dd9fe47c6c6eb
2013-12-12 10:18:23 -08:00
John Reck
6304919732 Unbreak display list debug dumping
Change-Id: I1c6a79f047b29fa60907f6e128cb843a45b88bff
2013-12-10 15:22:01 -08:00
Leon Scroggins III
4b9a19a8f8 Call SkBitmap::config() instead of ::getConfig()
getConfig() has been deprecated.

Change-Id: I32066256ab82ac4760c752c80856d1b56d291fae
2013-12-03 15:23:11 -05:00
Chris Craik
f0a590781b Clean up quick rejection, especially surrounding points + lines.
bug:4351353

quickReject and quickRejectNoScissor have been renamed and refactored:
- to make the scissor side effect clear and explicit
- dangerous methods no longer public
- to make the simple quick reject check logic const
- simple quick reject is now conservative

This CL also fixes several issues with line and point quickRejection -
sub-pixel and hairline lines are much less likely to be incorrectly
rejected, especially at small canvas scale.

Additionally, alpha modulation for AA points < 1px in size is now
correct, dumplicating SW behavior (similar to lines and stroked
shapes work).

Change-Id: Ibb0710c721b9fb415d05acf54dd3d2b4d602156a
2013-11-22 11:36:12 -08:00
Chris Craik
4063a0e03b Clean up modelView matrix logic
bug:11359533

Also changes shader matrix to correctly account for modelView and
currentTransform()

Change-Id: I6ce18857dc6d08ea08ca7535385c2ad351ec3caa
2013-11-18 12:51:08 -08:00
Chris Craik
16e7d730c5 am 2f70da2b: am 6ed16a89: am 0b807d2e: Merge "Update the layer\'s alpha value upon composition of the layer"
* commit '2f70da2bc5ce9f4766395cc9d848f0afe8f6a2a9':
  Update the layer's alpha value upon composition of the layer
2013-11-06 16:15:38 -08:00
Chris Craik
2f70da2bc5 am 6ed16a89: am 0b807d2e: Merge "Update the layer\'s alpha value upon composition of the layer"
* commit '6ed16a89d836a33b9242f91b05e8ecb149abf909':
  Update the layer's alpha value upon composition of the layer
2013-11-06 16:09:54 -08:00
Digish Pandya
a5ff739d3c Update the layer's alpha value upon composition of the layer
Fixes: This patch makes sure that the layer's alpha value is
up-to-date and does not reflect the previous view's alpha value.
it fixes the square block on marquee fading edge when text view
is applied transparency.

Change-Id: I110649db72a75fecc02ba56c201a05773f80328c
2013-11-05 09:22:37 +05:30
Chris Craik
e63f7c622a Clean unused parameters, disable warnings
Change-Id: Iddb872f53075dd022eeef45265594d1c6a9e2bc0
2013-10-17 10:37:15 -07:00
Chris Craik
5caebe4c7c am bd842f96: am d8a84a86: Merge "Correct bitmap merging logic" into klp-dev
* commit 'bd842f96ed4a9b7887be4702828ea0034d66ef85':
  Correct bitmap merging logic
2013-09-20 17:37:20 -07:00
Chris Craik
996fe65634 Correct bitmap merging logic
bug:10863163

This fixes two issues

The check for pure translation was incorrect. It was fixed and renamed
for clarity.

Certain matrix paths weren't setting kTypePositiveScale. For
simplicity (and because positive scale is simple to check) removed
flag in favor of dynamic checking.

Change-Id: Ic5ce235653ef49a68b8b242bd89fc2e95874ecc9
2013-09-20 17:25:31 -07:00
Chris Craik
2765c0b716 resolved conflicts for merge of d97303a7 to master
Change-Id: I29e2e64e0ec241675762482cbe5c5e9dc58adca6
2013-09-17 19:17:12 -07:00
Chris Craik
32f05e343c Conservatively estimate geometry bounds
bug:10761696

Avoids a case where a rect with top coordinate of (e.g.) 0.51f is
assumed to not draw in the first row of pixels, which leads to it not
being clipped. Since rounding can cause it to render in this first
pixel anyway, we very slightly expand geometry bounds.

Now, in ambiguous cases, the geometry bounds are expanded so clipping
is more likely to happen.

Change-Id: I119b7c7720de07bac1634549724ffb63935567fc
2013-09-17 17:48:14 -07:00
John Reck
2f93af4574 am 53760b4a: am 874ae2ad: Merge "Fix scissor for functor invocation" into klp-dev
* commit '53760b4a97fb2f88e94da73d647ff80221b3c454':
  Fix scissor for functor invocation
2013-09-10 14:08:12 -07:00
John Reck
25d2f7bc1f Fix scissor for functor invocation
Bug: 10677765
 enableScissor() must precede setScissorFromClip() as
 otherwise setScissorFromClip() doesn't do anything.
 Also make sure to call setScissorFromClip() if
 enableScissor() returns true as enableScissor() calls
 resetScissor() if the scissor state has changed.

Change-Id: I9226b20bb256c92066aae344e4e6407540b6eae9
2013-09-10 20:45:29 +00:00
Chris Craik
815fbbdfca am 7ff37ada: am ff2c22e2: Merge "Move functor GL setup to just before functor" into klp-dev
* commit '7ff37ada138d9023e9d646f7195ae761a7b83ff2':
  Move functor GL setup to just before functor
2013-08-26 15:12:06 -07:00
Chris Craik
54f574acf4 Move functor GL setup to just before functor
bug:10399469

Because the stencil setup can issue draws, it *must* come before the
GL state setup.

Change-Id: I52a36213549fc60b091a90cbb923a1f0d35f9a65
2013-08-26 11:23:46 -07:00
Romain Guy
2f7c6f04cc am dfb79408: am 5b8efc47: Merge "Add overdraw debugging that accounts for Deuteranomaly" into klp-dev
* commit 'dfb79408892b3f168204c54a9b81d813921fb0f9':
  Add overdraw debugging that accounts for Deuteranomaly
2013-08-21 12:02:35 -07:00
Romain Guy
627c6fd913 Add overdraw debugging that accounts for Deuteranomaly
Change-Id: I31f68a07aa7cf0490d2572e24e4c5ac2066a1151
2013-08-21 11:53:18 -07:00
Romain Guy
3380cfdc77 Replace float arrays with readable names
Change-Id: I32a8be560b60a4ac5cbee2fec4574b2c5df9f825
2013-08-15 17:00:10 -07:00
Romain Guy
003123004f Remove an unnecessary allocation
Also remove dead code from OpenGLRenderer.cpp

Change-Id: I7eb54ca19e77ee3c32f1fe9513a031e6b2e115cf
(cherry picked from commit 5c7d5ab878b26f855175a3305a14ac12fcacf25e)
2013-08-09 03:52:29 +00:00
Chris Craik
b213cec0ce Merge "Fix quickReject's handling of AA ramp geometry" 2013-08-02 20:34:38 +00:00
Chris Craik
5e49b307eb Fix quickReject's handling of AA ramp geometry
By having quickReject round out the window-space geometry bounds, we
prevent the AA perimeter (which falls outside the local bounds passed
in) from drawing outside the clip.

Change-Id: I8ee36be9039a9c47906815ee2f0dbaa5eb910b82
2013-08-02 11:29:22 -07:00
Romain Guy
b7b93e0089 Fix region clipping bugs
See external bug #58344

Change-Id: Iecd6c41fc8076cd76add2335d3442a6dd8878f12
2013-08-01 15:35:24 -07:00
Victoria Lease
1e546815bb Support RGBA fonts and bitmap fonts (and RGBA bitmap fonts)
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
2013-07-31 15:50:47 -07:00
Chris Craik
98427708a8 Merge "Ensure glActiveTexture is cleaned up correctly on functor resume" 2013-07-22 23:31:20 +00:00
Chris Craik
9ab2d18475 Ensure glActiveTexture is cleaned up correctly on functor resume
Change-Id: I103d7d63b17289d599c2c08dcc442cfba9b8e51d
2013-07-22 16:21:55 -07:00
Romain Guy
448455fe78 Use global indices array to draw layers
An array of indices local to a layer would only be necessary if
we changed the way we resolve T-junctions. Since we only ever
draw quads, let's just use the indices we use everywhere else.

This change also uses the global indices array to render list
of colored rectangles to save on the number of vertices generated
CPU-side.

Change-Id: Ia6d1970b0e9247805af5a114ca2a84b5d0b7c282
2013-07-22 14:37:21 -07:00
Chris Craik
ecca6da4ea Support stencil-based clipping for functors
bug:9070351
Change-Id: I1c54e1bea1b84b1619cce27b14f189b42cab7062
2013-07-16 13:27:18 -07:00
Romain Guy
c36fe2fc53 am 55e789db: am ed96349a: am 3d1b158e: Merge "Fix out of range glCopyTexImage2D Bug #9425270" into jb-mr2-dev
* commit '55e789dbc782be0dcaf1d4bae5f32e9e2f674152':
  Fix out of range glCopyTexImage2D Bug #9425270
2013-06-28 11:15:02 -07:00