summaryrefslogtreecommitdiff
path: root/libs/hwui/Matrix.cpp
AgeCommit message (Collapse)Author
2018-12-03Remove ; from closing namespaces in libs/hwuiChris Blume
When closing a namespace a } is sufficient. It doesn't need to be }; like closing a class or enum. Within frameworks/base/libs/hwui there is a mix between } and }; when closing a namespace. There are even mixes between a .h and the corresponding .cpp files. In a separate CL I was asked to not close with };. That was a good comment. I adopted the style from nearby code. This CL cleans up the nearby code. Test: I made sure the code still built as expected. Change-Id: Ieb314a4f48d6e33752463f3be4361fdc9be97482
2017-11-03Format the world (or just HWUI)John Reck
Test: No code changes, just ran through clang-format Change-Id: Id23aa4ec7eebc0446fe3a30260f33e7fd455bb8c
2016-05-19resolve merge conflicts of 404e2b2 to nyc-dev-plus-aospChih-Hung Hsieh
Change-Id: I3c486e83a3f2b27ee0e6bfe4e3bba3df3af758a5
2016-05-19Fix misc-macro-parentheses warnings in hwui and graphic jni.Chih-Hung Hsieh
Bug: 28705665 Change-Id: I7d1eb38a713fe6cc7f41a3cc3f2f9d0aa0114b2c
2016-03-09Partial revert of 261725fdb2962271c222a049fcdf57bbdc8363c7Chris Craik
Bug:27534946 Mapping empty rects still must be done to get correct positions for line/point rects describing strokable bounds. Change-Id: I2f9efe543e58eb438b755276585491c1256d6719
2016-02-29Fix matrix mapping of negative rectsChris Craik
bug:27381362 Also rejects ops with empty clip at record time, and short circuits clip intersection, when one is empty. Change-Id: I842612da14ad8fd9f1ba5e9e4fd027ba4e08d365
2015-08-19Remove Matrix4::load(Matrix4&)Chris Craik
bug:22320446 Change-Id: Id6d1cc9b4aea828b0cdf622ad672064d72671f8d
2015-07-14Clean up unncessary definesChris Craik
LOG_TAG and TRACE_TAG are already defined in the makefile Change-Id: I9e53e3dacbe018441edd74cb7c8c90846defee74
2015-07-07Simplify matrix copy constructor/loadChris Craik
bug:22208220 Change-Id: Id096eb8de8da0dd1687d6af9456b16ce2a1a589b
2015-01-15Fast loadInverse() implementation for the common caseRomain Guy
Most matrices used by the UI toolkit are translation matrices, whose inverses can be quickly computed by using the negated translation vector. Change-Id: I54a28a634a586085779bfc26f3a4160cd5ab2b22
2014-06-12Fix DA bugsJohn Reck
* Now aware of transform of DrawDisplayListOp * Supports projection Bug: 15539677 Bug: 15506680 Change-Id: Ic16f482cd48c3add12e49eca529281be12b93491
2014-05-08Add logging utility methodsChris Craik
Change-Id: I0f316830dcc0bbf438292a6d0fbe9f8154368500
2014-03-12Fix orthographic shadows projection, simplify shadow reorderingChris Craik
Separate matrix passed to shadow system into two parts, one for transforming the polygon XY points (using the actual draw matrix) and a separate one which respects correct 4x4 3d rotations and translations for determining Z values. Change-Id: I7e30a84774a8709df6b2241e8f51fc5583648fe8
2014-03-11Remove experimental perspective projectionChris Craik
Change-Id: Iad688c8395ccd4673cc129973802b5f01dfb45ba
2013-12-123d view system!Chris Craik
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-09-20Correct bitmap merging logicChris Craik
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-16Disallow negative scale matrices in merged Bitmap drawingChris Craik
bug:10622962 Change-Id: I55ac18ad56b53dc9e6e6ea14cd3ec4bdafa98ac3
2013-06-20An identity matrix should be considered a pure translate matrixRomain Guy
Change-Id: I75e91797e8270f902f67bdd7bb526cccc23adc6b
2013-03-05Take only the scale params into account to rasterize textRomain Guy
This change extracts the scale parameters of the current transform to pass then to the font renderer. Rotation and perspective are applied to the generated mesh inside the vertex shader. This limits the number of glyphs we have to create in the font cache and thus reduces memory churn. Change-Id: Ic5b3bae2b2b0e0250a8ee723b071a1709725c749
2013-03-05Fix colored rects clipping and code cleanupRomain Guy
The drawColorRects() method was clipping individual rectangles using the wrong parameters left, top, right and bottom instead of l, r, t and b. It also checked for count == 0 after the loop when it should have checked for vertexCount == 0. The quickReject is now not part of the loop since it's a bit overkill to perform so many matrix multiplications. What we really care about is the final quickReject performed on the max bounds of the entire set of rectangles. This change also replaces all instances of mSnapshot->transform by currentTransform() to make the code slightly more readable. Change-Id: I6485280414499716852f7dbfba186774eb6763d4
2013-02-27Properly scale textRomain Guy
This change does not apply to drawPosText() and drawTextOnPath() yet. Prior to this change, glyphs were always rasterized based on the font size specified in the paint. All transforms were then applied on the resulting texture. This creates rather ugly results when text is scaled and/or rotated. With this change, the font renderer will apply the current transform matrix to the glyph before they are rasterized. This generates much better looking results. Change-Id: I0141b6ff18db35e1213e7a3ab9db1ecaf03d7a9c
2013-02-15Remove obsolete header fileRomain Guy
We now use the same mechanism to compare keys everywhere in libhwui. Change-Id: I8b3cb25b13f4f38eb6f12aed0356f796a773617c
2013-01-17Implement clipRect with a transform, clipRegion & clipPathRomain Guy
Bug #7146141 When non-rectangular clipping occurs in a layer the render buffer used as the stencil buffer is not cached. If this happens on a View's hardware layer the render buffer will live for as long as the layer is bound to the view. When a stencil buffer is required because of a call to Canvas.saveLayer() it will be allocated on every frame. A future change will address this problem. If "show GPU overdraw" is enabled, non-rectangular clips are not supported anymore and we fall back to rectangular clips instead. This is a limitation imposed by OpenGL ES that cannot be worked around at this time. This change also improves the Matrix4 implementation to easily detect when a rect remains a rect after transform. Change-Id: I0e69fb901792d38bc0c4ca1bf9fdb02d7db415b9
2012-09-28Fix a couple of rendering issuesRomain Guy
Bug #7253839 1. Make sure we don't make GL calls while recording display lists 2. Disable an early and trivial clip optimization in font renderer when a perspective transformation is used on the Canvas Change-Id: I3f1052164239329346854f72d0a0d401fbfecf06
2012-09-20Polygonal rendering of simple fill shapesChris Craik
bug:4419017 Change-Id: If0428e1732139786cba15f54b285d880e4a56b89
2012-05-07Fix issue where scale-animating text would jump temporarily a few pixelsChet Haase
Some logic in the native matrix code would determine that a matrix was 'pureTranslate' based on the scale values of a matrix being close-enough to 1, which was within a very small epsilon. This works in general, because screen space coordinates make that epsilon value irrelevant, so close-enough really is close-enough. However, TextView, when centering text, works in a coordinate system that is quite huge, with left/right values about 500,000. These numbers multiplied times that small epsilon value would give a result that was significant, and would cause a miscalculation of up to 4-5 pixels, causing the snap that we'd see for a couple of frames as the scale got "close enough" to 1. The fix is to remove the optimization of "close enough". What we really need the matrix to do is to identify itself as being translate-only when no scale as been set (which is the default). For the purposes of that check, it is good enough to simply check the values against 1 directly. Similarly, the bounds-check logic needs to check against 0 and 1 directly. Issue #6452687: Glitch when changing scale of a view containing text Change-Id: I167fb45d02201fb879deea0e5a7ca95e38128e17
2012-01-03Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGESteve Block
See https://android-git.corp.google.com/g/156016 Bug: 5449033 Change-Id: I4c4e33bb9df3e39e11cd985e193e6fbab4635298
2011-08-16Add an API to set the transform on a TextureView's surface texture.Romain Guy
Bug #5156689 Change-Id: I635a625885c9b832a60d44ece0de7613ceb84109
2011-06-09Don't apply AA to rects with no rotation/perspective.Romain Guy
Change-Id: I21138d4d0589cc28f1dcffb8b675cd81a9900e24
2011-01-18Add support for skew()Romain Guy
Change-Id: Ia3a9a867f74fd78b61f75179e3788fdc2f0cacd0
2010-12-06Correctly render text when coordinates are not integers.Romain Guy
Bug #3225632 Change-Id: If09759e6e95eb2885362ab3ba088cf5aae64c7bf
2010-11-02Optimize FBO drawing with regions.Romain Guy
This optimization is currently disabled until Launcher is modified to take advantage of it. The optimization can be enabled by turning on RENDER_LAYERS_AS_REGIONS in the OpenGLRenderer.h file. Change-Id: I2fdf59d0f4dc690a3d7f712173ab8db3848b27b1
2010-10-18Use VBOs to render most geometries.Romain Guy
Change-Id: I4360dc4fe5693ab425450c107282b2c22db4dca7
2010-10-15Fix clipping issue in StackView.Romain Guy
Change-Id: I7ec28f25c3993a2bd7ef6399ba1923839d239905
2010-10-12Optimize 9patch rendering.Romain Guy
This change detects empty quads in 9patches and removes them from the mesh to avoid unnecessary blending. Change-Id: I4500566fb4cb6845d64dcb59b522c0be7a0ec704
2010-10-04Apply bilinear filtering on text only when necessary.Romain Guy
Change-Id: Ic903f4b5d30e9c92528c6291941896efe4729ee3
2010-09-21Add support for circular gradients to the GL renderer.Romain Guy
This change also adds full support for local transformation matrices on sweep and radial gradients. Change-Id: Id8773bc0766575190e3f3d51984fc5e57b266c3f
2010-08-17Correctly set the viewport in layers.Romain Guy
Bug #2919295 Change-Id: I16ce79ab0d5747cb01c6c1abe531da3dfd93fb54
2010-08-12Fix GC issue, fix local shader transformations.Romain Guy
Change-Id: I208bdf89815dcd18dcadd43df932a77362918435
2010-08-12Better support for rotation and perspective matrices.Romain Guy
Change-Id: I56b5ae3321735ba5ee42aafc9bc0eb399b9e75b5
2010-07-29Moved all the rendering code to the new shader generator.Romain Guy
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
2010-07-16Improve clip support (add intersect, union and replace.)Romain Guy
This change also modifies the way the clip is stored. The clip is now always stored in screen-space coordinates. Change-Id: I96375784d82dfe975bc6477a159e6866e7052487
2010-06-27Reduced the complexity of layers composition.Romain Guy
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-26Add implementations for saveLayerAlpha() and textured rects.Romain Guy
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-25Convert tabs to spaces.Romain Guy
Change-Id: I5d3ae48af79b19b6d293deff0521e4bb57d5114b
2010-06-25Implement quickReject() and drawRect().Romain Guy
The OpenGL ES 2.0 renderer can now draw colored rectangles. At least there's something on screen now. Change-Id: I80a13ccc1dd56784edf74f2670a364f30700234a
2010-06-24Add colored rectangles implementation in OpenGLRenderer.Romain Guy
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-23Add support for transformations.Romain Guy
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-23Add implementations for clipRect(), save() and restore().Romain Guy
The current implementation of clipRect() does not apply local transformations before setting the new clip. Change-Id: I5997871bb638dfcd1a8ef96354846af52427e445
2010-06-22Fix simulator build again.Romain Guy
Change-Id: Ifd204d64eaa4c356422e3363ec0a6e6aa61c52dc