1081 Commits

Author SHA1 Message Date
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
8523706236 Merge "Fix Clang warnings/errors" 2014-01-03 21:35:31 +00: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
406af0293f Fix isRecording override
Change-Id: Ie73db838b749c29c6a8480ab67897492b83d337a
2014-01-02 14:56:40 -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
d863a10b28 Add initial APIs for 3d view manipulation.
Change-Id: I6de00bc577d5b3a1fbc9ca3a3b3668fcfa32b867
2013-12-20 15:15:01 -08:00
Brian Carlstrom
69d251383f Track Looper decoupling from ALooper
Change-Id: I83d1f5f6600019268c53706b7bf6d94b84931e18
2013-12-19 00:25:07 -08:00
Victoria Lease
868399cdf4 Merge "pass SkGlyphCache into updateGlyphCache()" 2013-12-18 15:25:24 +00:00
Chris Craik
8b62cda493 Check mDisplayListData before deref
bug:12191897
Change-Id: I72ed3801e72c657b9d7736b0efb33c5e7cfd5b57
2013-12-17 15:07:47 -08:00
Victoria Lease
2ee2d59b7d pass SkGlyphCache into updateGlyphCache()
Doing so prevents us from double-locking the glyph cache, thereby
effectively locking ourselves out of reusing work that we'd just done.

Bug: 11968757
Change-Id: I5c552f2d0bbe30af2ce9054ba684e7da756a0d89
2013-12-17 14:51:43 -08:00
Chris Craik
3b3508fe4f Merge "Use vertex assignment instead of manual copy" 2013-12-17 01:37:57 +00:00
Chris Craik
11a7567d6f Use vertex assignment instead of manual copy
Change-Id: I36c806e3370abca61e5bf5064f0f1a776a9ce487
2013-12-16 17:08:15 -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
Tim Murray
a038bb402b Merge "Handle user-defined cache path for RS." 2013-12-13 22:39:36 +00:00
Chris Craik
18809c063b Merge "3d view system!" 2013-12-13 21:55:50 +00:00
Tim Murray
abe55e9224 Handle user-defined cache path for RS.
Change-Id: I92e3346dca331ae6a9dfbe4f95292bc604dfd196
2013-12-13 12:58:07 -08: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
John Reck
cec24ae16e RenderThread work
Hacky prototype needs a private API to enable

Change-Id: I21e0ddf3cdbd38a4036354b5d6012449e1a34849
2013-12-09 15:57:09 -08:00
Leon Scroggins III
aec09b6b98 Merge "Call SkBitmap::config() instead of ::getConfig()" 2013-12-04 18:14:29 +00:00
Victoria Lease
43b692d9a1 Deprecate Android-specific SkPaint functions.
The following functions were problematic:
 const SkGlyph& getUnicharMetrics(SkUnichar, const SkMatrix*);
 const SkGlyph& getGlyphMetrics(uint16_t, const SkMatrix*);
 const void* findImage(const SkGlyph&, const SkMatrix*);

Replacing them with calls through SkGlyphCache solved a nasty crash
bug, so they have all been deprecated.

Bug: 11968757
Change-Id: Id746315d41aec5b211b78b172a883c2061130f08
2013-12-03 15:02:28 -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
Romain Guy
ac56414b92 am b4d4d687: am 318ae7bb: Take SkBitmap\'s stride into account when uploading textures Bug #10151807
* commit 'b4d4d68795a10401e3cb50df491a2e5d5b1ac96e':
  Take SkBitmap's stride into account when uploading textures Bug #10151807
2013-09-25 15:37:41 -07:00
Romain Guy
318ae7bb92 Take SkBitmap's stride into account when uploading textures
Bug #10151807

Change-Id: I7ba4804fa3619088fea70eb55f10519fff0bf5f0
2013-09-25 22:31:31 +00: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
d8a84a8609 Merge "Correct bitmap merging logic" into klp-dev 2013-09-21 00:33:36 +00: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
Victoria Lease
9e233b54b6 am ab99b39d: am ddc0a63d: Merge "fix emoji clipping in hw draw path" into klp-dev
* commit 'ab99b39d7d152de35ea02a364190ff325da4015b':
  fix emoji clipping in hw draw path
2013-09-20 11:20:06 -07:00
Victoria Lease
16c84069a4 fix emoji clipping in hw draw path
I guess we don't want to overwrite the last line in every RGBA glyph
with our one-line texture atlas spacer?

Bug: 10841207
Change-Id: Ief85ca58650c731e9d21dbf90942b7b44670abcc
2013-09-19 15:38:21 -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
e08e663229 am 7cb404dd: am a42ceb03: Merge "Disallow negative scale matrices in merged Bitmap drawing" into klp-dev
* commit '7cb404dda770da24aaf1b484d6575d5480cf080f':
  Disallow negative scale matrices in merged Bitmap drawing
2013-09-17 18:56:18 -07:00
Chris Craik
ce9ee16d65 Merge "Conservatively estimate geometry bounds" into klp-dev 2013-09-18 01:50:02 +00:00
Chris Craik
a42ceb03cf Merge "Disallow negative scale matrices in merged Bitmap drawing" into klp-dev 2013-09-18 01:49:32 +00: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
Chris Craik
d965bc5823 Disallow negative scale matrices in merged Bitmap drawing
bug:10622962

Change-Id: I55ac18ad56b53dc9e6e6ea14cd3ec4bdafa98ac3
2013-09-16 18:19:55 -07:00
Chris Craik
d3979bc5a7 am bb451bda: am 0d3c52d3: Merge "Fix merged operation clipping" into klp-dev
* commit 'bb451bda4a08f79b60f84242647bdb40962f01b5':
  Fix merged operation clipping
2013-09-13 17:32:06 -07:00
Chris Craik
5af5fc50c2 Fix merged operation clipping
bug:10745870

Missing 'const' meant MergingDrawBatch would never clip anything.

Change-Id: Ia6367eff94cf5f437efafbc3ba7f0da102ffd956
2013-09-13 14:44:08 -07:00
Romain Guy
b1c53942f1 am 0885b291: am 4801a4f9: Merge "Always disable the clip for layers Bug #8149344" into klp-dev
* commit '0885b291650c1b85220645943c9eab3080170aca':
  Always disable the clip for layers Bug #8149344
2013-09-12 21:42:25 -07:00
Chris Craik
7cca88352f am 3f30e67a: am 88ee0dac: Merge "Move DeferredDisplayState out of ops" into klp-dev
* commit '3f30e67afbceb185c52833cec539cc0199716ef0':
  Move DeferredDisplayState out of ops
2013-09-12 16:45:16 -07:00
Romain Guy
1de466fc91 Always disable the clip for layers
Bug #8149344

Change-Id: Ifd413cadb171232eb846b3d91b05b2d2457b9f35
2013-09-12 23:13:38 +00:00