aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDistanceFieldTextContext.cpp
Commit message (Collapse)AuthorAge
* Add an opaqueness hint to GrDrawState.Gravatar bsalomon2014-08-08
| | | | | | | | | | Check it when deciding whether to combine draw states. R=egdaniel@google.com, robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/446953002
* Don't compare constant color and coverage between GrDrawStates when they are ↵Gravatar bsalomon2014-08-05
| | | | | | | | | | provided by vertex attributes. R=egdaniel@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/439273007
* Fix for Chrome Canaries.Gravatar jvanverth2014-08-01
| | | | | | | | | R=bsalomon@google.com TBR=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/434623010
* Rollback text allocation changes.Gravatar jvanverth2014-08-01
| | | | | | | | | | | This also addresses an inadvertantly introduced distance field bug. BUG=399125 R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/438683006
* Add vertex bounds check for distance field rendering.Gravatar jvanverth2014-07-30
| | | | | | | | R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/432443002
* Add effect caching to distance field text.Gravatar jvanverth2014-07-30
| | | | | | | | | | | | This also is a step towards unifying GrDistanceFieldTextureEffect and GrDistanceFieldLCDTextureEffect. Committed: https://skia.googlesource.com/skia/+/137bac067306c5446bc4f9797bedc3bbaf302822 R=robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/424103002
* Revert of Add effect caching to distance field text. ↵Gravatar bensong2014-07-29
| | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/424103002/) Reason for revert: breaking Chrome canary. Original issue's description: > Add effect caching to distance field text. > > This also is a step towards unifying GrDistanceFieldTextureEffect and GrDistanceFieldLCDTextureEffect. > > Committed: https://skia.googlesource.com/skia/+/137bac067306c5446bc4f9797bedc3bbaf302822 R=robertphillips@google.com, jvanverth@google.com TBR=jvanverth@google.com, robertphillips@google.com NOTREECHECKS=true NOTRY=true Author: bensong@google.com Review URL: https://codereview.chromium.org/424173002
* Add effect caching to distance field text.Gravatar jvanverth2014-07-29
| | | | | | | | | | This also is a step towards unifying GrDistanceFieldTextureEffect and GrDistanceFieldLCDTextureEffect. R=robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/424103002
* Add vertex color support to distance field text.Gravatar jvanverth2014-07-25
| | | | | | | | | BUG=skia: R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/421563002
* Move vertex buffer setup out of drawPackedGlyph().Gravatar jvanverth2014-07-25
| | | | | | | | | | | | This gets a very welcome ~10% speedup on my Mac. Committed: https://skia.googlesource.com/skia/+/1d38619389cc1100bd516b9acbf17b7bd42d33ce R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/414573002
* Revert of Move vertex buffer setup out of drawPackedGlyph(). ↵Gravatar jvanverth2014-07-25
| | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/414573002/) Reason for revert: Breaking Ubuntu and Windows bots. Original issue's description: > Move vertex buffer setup out of drawPackedGlyph(). > > This gets a very welcome ~10% speedup on my Mac. > > Committed: https://skia.googlesource.com/skia/+/1d38619389cc1100bd516b9acbf17b7bd42d33ce R=bsalomon@google.com TBR=bsalomon@google.com NOTREECHECKS=true NOTRY=true Author: jvanverth@google.com Review URL: https://codereview.chromium.org/419943002
* Move vertex buffer setup out of drawPackedGlyph().Gravatar jvanverth2014-07-25
| | | | | | | | | | This gets a very welcome ~10% speedup on my Mac. R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/414573002
* Reduce texture uploads for font atlas.Gravatar jvanverth2014-06-19
| | | | | | | | | | Also adds upload tracing for Chrome. R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/347563005
* Push dash checks into GrContext.Gravatar egdaniel2014-06-11
| | | | | | | | | | Add class to hold stroke and dash info. R=bsalomon@google.com, robertphillips@google.com, jvanverth@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/311183002
* Gamma correction for distance field text.Gravatar jvanverth2014-06-10
| | | | | | | | | | | | | | Handles both non-LCD and LCD text. Uses a texture to look up the gamma correction values for a given text color or luminance. BUG=skia: Committed: https://skia.googlesource.com/skia/+/4d517fdbb145cb95e5e935470df331e1b6667cfc R=reed@google.com, bungeman@google.com, robertphillips@google.com, bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/258883002
* Revert of Gamma correction for distance field text. ↵Gravatar scroggo2014-06-09
| | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/258883002/) Reason for revert: Memory leaks. I suspect this is due to the lack of destructors in SkAutoGlyphCache Original issue's description: > Gamma correction for distance field text. > > Handles both non-LCD and LCD text. Uses a texture to look up the gamma correction values for a given text color or luminance. > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/4d517fdbb145cb95e5e935470df331e1b6667cfc NOTRY=true NOTREECHECKS=true R=reed@google.com, bungeman@google.com, robertphillips@google.com, bsalomon@google.com, jvanverth@google.com, mtklein@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/323513005
* Gamma correction for distance field text.Gravatar jvanverth2014-06-09
| | | | | | | | | | | Handles both non-LCD and LCD text. Uses a texture to look up the gamma correction values for a given text color or luminance. BUG=skia: R=reed@google.com, bungeman@google.com, robertphillips@google.com, bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/258883002
* Remove 1/2 pixel offsets for distance field layout.Gravatar commit-bot@chromium.org2014-05-21
| | | | | | | | | | | | | The 1/2 pixel offsets are for rounding when snapping the glyphs to integer boundaries. Since we're using subpixel layout and sampled textures, we shouldn't snap to integer boundaries. BUG=skia:2173 R=bungeman@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/298753005 git-svn-id: http://skia.googlecode.com/svn/trunk@14828 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add CPU backing store for GrAtlas to reduce texture uploads.Gravatar commit-bot@chromium.org2014-05-14
| | | | | | | | | | | | | | | | | | This change creates a temporary copy of each GrPlot on the CPU side. As we add glyphs to a plot, a dirty rectangle is tracked, and just before we render text we upload all of the dirty areas to the atlas texture. Once a plot is nearly full, we assume that we may only be adding one or two glyphs before rendering, so we delete the CPU backing memory to save space, and upload directly. BUG=366225 R=robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/269423007 git-svn-id: http://skia.googlecode.com/svn/trunk@14729 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add flag for SkGpuSurface creation to enable distance fields.Gravatar commit-bot@chromium.org2014-05-02
| | | | | | | | | | | BUG=skia:2173 R=bsalomon@google.com, reed@google.com, bungeman@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/261783004 git-svn-id: http://skia.googlecode.com/svn/trunk@14525 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix artifacts in distance field rendering due to bilerpGravatar commit-bot@chromium.org2014-04-15
| | | | | | | | | | | | | | | | | Because we were using the full distance field glyph rect, there were cases when a neighboring texel might be set to full value (e.g. we might copy the glyph over old data after a purge). This was giving artifacts, and insetting the rect by 1 solves the problem. In doing this, I discovered that removing the extra 1 texel pad around the glyph meant to handle bilerp, and insetting by 2, works just as well and saves space in the glyph atlas. R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/239333002 git-svn-id: http://skia.googlecode.com/svn/trunk@14203 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move distance field generation to the glyph cache.Gravatar commit-bot@chromium.org2014-04-14
| | | | | | | | | | | | | | Distance fields are currently created in GrTextStrike, which is the wrong place. This moves that to the glyph cache where it belongs. As part of my testing, I found that when we fall back to paths in the GrDistanceFieldTextContext it was not scaling them properly, so that's fixed in here too. R=robertphillips@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/227593010 git-svn-id: http://skia.googlecode.com/svn/trunk@14193 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2014-04-09
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@14102 2bbb7eff-a529-9590-31e7-b0007b416f81
* Don't try to render color fonts using distance fields.Gravatar commit-bot@chromium.org2014-04-08
| | | | | | | | | | | | | Adds detection of ARGB mask format, which is only used for color fonts. BUG=skia:2173 R=bungeman@google.com, reed@google.com, bsalomon@google.com, robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/224903012 git-svn-id: http://skia.googlecode.com/svn/trunk@14098 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2014-04-04
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@14058 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add LCD support for distance field text.Gravatar commit-bot@chromium.org2014-04-03
| | | | | | | | | | | | | LCD support is handled by shifting the uv coordinate by 1/3 of a pixel (transformed by the inverse CTM) to the left and right of the original texture coordinate, and using left, center, and right lookups to set the RGB values. This supports both RGB and BGR subpixel order. BUG=skia:2173 R=robertphillips@google.com, egdaniel@google.com, bungeman@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/219243012 git-svn-id: http://skia.googlecode.com/svn/trunk@14049 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add support for multiple base distance field sizes.Gravatar commit-bot@chromium.org2014-04-02
| | | | | | | | | | | | | This improves quality at higher point sizes. BUG=skia:2173 R=robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/218613014 git-svn-id: http://skia.googlecode.com/svn/trunk@14030 2bbb7eff-a529-9590-31e7-b0007b416f81
* SK_SUPPORT_LEGACY_GRTYPES to hide duplicate types from SkTypes.hGravatar commit-bot@chromium.org2014-03-28
| | | | | | | | | | | BUG=skia: R=bsalomon@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/216503004 git-svn-id: http://skia.googlecode.com/svn/trunk@13982 2bbb7eff-a529-9590-31e7-b0007b416f81
* Distance field fixes for AndroidGravatar commit-bot@chromium.org2014-03-26
| | | | | | | | | | | | | | | | | | | | - Expand glyph size by 2 on each side to compensate for bilerp lookup - Correct for Adreno tendency to drop entire tile if any pixel has divide-by-0 - Fix blurriness on Adreno by using uv coords to compute gradient instead of st coords - Add faster version for uniform scale BUG=skia:2173 Committed: http://code.google.com/p/skia/source/detail?r=13955 R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/205343008 git-svn-id: http://skia.googlecode.com/svn/trunk@13958 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of Distance field fixes for Android ↵Gravatar commit-bot@chromium.org2014-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/205343008/) Reason for revert: compile error at line 110 in GrDistanceFieldTextureEffect.cpp Original issue's description: > Distance field fixes for Android > - Expand glyph size by 2 on each side to compensate for bilerp lookup > - Correct for Adreno tendency to drop entire tile if any pixel has divide-by-0 > - Fix blurriness on Adreno by using uv coords to compute gradient instead > of st coords > - Add faster version for uniform scale > > BUG=skia:2173 > > Committed: http://code.google.com/p/skia/source/detail?r=13955 R=bsalomon@google.com TBR=bsalomon@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2173 Author: jvanverth@google.com Review URL: https://codereview.chromium.org/212953008 git-svn-id: http://skia.googlecode.com/svn/trunk@13956 2bbb7eff-a529-9590-31e7-b0007b416f81
* Distance field fixes for AndroidGravatar commit-bot@chromium.org2014-03-26
| | | | | | | | | | | | | | | | | - Expand glyph size by 2 on each side to compensate for bilerp lookup - Correct for Adreno tendency to drop entire tile if any pixel has divide-by-0 - Fix blurriness on Adreno by using uv coords to compute gradient instead of st coords - Add faster version for uniform scale BUG=skia:2173 R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/205343008 git-svn-id: http://skia.googlecode.com/svn/trunk@13955 2bbb7eff-a529-9590-31e7-b0007b416f81
* More distance field improvements:Gravatar commit-bot@chromium.org2014-03-24
| | | | | | | | | | | | | | | | | - Make sure we only use the 0,0 subpixel glyph - Copy image data into outsized buffer to ensure we capture outer edges - Change edge dump to blend better with original glyph - Edges are detected across >128 and <128 boundaries, or when there are two non-zero <128 pixels next to each other BUG=skia: R=robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/208893003 git-svn-id: http://skia.googlecode.com/svn/trunk@13916 2bbb7eff-a529-9590-31e7-b0007b416f81
* Get correct text metrics for distance fields, and fix dropouts due to thin ↵Gravatar commit-bot@chromium.org2014-03-14
| | | | | | | | | | | | | features. BUG=skia:2173 R=robertphillips@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/200423003 git-svn-id: http://skia.googlecode.com/svn/trunk@13815 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add compile flag to force usage of distance fields for all SkPaints.Gravatar commit-bot@chromium.org2014-03-12
| | | | | | | | | | | BUG=skia:2173 R=reed@google.com, robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/195213003 git-svn-id: http://skia.googlecode.com/svn/trunk@13770 2bbb7eff-a529-9590-31e7-b0007b416f81
* Enable use of distance fields via SkPaint flag.Gravatar commit-bot@chromium.org2014-03-11
| | | | | | | | | | | | | Now that distance field generation is fast enough to make it practical, this makes distances field fonts easily available to anyone who wants to try them out (i.e Chromium). BUG=skia:2173 R=reed@google.com, bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/193163003 git-svn-id: http://skia.googlecode.com/svn/trunk@13741 2bbb7eff-a529-9590-31e7-b0007b416f81
* New approach for GPU font atlasGravatar commit-bot@chromium.org2014-03-03
| | | | | | | | | | | | | In the previous code, each GrTextStrike had exclusive access to one or more GrPlots in the texture atlas. This led to poor packing when only a few glyphs were used. This change allows GrTextStrikes to share GrPlots, thereby getting much better utilization of the entire texture. BUG=skia:2224 R=robertphillips@google.com, bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/177463003 git-svn-id: http://skia.googlecode.com/svn/trunk@13636 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2014-02-15
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@13462 2bbb7eff-a529-9590-31e7-b0007b416f81
* Improved distance field samplingGravatar commit-bot@chromium.org2014-02-14
| | | | | | | | | | | | There are two different fixes here. First, it computes the distance value properly within the shader. Second, it handles anti-aliasing properly by doing a correction based on the gradient of the texture coordinates. R=bsalomon@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/149853002 git-svn-id: http://skia.googlecode.com/svn/trunk@13461 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2014-01-31
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@13258 2bbb7eff-a529-9590-31e7-b0007b416f81
* Replace factory generation of TextContexts with persistent objects.Gravatar commit-bot@chromium.org2014-01-30
| | | | | | | | | | | BUG=skia:2018 R=bsalomon@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/150743002 git-svn-id: http://skia.googlecode.com/svn/trunk@13249 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add fallback code for TextContexts that don't support all featuresGravatar commit-bot@chromium.org2014-01-30
| | | | | | | | | | | | | BUG=skia:2018 NOTRY=true R=bsalomon@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/135683006 git-svn-id: http://skia.googlecode.com/svn/trunk@13236 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2014-01-29
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@13228 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add standalone drawText for GrTextContext.Gravatar commit-bot@chromium.org2014-01-28
| | | | | | | | | | | | | | | This unifies the interface between GrBitmapTextContext and GrDistanceFieldTextContext so that they don't need special case code. The future GrNVPRTextContext will also use this interface. BUG=skia:2018 R=bsalomon@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/141863005 git-svn-id: http://skia.googlecode.com/svn/trunk@13227 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add factory class for generating various flavors of GrTextContext.Gravatar commit-bot@chromium.org2014-01-24
| | | | | | | | | | | | | | | | | | | This is the first pass of making Gr*TextContext more generic and easily subclassed. The next stage will be making GrBitmapTextContext and GrDistanceFieldTextContext more similar by moving the SkDraw loop into each subclass. BUG=skia:2018 Committed: http://code.google.com/p/skia/source/detail?r=13142 R=bsalomon@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/144283002 git-svn-id: http://skia.googlecode.com/svn/trunk@13165 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of Add factory class for generating various flavors of GrTextContext. ↵Gravatar commit-bot@chromium.org2014-01-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/144283002/) Reason for revert: Breaks Chrome. Need to fix template issue. Original issue's description: > Add factory class for generating various flavors of GrTextContext. > > This is the first pass of making Gr*TextContext more generic and easily > subclassed. The next stage will be making GrBitmapTextContext and > GrDistanceFieldTextContext more similar by moving the SkDraw loop into > each subclass. > > BUG=skia:2018 > > Committed: http://code.google.com/p/skia/source/detail?r=13142 R=bsalomon@google.com, reed@google.com TBR=bsalomon@google.com, reed@google.com NOTREECHECKS=true NOTRY=true BUG=skia:2018 Author: jvanverth@google.com Review URL: https://codereview.chromium.org/145023006 git-svn-id: http://skia.googlecode.com/svn/trunk@13143 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add factory class for generating various flavors of GrTextContext.Gravatar commit-bot@chromium.org2014-01-22
| | | | | | | | | | | | | | | | This is the first pass of making Gr*TextContext more generic and easily subclassed. The next stage will be making GrBitmapTextContext and GrDistanceFieldTextContext more similar by moving the SkDraw loop into each subclass. BUG=skia:2018 R=bsalomon@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/144283002 git-svn-id: http://skia.googlecode.com/svn/trunk@13142 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-12-20
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@12793 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move distance field font code into GrDistanceFieldTextContext.Gravatar commit-bot@chromium.org2013-12-19
| | | | | | | | | | | | | | This avoids the SkDraw path and renders the distance field glyphs directly from GrDistanceFieldTextContext. It also disables LCD, subpixel and autohinting, and removes the supporting code when rendering DF fonts. R=reed@google.com, bsalomon@google.com, robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/85653004 git-svn-id: http://skia.googlecode.com/svn/trunk@12770 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-11-12
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@12232 2bbb7eff-a529-9590-31e7-b0007b416f81
* Hook in rough distance field support for fontsGravatar jvanverth@google.com2013-11-11
R=bsalomon@google.com Review URL: https://codereview.chromium.org/41213003 git-svn-id: http://skia.googlecode.com/svn/trunk@12229 2bbb7eff-a529-9590-31e7-b0007b416f81