summaryrefslogtreecommitdiffstats
path: root/libs/hwui/FontRenderer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add stroke support to polygonal shape renderingChris Craik2012-09-261-3/+2
| | | | | | | | | | | | bug:4419017 bug:7230005 - Adds support for stroke/strokeAndFill for shapes without joins - Fixes path-polygonization threshold calculation - Fixes rendering offset (now only used for points) - Several formatting fixes Change-Id: If72473dc881e45752e2ec212d0dcd1e3f97979ea
* Optimize glyph cache texture uploadsChet Haase2012-09-231-7/+10
| | | | | | | | | | | | Only upload the changed area of the glyph cache, not the entire bitmap. Note that we can't do the full-on optimization here of copying a sub-rect of the bitmap because of GL ES 2 limitations, but we can at least copy the horizontal stripe containing the dirty rect, which can still be a big savings over uploading the entire bitmap. Issue #7158326 Bad framerates on MR1 (Mako, Manta, Prime) Change-Id: Iab38d53202650f757ead4658cf4287bdad2b3cb9
* Code cleanup in FontRendererRomain Guy2012-09-041-62/+26
| | | | Change-Id: Ic788721c224a77f0a76f4cd6d9817b62e390a5a7
* Small code cleanup in FontRendererRomain Guy2012-09-041-7/+19
| | | | Change-Id: I09c00debe9b0b4f45b232cae402ed19bdaeabfe4
* Refactor FontRenderer.cppRomain Guy2012-09-041-579/+11
| | | | | | | | FontRenderer.h defined several classes and structures that now live in the font/ folder. This will make the code easier to read and maintain. Change-Id: I3dc044e9bde1d6515f8704f5c72462877d279fe2
* Paramaterize and adjust the glyph cache sizesChet Haase2012-08-311-35/+31
| | | | | | | | | Add new parameters for the texture size used for the larger, fallback caches. Bump up the defaults in some situations. Issue #7045164 Adjust cache sizes for manta Change-Id: I562118ce785d7f8b6e445178878672e9709d25f2
* Avoid thrashing the glyph cache during the precache phaseChet Haase2012-08-301-15/+17
| | | | | | | | | | | | | | | | | | | It is unlikely, but possible, to draw so many glyphs in a frame (especially of the glyphs are quite large) that the cache starts flushing itself to fit the later glyphs in. This causes unnecessary thrashing, because when we actually draw the frame, we will again need to flush to fit the earlier glyphs in, and then flush again to fit the later ones in. It is better to avoid thrashing the cache at the precache phase, and wait until we actually draw the glyphs that do not fit to do any eviction of the earlier glyphs. This change simply notes when we are in the preaching phase, and avoids flushing the cache when a glyph does not fit. Issue #7081725 avoid thrashing cache during DisplayList recording Change-Id: I230410ab5b478091b1032fa99dc1752acf868bbe
* Fix glyph cropping bugChet Haase2012-08-171-2/+2
| | | | | | | | | | | Glyphs were being stored in the glyph cache incorrectly. The second row of glyphs in any column were being positioned exactly one pixel too high, causing the preceding glyph in that column to be cropped, resulting in the reported truncation in some glyphs. Issue #7003215 Minor UI truncation while reading the mails Change-Id: I47ce376f78a04d4e07e8b7ed1b3f0b58864c5498
* Remove CacheTextureLine structure from FontRendererChet Haase2012-08-161-147/+73
| | | | | | | | | | | | | | | | | CacheTextureLine was useful before we were packing the glyph textures; it allowed simple packing of any particular texture according to how many lines there were in a texture, and how tall those lines were. Now that we are packing more efficiently (both horizontally and vertically in any given texture line), it is more efficient to have open space in every texture, removing the need for CacheTextureLine (which now gets in the way since it limits how much can be stored in each line). This change removes CacheTextureLine and just uses CacheTexture directly, allowing caching of glyphs anywhere in the open space of each texture. As before, the packing of these glyphs is determined by the CacheBlock structure, which is a linked list of open spaces in each CacheTexture. Change-Id: Id6f628170df0f676f8743ac7de76f2377fc6a012
* Glyph cache optimizationChet Haase2012-08-151-7/+4
| | | | | | | | | | Precaching at startup was not working. One-liner fix to init the caches so that precaching would kick in earlier, saving time at startup by avoiding the multiple-upload issue of caching at render time. Issue #6893691 long app launch time on manta for some apps comparing to nakasi/stingray Change-Id: Ie5c7f0536ec8ea371c7892e5e09c1db14795531c
* Optimize interactions with glyph cacheChet Haase2012-08-141-66/+230
| | | | | | | | | | | | | | | | | There are two fixes here: - precaching: instead of caching-then-drawing whenever there is a new glyph, we cache at DisplayList record time. Then when we finally draw that DisplayList, we just upload the affected texture(s) once, instead of once per change. This is a huge savings in upload time, especially when there are larger glyphs being used by the app. - packing: Previously, glyphs would line up horizontally on each cache line, leaving potentially tons of space vertically, especially when smaller glyphs got put into cache lines intended for large glyphs (which can happen when an app uses lots of unique glyphs, a common case with, for example, chinese/japanese/korean languages). The new approach packs glyphs vertically as well as horizontally to use the space more efficiently and provide space for more glyphs in these situations. Change-Id: I84338aa25db208c7bf13f3f92b4d05ed40c33527
* am 05e97e81: am 0be33f2d: Merge "Add shortcut to avoid potential divide by ↵Jean-Baptiste Queru2012-08-081-0/+5
|\ | | | | | | | | | | | | zero in some case" * commit '05e97e81a5fa2c9cab4cdda15aa2d036243a0c0e': Add shortcut to avoid potential divide by zero in some case
| * Add shortcut to avoid potential divide by zero in some caseChen YANG2012-07-251-0/+5
| | | | | | | | Change-Id: If4b34c95402daf8ebcc28736edfb2012553aa57c
* | Draw an empty border around glyphs to avoid sampling issuesRomain Guy2012-08-071-13/+22
| | | | | | | | | | | | | | | | | | | | Bug #6942209 The font renderer was preserving a 1 px border around each glyph to ensure bilinear filtering would work nicely. Unfortunately, this border was not set to 0 when glyphs were added in the cache to replace old evicted glyphs. Change-Id: Ib85afca7ebad5cb63f960dc0e87ae162333dbfe8
* | Merge "Add drop shadow for drawPosText in hwui renderer."Raph Levien2012-07-201-5/+5
|\ \
| * | Add drop shadow for drawPosText in hwui renderer.Raph Levien2012-07-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for drop shadows (setShadowLayer) for drawPosText in the hwui renderer. In and of itself, it's not very important, but it's on the critical path for correct mark positioning, tracked as bug 5443796. The change itself is fairly straightforward - it basically just adds an extra "positions" argument to all draw and measure methods on the code path for drawing drop shadowed text, as well as to the cache key for cached shadow textures. Change-Id: Ic1cb63299ba61ccbef31779459ecb82aa4a5e672
* | | Fix crash with new LookupGammaFontRendererRomain Guy2012-07-201-2/+1
|/ / | | | | | | | | | | Bug #6853934 Change-Id: I15e6ca73bfe00eff1a37c4b9d2f7f709ee018eb6
* | Refactor GammaFontRendererRomain Guy2012-07-131-4/+13
|/ | | | | | | This change is the first step to a shader-based text antialias gamma correction. Change-Id: I9eb02d4c56cb95d05219f712290c865b46141954
* Textured text calls could be invisibleRomain Guy2012-06-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Bug #6597730 Text would sometimes not appear when rendered with textured content (BitmapShader, LinearGradientShader, etc.) This was due to a misuse of OpenGL texture unit in FontRenderer. Textured text normally uses two texture units: - texture unit 0 for the font cache - texture unit 1 for the textured content (gradient, etc.) Recent changes to the font renderer allow it to bind new textures while processing the text's geometry (this happens when caches get full or when switching font size for instance.) The bindings were done without ensuring the texture unit was the correct one (unit 0), thus replacing the content of another texture unit (unit 1). This lead to text being drawn using the font cache itself as the content texture, making the text invisible. Change-Id: I392b4c884f09223305f6cbc6253e2ef9a98944c9
* Forget the name of a texture after freeingRomain Guy2012-05-141-4/+8
| | | | | | | | | | | | | | | | | Bug #6408362 FontRenderer allocates large font textures when more room is needed to store all the glyphs used by an application. Thse large textures are the first to be freed when memory needs to be reclaimed by the system. When freeing a texture, the renderer would however not set the texture name to an invalid name, leading future allocations to be performed on the same texture name. That name could have by then be recycled by the driver and returned by a call to glGenTexture and used to create an entirely different texture. This would cause the font renderer to point to the wrong texture, thus leading to the "corruptions." Change-Id: I8a1e80e5b79e8f21d1baf5320c090df4f2066cd4
* Fix two memory leaksRomain Guy2012-05-141-11/+24
| | | | | | Bug #6408362 Change-Id: I58543938e7b64d83504e11e97b0dd21ef8ebf3b6
* Properly pre-cache latin glyphsRomain Guy2012-05-141-10/+12
| | | | | | Bug #6408362 Change-Id: Ie11644c5a9e2d87d3b851b7e619e5f04b60a7e02
* Use a status_t return type for GL functorsRomain Guy2012-03-261-1/+1
| | | | | | | | | WebView needs more fine-grained control over the behavior of the framework upon execution of the display lists. The new status_t allows WebView to requests its functor to be re-executed directly without causing a redraw of the entire hierarchy. Change-Id: I97a8141dc5c6eeb6805b6024cc1e76fce07d24cc
* Prevent random crashes on SGX architectureRomain Guy2012-03-261-0/+2
| | | | | | Bug #6219894 Change-Id: If77f29da03e557a50e53bae505e1c638a1dbe2cc
* Plug memory leak.Romain Guy2012-03-211-0/+2
| | | | | | | | | | | | Bug #6196903 Whenever a memory flush happens, the GL renderer discards some or all of its font caches. Each font cache holds an array of vertex indices that was initially designed to have the same life cycle as the process. This changed when memory flushes were introduced but this array was never taken care of in the destructor. Change-Id: Ief124f609ea55b671c0a9b43637d9e013629ebaa
* Small tweak to Canvas.drawPath() GL implementationRomain Guy2012-03-011-9/+8
| | | | Change-Id: I1d668a912996e1267bcf2127058888e489a2d9b3
* Full implementation of Canvas.drawPath()Romain Guy2012-02-291-19/+145
| | | | Change-Id: I23223b89770a0cd2b4762365bead9bfddb094290
* Disable debugging code in the font rendererRomain Guy2012-02-021-1/+3
| | | | Change-Id: I92463057ff4ae712bb25789db1667ff1ecfd389f
* Full support for Canvas.drawPosTextRomain Guy2012-01-181-50/+112
| | | | | | This also introduces a small optimization when rendering text. Change-Id: Iff620ac97bf878eaac406bccc6daa07052c93890
* Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGESteve Block2012-01-081-4/+4
| | | | | | | See https://android-git.corp.google.com/g/#/c/157220 Bug: 5449033 Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
* De-allocate caches for large glyphs when trimming memoryChet Haase2011-12-161-2/+39
| | | | | | | | | | | | | Currently, font renderers eliminate some texture caches when memory is trimmed. This change makes it go further by eliminating the large-glyph caches for all font renderers. These caches are only allocated as needed, but continue to consume large amounts of memory (CPU and GPU) after that allocation. De-allocating this memory on a trim operation should prevent background apps from holding onto this memory in the possible case that they have allocated it by drawing large glyphs. Change-Id: Id7a3ab49b244e036b442d87252fb40aeca8fdb26
* Fix issues from recent glyph caching changeChet Haase2011-12-151-19/+31
| | | | | | | | | | | | | There were 2 issues remaining after a recent change to support glyph caching from multiple textures: - memory in the GPU for all textures was being allocated automatically. This is now lazy, being allocated only when those textures are first needed. - filtering (applied when a rendered object is transformed) was ignoring the new multiple-texture structure. Filtering should be applied correctly whenever we change textures. Change-Id: I5c8eb8d46c73cd01782a353fc79b11cacc2146ab
* Reduce the number of active texture changesRomain Guy2011-12-131-2/+10
| | | | Change-Id: I94046bdfe20740c26c8183822e3002d692fde7c4
* Merge "Make glyph cache more flexible"Chet Haase2011-12-131-87/+142
|\
| * Make glyph cache more flexibleChet Haase2011-12-131-87/+142
| | | | | | | | | | | | | | | | | | | | Some GPU architectures could not handle the previous implementation of our glyph cache. Frequent uploads would cause memory problems in the GPU and eventually a crash due to these memory issues. The solution is to move to a system of several, smaller caches instead of one monolythic cache for all glyphs. Change-Id: I0fc7a323360940d16d5a33eeb33abfab194c5920
* | Reduce the number of GL commands generated by the UIRomain Guy2011-12-131-3/+14
|/ | | | | | | | This optimization along with the previous one lets us render an application like Gmail using only 30% of the number of GL commands previously required Change-Id: Ifee63edaf495e04490b5abd5433bb9a07bc327a8
* Optimize state changesRomain Guy2011-12-121-13/+0
| | | | Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
* Minimize the amount of data uploaded to draw textRomain Guy2011-12-121-20/+21
| | | | Change-Id: I6313ac039291c9cd93aadafe3566ad9d60cab42d
* Fix crash in existing applicationsRomain Guy2011-11-281-2/+10
| | | | | | | | | Bug #5659476 The FontRenderer was not cleaning up its temporary state, leading to crashes when invoking renderDropShadow. Change-Id: I43b24820dd5625af8c080bbe11b64de2f74164b2
* Stupid fixed point math.Romain Guy2011-10-071-7/+7
| | | | | | Bug #5423215 Change-Id: I39379e1f8fb4d59de4ede6e4fe7cf7a2c7cc625a
* Text would disappear when the font size is 75px.Romain Guy2011-08-301-2/+2
| | | | | | | | Bug #5230196 Yes, 75px. Any other font size would work. Don't ask. Change-Id: I96c7db9926a97f65128d60c8238c3640ee2444ba
* Paint style and stroke width affect text rendering.Romain Guy2011-08-021-6/+15
| | | | | | Bug #5112207 Change-Id: Ic34037ace21a5058ba23dd15e51aae58c998454d
* Add support to OpenGLRendere to draw BiDi text.Romain Guy2011-06-011-21/+22
| | | | | | Bug #4350336 Change-Id: I1cf31693f7ca9653fa3a41b5b91c27ef288d680f
* Enable large font rendering with GPU accelerationChet Haase2011-05-191-5/+34
| | | | Change-Id: I7b022100fb0762613f9cf7753dbb0217e1e75f8d
* Fix problem with glyph cache and textScaleX propertyChet Haase2011-03-021-6/+9
| | | | | | | | | | Glyphs drawn with paints that had different textScaleX values were not being recognized as different, so the glyph cache was being used regardless of different scaleX values. This change adds the scaleX attribute to the native Font object to allow the cache to distinguish between this difference and cache accordingly. Change-Id: I5d8fc26d47460b27dc8e373a473d46b2f1b8dc30
* Fixing font renderer attribute slot locations.Alex Sakhartchouk2011-02-171-7/+9
| | | | Change-Id: I6377bb641df7d8372d873c00790189f9a190afd6
* Log only 1 line per process when using OpenGLRenderer.Romain Guy2011-01-211-5/+12
| | | | Change-Id: Idbdd6b84f31301e58ed53e0d50fd61fece192dfa
* Don't attempt to create empty layers.Romain Guy2011-01-191-5/+13
| | | | | | Bug #3369888 Change-Id: Ic17bbd1c04bbf760cb17d0eb9e6767fd6479948c
* Add support for Paint::setTextSkewX in OpenGLRenderer.Romain Guy2011-01-181-6/+13
| | | | | | Bug #3360888 Change-Id: I42e81a1f10bf7b9ae1c63ca8add1878fd59a1e8a
* The font cache should respect the fake bold flag.Romain Guy2011-01-051-26/+30
| | | | Change-Id: Ie4edc9ba46610edde831b55e769944e9a19bdcb5