aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyphCache.cpp
Commit message (Collapse)AuthorAge
* Fix bit rot in SkGlyphCache validate code.Gravatar herb2015-03-06
| | | | | | | | | | TESTED CFLAGS=-DSK_DEBUG_GLYPH_CACHE CPPFLAGS=-DSK_DEBUG_GLYPH_CACHE ./gyp_skia ninja -C out/Debug dm out/Debug/dm Review URL: https://codereview.chromium.org/989683002
* Fix uninitialized memory bug in the SkGlyphCache.Gravatar herb2015-03-05
| | | | | | | | | | | | | | | | | | | The core of the problem is that the system is asked to lookup the metrics for a character with id == 0. This causes a hit in the fCharToGlyphHash matching the sentinel glyph. This happens because fCharToGlpyhHash is initialized with all zeros, therefore, the fID is zero matching the char with id == 0. The fAdvanceX field of the sentinel glyph is in fact not initialized. The bigger question is now did a zero character get passed to getUnicharMetrics? The breaking code is basically as follows: wchar_t glyph = L'S'; paint.measureText(&glyph, 2); This get mischaracterized as a utf8 string instead of a utf16(?) string. Because of the little endian ordering, this is the character string 'L' '\0'. Since the size of the original string is two bytes (but a single character) the '\0' is treated as its own character and past to getUnicharMetrics. TEST: On windows failed using DrMemory. With this change does not fail. BUG=463204 Review URL: https://codereview.chromium.org/977063002
* Make the glyph array entries inline.Gravatar herb2015-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Perf Reports bin/c --match nytimes --config 8888 desk_nytimes.skp_1_mpd 1.41ms -> 1.38ms 0.98x desk_nytimes.skp_1 1.94ms -> 1.87ms 0.97x bin/c --match nytimes --config gpu desk_nytimes.skp_1_mpd 1.63ms -> 1.59ms 0.97x desk_nytimes.skp_1 1.56ms -> 1.5ms 0.97x Here are results from mac instruments: --match nytimes --config gpu --samples 10000 --skps /Users/herb/src/skia/skps Inline: Total Samples Running Time Self Symbol Name 94335 94335.0ms 98.3% 0.0 start 2365 2365.0ms 2.4% 2365.0 SkGlyphCache::getGlyphIDMetrics(unsigned short, int, int) 975 975.0ms 1.0% 975.0 SkGlyphCache::lookupMetrics(unsigned int, SkGlyphCache::MetricsType) Clean: Total Samples Running Time Self Symbol Name 96833 96833.0ms 97.3% 0.0 start 3418 3418.0ms 3.4% 3418.0 SkGlyphCache::getGlyphIDMetrics(unsigned short, int, int) 1961 1961.0ms 1.9% 1961.0 SkGlyphCache::lookupMetrics(unsigned int, SkGlyphCache::MetricsType) BUG=skia: Committed: https://skia.googlesource.com/skia/+/4c08f16b252a55e438a61f26e5581394ed177da1 Committed: https://skia.googlesource.com/skia/+/b4c29ac173e6f8844327338687248b98bc94132d Review URL: https://codereview.chromium.org/885903002
* BUG=skia:Gravatar herb2015-02-25
| | | | | | | | | | (mtklein from here on) No public API changes. TBR=reed@google.com Committed: https://skia.googlesource.com/skia/+/f8d24e2c0c7b44b7ccf20e40890514db4cde7b15 Review URL: https://codereview.chromium.org/939123002
* Revert of Make fID and MixedID calculations private (patchset #5 id:80001 of ↵Gravatar scroggo2015-02-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/939123002/) Reason for revert: This actually *does* change the public API - fID is now private, and it was being used on Android. See https://android-build.storage.googleapis.com/builds/git_master-skia-linux-volantis-userdebug/1751533/5242b865d3e9bebc650c9b326dfa9d68c8bd1f59562bf32b85301fb984dc8b26/logs/build.log?Signature=Q0el9M4kTu1KQ8u02KX9TH1Pa22y9BkDK1IW%2B9OeJJNfrDEVzLXAz0XQ%2BHHQM8xVjft06jZJva1V8InZmgjcOk6PdZQbQW6XwwsHLKsbpbAE48iTWH3AlJAAoTtj9cifzgeHW8g80IcVxwHXmINRER%2BLPz3eHGisgfTTFUoWYCc%3D&GoogleAccessId=701025073339-mqn0q2nvir9iurm6q5d00tdv7blbgvjr%40developer.gserviceaccount.com&Expires=1424786471 : In file included from frameworks/base/libs/hwui/tests/../font/Font.cpp:26:0: external/skia/src/core/SkGlyph.h: In member function 'android::uirenderer::CachedGlyphInfo* android::uirenderer::Font::cacheGlyph(const SkPaint*, glyph_t, bool)': external/skia/src/core/SkGlyph.h:157:17: error: 'uint32_t SkGlyph::fID' is private uint32_t fID; ^ frameworks/base/libs/hwui/tests/../font/Font.cpp:482:39: error: within this context newGlyph->mGlyphIndex = skiaGlyph.fID; We need to update Android in order to hide fID. Original issue's description: > BUG=skia: > > (mtklein from here on) > No public API changes. > TBR=reed@google.com > > Committed: https://skia.googlesource.com/skia/+/f8d24e2c0c7b44b7ccf20e40890514db4cde7b15 TBR=mtklein@google.com,herb@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/951353002
* BUG=skia:Gravatar herb2015-02-24
| | | | | | | | (mtklein from here on) No public API changes. TBR=reed@google.com Review URL: https://codereview.chromium.org/939123002
* Revert of Make the glyph array entries inline. (patchset #11 id:190001 of ↵Gravatar mtklein2015-02-09
| | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/885903002/) Reason for revert: Still broken. Original issue's description: > Make the glyph array entries inline. > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/4c08f16b252a55e438a61f26e5581394ed177da1 > > Committed: https://skia.googlesource.com/skia/+/b4c29ac173e6f8844327338687248b98bc94132d TBR=reed@google.com,herb@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/911513003
* Make the glyph array entries inline.Gravatar herb2015-02-09
| | | | | | | | BUG=skia: Committed: https://skia.googlesource.com/skia/+/4c08f16b252a55e438a61f26e5581394ed177da1 Review URL: https://codereview.chromium.org/885903002
* Revert of Make the glyph array entries inline. (patchset #10 id:170001 of ↵Gravatar bsalomon2015-02-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/885903002/) Reason for revert: I suspect this is causing the off-by-one character issues that show up in gold.skia.org as of now. All the errors I've seen are on a Win7 bot. Example: good: https://gold.skia.org/img/images/35396bb0d299b81c0031dc0632a019d4.png bad: https://gold.skia.org/img/images/484e511f9e696d95031cd25aeae59da0.png Original issue's description: > Make the glyph array entries inline. > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/4c08f16b252a55e438a61f26e5581394ed177da1 TBR=mtklein@google.com,reed@google.com,herb@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/897463004
* Make the glyph array entries inline.Gravatar herb2015-02-02
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/885903002
* Make char hash dynamic when needed.Gravatar herb2015-01-28
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/880383002
* Use murmur3 finisher to improve font hash efficiency.Gravatar reed2015-01-28
| | | | | | | | | | Add dump() method to inspect glyphcache strikes. Murmur addition improves hash efficient roughly 50% BUG=skia: Review URL: https://codereview.chromium.org/877113002
* Revert of patch from issue 885453002 at patchset 20001 ↵Gravatar mtklein2015-01-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (http://crrev.com/885453002#ps20001) (patchset #1 id:1 of https://codereview.chromium.org/881953002/) Reason for revert: ==32435==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x621000d8cd00 Lots of info here: http://build.chromium.org/p/client.skia/builders/Test-Ubuntu13.10-GCE-NoGPU-x86_64-Debug-ASAN/builds/1198/steps/dm/logs/stdio Original issue's description: > patch from issue 885453002 at patchset 20001 (http://crrev.com/885453002#ps20001) > > Make the char cache dynamic in SkGlyphCache > because it is rarely used. > > Landing on behalf of Herb. > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/95faa61d63a6f62916f6f7be58c4624da8357e3b TBR=mtklein@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/881023003
* patch from issue 885453002 at patchset 20001 ↵Gravatar mtklein2015-01-27
| | | | | | | | | | | | | (http://crrev.com/885453002#ps20001) Make the char cache dynamic in SkGlyphCache because it is rarely used. Landing on behalf of Herb. BUG=skia: Review URL: https://codereview.chromium.org/881953002
* Remove distance field generation and storage from SkGlyphCache.Gravatar jvanverth2015-01-07
| | | | | | BUG=skia:3103 Review URL: https://codereview.chromium.org/834103004
* Require SK_DECLARE_STATIC_LAZY_PTR is used in global scope.Gravatar mtklein2014-10-13
| | | | | | | | | | | | | Function- or method- local scope isn't threadsafe; the pointer is generally zero-initialized on first use in function scope (i.e. lazily... we have to go deeper), but for globals we can be pretty sure the linker will do that for us. BUG=skia: No public API changes. TBR=reed@google.com Review URL: https://codereview.chromium.org/651723003
* "NULL !=" = NULLGravatar bsalomon2014-09-05
| | | | | | | | R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/544233002
* Remove unused SkGlyphCache::VisitAllCaches.Gravatar bungeman2014-08-18
| | | | | | | | R=reed@google.com Author: bungeman@google.com Review URL: https://codereview.chromium.org/472153002
* Port most uses of SkOnce to SkLazyPtr.Gravatar mtklein2014-06-02
| | | | | | | | | | | | | | BUG=skia: Committed: http://code.google.com/p/skia/source/detail?r=15006 Committed: http://code.google.com/p/skia/source/detail?r=15014 R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/304383005
* Revert of Port most uses of SkOnce to SkLazyPtr. ↵Gravatar commit-bot@chromium.org2014-05-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/304383005/) Reason for revert: linux x86-64 release segfault in src/ports/SkFontHost_fontconfig.cpp:107 http://108.170.220.120:10117/builders/Test-Ubuntu12-ShuttleA-GTX660-x86_64-Release/builds/905/steps/RunTests/logs/stdio Original issue's description: > Port most uses of SkOnce to SkLazyPtr. > > BUG=skia: > > Committed: http://code.google.com/p/skia/source/detail?r=15006 > > Committed: http://code.google.com/p/skia/source/detail?r=15014 R=reed@google.com, mtklein@chromium.org TBR=mtklein@chromium.org, reed@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: mtklein@google.com Review URL: https://codereview.chromium.org/306063004 git-svn-id: http://skia.googlecode.com/svn/trunk@15015 2bbb7eff-a529-9590-31e7-b0007b416f81
* Port most uses of SkOnce to SkLazyPtr.Gravatar commit-bot@chromium.org2014-05-30
| | | | | | | | | | | | | | BUG=skia: Committed: http://code.google.com/p/skia/source/detail?r=15006 R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/304383005 git-svn-id: http://skia.googlecode.com/svn/trunk@15014 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of Port most uses of SkOnce to SkLazyPtr. ↵Gravatar commit-bot@chromium.org2014-05-30
| | | | | | | | | | | | | | | | | | | | | | | | | | (https://codereview.chromium.org/304383005/) Reason for revert: Leaking refs on SkTypeface on Macs. Original issue's description: > Port most uses of SkOnce to SkLazyPtr. > > BUG=skia: > > Committed: http://code.google.com/p/skia/source/detail?r=15006 R=reed@google.com, mtklein@chromium.org TBR=mtklein@chromium.org, reed@google.com NOTREECHECKS=true NOTRY=true BUG=skia: Author: mtklein@google.com Review URL: https://codereview.chromium.org/304283007 git-svn-id: http://skia.googlecode.com/svn/trunk@15009 2bbb7eff-a529-9590-31e7-b0007b416f81
* Port most uses of SkOnce to SkLazyPtr.Gravatar commit-bot@chromium.org2014-05-30
| | | | | | | | | | | BUG=skia: R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/304383005 git-svn-id: http://skia.googlecode.com/svn/trunk@15006 2bbb7eff-a529-9590-31e7-b0007b416f81
* Clean up global gSkSuppressFontCachePurgeSpew.Gravatar commit-bot@chromium.org2014-05-12
| | | | | | | | | | | | | | | | | | No one is using it except to flick it to true to shut up the spew, but the spew is already guarded by #ifdef SPEW_PURGE_STATUS. Let's leave it to SPEW_PURGE_STATUS. Noticed this specificially when TSAN complained about FontScalerBench modifying it in a thread-unsafe way. BUG=skia:1792 R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/264333008 git-svn-id: http://skia.googlecode.com/svn/trunk@14697 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add missing include for r14397.Gravatar bungeman@google.com2014-04-28
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@14398 2bbb7eff-a529-9590-31e7-b0007b416f81
* Create SkGlyphCache globals with SkOnce.Gravatar bungeman@google.com2014-04-28
| | | | | | | | | | | | VC++ will have magic statics with VS2014, but does not currently have them. The thread unsafe implementation was causing the DirectWrite bots to randomly crash when running multi-threaded tests, as gGlobals could be seen as NULL. R=mtklein@google.com Review URL: https://codereview.chromium.org/252713002 git-svn-id: http://skia.googlecode.com/svn/trunk@14397 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
* fix (some) 64bit warnings -- size_t -> intGravatar commit-bot@chromium.org2014-01-24
| | | | | | | | | | | BUG=skia: R=mtklein@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/147053003 git-svn-id: http://skia.googlecode.com/svn/trunk@13178 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reverting r12427Gravatar rmistry@google.com2013-12-02
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@12428 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-12-02
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@12427 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove unused fields from SkGlyphCache.Gravatar bungeman@google.com2013-11-26
| | | | | | Review URL: https://codereview.chromium.org/89423003 git-svn-id: http://skia.googlecode.com/svn/trunk@12407 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-09-27
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@11493 2bbb7eff-a529-9590-31e7-b0007b416f81
* add counting to Globals, and refactor some for clarityGravatar reed@google.com2013-09-26
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/24447003 git-svn-id: http://skia.googlecode.com/svn/trunk@11484 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove obsolete USE_CACHE_HASHGravatar reed@google.com2013-09-24
| | | | | | | | BUG= Review URL: https://codereview.chromium.org/23526082 git-svn-id: http://skia.googlecode.com/svn/trunk@11450 2bbb7eff-a529-9590-31e7-b0007b416f81
* allow createScalerContext to return null, and then have the GDI backend ↵Gravatar reed@google.com2013-07-10
| | | | | | | | | | | trigger that if we fail to create the necessary GDI resources BUG= R=bungeman@google.com Review URL: https://codereview.chromium.org/18484005 git-svn-id: http://skia.googlecode.com/svn/trunk@9957 2bbb7eff-a529-9590-31e7-b0007b416f81
* move failable work outside of constructors for SkGlyphCache and ↵Gravatar reed@google.com2013-07-09
| | | | | | | | | | SkScalerContextGDI. If we fail, try to purge everything and try again, in case the failure was from memory/os-resource exhaustion (e.g. out of HDC handles in windows) BUG= Review URL: https://codereview.chromium.org/18132009 git-svn-id: http://skia.googlecode.com/svn/trunk@9930 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-06-20
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@9695 2bbb7eff-a529-9590-31e7-b0007b416f81
* combine glyph and image bulk alloc, and adjust initial alloc size, to reduce ↵Gravatar reed@google.com2013-06-19
| | | | | | | | | | | | total waste from 50% to 30% add diagnostics to measure cache efficiency BUG= Review URL: https://codereview.chromium.org/17449012 git-svn-id: http://skia.googlecode.com/svn/trunk@9691 2bbb7eff-a529-9590-31e7-b0007b416f81
* we only need one fontmetrics, since the paint (and fontcache) now know ↵Gravatar reed@google.com2013-05-08
| | | | | | | | | | explicitly if they are horizontal or vertical. Review URL: https://codereview.chromium.org/14940018 git-svn-id: http://skia.googlecode.com/svn/trunk@9058 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkTypeface* parameter to SkScalerContext (and its callers)Gravatar reed@google.com2013-03-19
| | | | | | | Use SkTypeface to create scalercontext instead of SkFontHost Review URL: https://codereview.chromium.org/12706010 git-svn-id: http://skia.googlecode.com/svn/trunk@8223 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-01-26
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@7406 2bbb7eff-a529-9590-31e7-b0007b416f81
* Disabling validation of the glyph cache for standard debug builds.Gravatar djsollen@google.com2012-11-30
| | | | | | | | | The validation step is adding 50% overhead to the rendering of text heavy SkPicture files. Review URL: https://codereview.appspot.com/6856123 git-svn-id: http://skia.googlecode.com/svn/trunk@6635 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use consistent globals in AttachCache.Gravatar bungeman@google.com2012-10-29
| | | | | | | https://codereview.appspot.com/6816052/ git-svn-id: http://skia.googlecode.com/svn/trunk@6188 2bbb7eff-a529-9590-31e7-b0007b416f81
* Result of running tools/sanitize_source_files.py (which was added in ↵Gravatar rmistry@google.com2012-08-23
| | | | | | | | | https://codereview.appspot.com/6465078/) This CL is part I of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6485054 git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
* Update SkFlattenable buffers to be more modular.Gravatar djsollen@google.com2012-08-07
| | | | | | | | | | | | | | | | | This CL is an effort to stage the conversion to named parameters for all SkFlattenable commands. This particular stage only does the following two things... 1. Move flattenable buffers from SkFlattenable.h into their own header. 2. Update and Add new read write methods for better clarity and convenience. BUG= Review URL: https://codereview.appspot.com/6448095 git-svn-id: http://skia.googlecode.com/svn/trunk@4980 2bbb7eff-a529-9590-31e7-b0007b416f81
* land https://codereview.appspot.com/6448046/Gravatar reed@google.com2012-07-30
| | | | | | | | Add a method reporting used font cache size to the SkGraphics API git-svn-id: http://skia.googlecode.com/svn/trunk@4825 2bbb7eff-a529-9590-31e7-b0007b416f81
* removing trailing ',' on last entry in enum, to fix warningGravatar reed@google.com2012-07-20
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4686 2bbb7eff-a529-9590-31e7-b0007b416f81
* add explicit purgeAll() so we don't get foiled by the min cache-limitGravatar reed@google.com2012-06-27
| | | | | | | call unref instead of delete on the GrFontScaler Review URL: https://codereview.appspot.com/6353045 git-svn-id: http://skia.googlecode.com/svn/trunk@4366 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkPath::getVerbs/countVerbsGravatar bsalomon@google.com2012-06-07
| | | | | | | Review URL: http://codereview.appspot.com/6306053/ git-svn-id: http://skia.googlecode.com/svn/trunk@4209 2bbb7eff-a529-9590-31e7-b0007b416f81
* ~glyphcache_globals needs to actually delete its cacheGravatar reed@google.com2012-05-21
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4011 2bbb7eff-a529-9590-31e7-b0007b416f81