aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFFont.h
Commit message (Collapse)AuthorAge
* SkAdvancedTypefaceMetrics: factor out GlyphToUnicodeGravatar Hal Canary2018-05-09
| | | | | | | Change-Id: Iedce8c1ea2c405d5ab64ccac353970d5cd2b9d63 Reviewed-on: https://skia-review.googlesource.com/126507 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkAdvancedTypefaceMetrics: simplify moreGravatar Hal Canary2018-05-07
| | | | | | | Change-Id: I80c28c50aa96c28181d2fef13daad4a80ec91a12 Reviewed-on: https://skia-review.googlesource.com/120160 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Untangle strike cache and glyph cacheGravatar Herb Derby2018-04-19
| | | | | | | | | | | | The strike cache and the glpyh cache have been friends for a long time. Untangle this twisted relationship. BUG=skia:7515 Change-Id: Ie77393f6923e9886ec90ff7a60a1200e78319937 Reviewed-on: https://skia-review.googlesource.com/122084 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* Remove the last uses of auto glyph cache.Gravatar Herb Derby2018-03-22
| | | | | | | Change-Id: I15fdc5bbe29aaa969fe6ec57010919b52249fd7f Reviewed-on: https://skia-review.googlesource.com/115886 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Herb Derby <herb@google.com>
* Revert "Revert "SkTypeface::getAdvancedMetrics(): cleanup""Gravatar Hal Canary2017-05-05
| | | | | | | | | | | | | | | | | | | This reverts commit 59ad782b2b05b07aa6eb961aa4d62e934093cbd1. - SkAdvancedTypefaceMetrics is a struct not a class - SkTypeface::PerGlyphInfo is gone - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. - [on]getAdvancedMetrics no longer has parameters. (Only caller always used same arguments.) - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt Change-Id: I91b56e60f7d9de7d46c426c6bd34ce124e0cf00e Reviewed-on: https://skia-review.googlesource.com/15360 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Revert "SkTypeface::getAdvancedMetrics(): cleanup"Gravatar Hal Canary2017-05-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit cef018896e5cad8eb46a536b60cdf79ebe2b0191. Reason for revert: broke chromium roll (windows). Original change's description: > SkTypeface::getAdvancedMetrics(): cleanup > > - SkAdvancedTypefaceMetrics is a struct not a class > - SkTypeface::PerGlyphInfo is gone > - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g > - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g > - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. > - [on]getAdvancedMetrics no longer has parameters. (Only caller always > used same arguments.) > - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. > - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt > > Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582 > Reviewed-on: https://skia-review.googlesource.com/15311 > Reviewed-by: Ben Wagner <bungeman@google.com> > Commit-Queue: Hal Canary <halcanary@google.com> > TBR=halcanary@google.com,bungeman@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I84c7d53df566aaf83427e3368edaa02b7b5a9cb8 Reviewed-on: https://skia-review.googlesource.com/15319 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkTypeface::getAdvancedMetrics(): cleanupGravatar Hal Canary2017-05-04
| | | | | | | | | | | | | | | | | - SkAdvancedTypefaceMetrics is a struct not a class - SkTypeface::PerGlyphInfo is gone - s/getAdvancedTypefaceMetrics/getAdvancedMetrics/g - s/onGetAdvancedTypefaceMetrics/onGetAdvancedMetrics/g - [on]getAdvancedMetrics now return unique_ptr rather than bare ptr. - [on]getAdvancedMetrics no longer has parameters. (Only caller always used same arguments.) - SkAdvancedTypefaceMetrics uses C++11 in-class member initializers. - SkAdvancedTypefaceMetrics no longer inherits from SkRefCnt Change-Id: I37571ebcc383ba9eb21bc20c60c734e3ca317582 Reviewed-on: https://skia-review.googlesource.com/15311 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* src/pdf: code cleanupGravatar Hal Canary2017-05-04
| | | | | | | | | | | | | * SkPDFCanon: remove unnecessary abstraction * Make use of SkTHashMap<K, sk_sp<T>>. * Remove unncessary struct constructors. * More factory fns return sk_sp<T> * SkPDFUtility::GetCachedT<T> factored out. Change-Id: I4055a131b43fe2588fd042b769cd09fff8a3466c Reviewed-on: https://skia-review.googlesource.com/13655 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* Mark overridden destructors with 'override' and remove 'virtual'Gravatar Brian Salomon2017-03-22
| | | | | | | | | This silences a new warning in clang 5.0 Change-Id: Ieb5b75a6ffed60107c3fd16075d2ecfd515b55e8 Reviewed-on: https://skia-review.googlesource.com/10006 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
* SkPDF: Always get advances at unitsPerEm.Gravatar Hal Canary2017-03-08
| | | | | | | | | | | | | * Work around BUG=chromium:696356 * SkTestScalerContext needs a return a em-size. * SkPDFFont::MakeVectorCache which always produces a glyph cache at emsize. Replaces vector_cache(). * Stop looking at fLastGlyphID and fEmSize in TypefaceMetrics. Change-Id: I28d93b8f62d461a60fa046e9aaf7fa6d116a7ee5 Reviewed-on: https://skia-review.googlesource.com/9324 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkPDF: refactor & code cleanup ahead of https://crrev.com/2322403002Gravatar halcanary2016-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | SkPDFDevice::GraphicStateEntry: remove unnecessary fFont and fTextSize. SkPDFDevice::updateFont(): replace with update_font() and inlined code. De-duplicate this block of code. SkPDFResourceDict::GetResourceTypePrefix function made public: removes need for temporary SkString returned by SkPDFResourceDict::getResourceName() GlyphPositioner: delay writing intial matrix until first glyph. Assert that widechars is a constant. SkPDFFont::FontType(): make public so that PDFDevice can know about multibyte status. SkPDFFont::countStretch() removed, and the stretch loop flattened. *no changes in PDF output* BUG=skia:5434 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2327953002 Review-Url: https://codereview.chromium.org/2327953002
* SkPDF: Glyph validation changeGravatar halcanary2016-08-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of mapping invaid glyphIDs to zero or maxGlyphID, don't draw them at all. Validate glyphs when glyph is written, not ahead of time. Don't allocate array to copy user-provided glyphs. Easy early exit from SkPDFDevice::internalDrawText() GlyphPositioner::flush() called ~GlyphPositioner() SkScopeExit class now exists. Assume SkTypeface* pointers are now never null in more places. precalculate alignmentFactor to clean up code. SkPDFDevice::updateFont must be called with validated glyphID. Skip bad glyphs to make this true. SkPDFDevice::updateFont always succeeds. SkPDFFont::GetFontResource always succeeds (preconditions are asserted). If GetMetrics fails, don't call GetFontResource. SkPDFFont::glyphsToPDFFontEncodingCount() becomes SkPDFFont::countStretch() and is inlined. SkPDFFont::glyphsToPDFFontEncoding now works one Glyph at a time and is inlined. SkPDFFont::noteGlyphUsage() operates one glyph at a time. Add SkScopeExit.h; also a unit test for it. SkPostConfig: Fix SK_UNUSED for Win32. No public API changes. TBR=reed@google.com BUG=625995 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2278703002 Review-Url: https://codereview.chromium.org/2278703002
* SkPDF: in-place font subsettingGravatar halcanary2016-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: gross code simplification, also no bitset lookups at draw time. SkPDFFont owns its glyph useage bitset. SkPDFSubstituteMap goes away. SkPDFObject interface is simplified. SkPDFDocument tracks font usage (as hash set), not glyph usage. SkPDFFont gets a simpler constructor. SkPDFFont has first and last glyph set in constructor, not adjusted later. SkPDFFont implementations are simplified. SkPDFGlyphSet is replaced with simple SkBitSet. SkPDFFont sizes its SkBitSets based on glyph count. SkPDFGlyphSetMap goes away. SkBitSet is now non-copyable. SkBitSet now how utility methods to match old SkPDFGlyphSet. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253283004 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Release-GDI-Trybot,Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug-GDI-Trybot Review-Url: https://codereview.chromium.org/2253283004
* SkPDF: cache metrics once.Gravatar halcanary2016-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: drawText can look up unicode mapping at draw time to see if ActualText should be used after crrev.com/2084533004 lands. For each SkTypeface, only call getAdvancedTypefaceMetrics() once per document. Cache the result in the SkPDFCanon, indexed by SkFontID. Also cache PDF FontDescriptors in the canon, also indexed by SkFontID (Type1 fonts only). Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(), SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match. SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics. Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset() get metrics from canon. SkPDFFont multybite bool is now a function of type. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Release-GDI-Trybot,Test-Win-MSVC-GCE-CPU-AVX2-x86_64-Debug-GDI-Trybot Review-Url: https://codereview.chromium.org/2253993002
* Revert of SkPDF: cache metrics once. (patchset #4 id:60001 of ↵Gravatar robertphillips2016-08-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/2253993002/ ) Reason for revert: because Original issue's description: > SkPDF: cache metrics once. > > Motivation: drawText can look up unicode mapping at draw time to see > if ActualText should be used after crrev.com/2084533004 lands. > > For each SkTypeface, only call getAdvancedTypefaceMetrics() once per > document. Cache the result in the SkPDFCanon, indexed by SkFontID. > Also cache PDF FontDescriptors in the canon, also indexed by SkFontID > (Type1 fonts only). > > Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map > that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(), > SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match. > > SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics. > Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset() > get metrics from canon. > > SkPDFFont multybite bool is now a function of type. > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002 > > Committed: https://skia.googlesource.com/skia/+/0a61270f4ba85d10659fb63a86817b435ec04c94 TBR=bungeman@google.com,halcanary@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2251813006
* SkPDF: cache metrics once.Gravatar halcanary2016-08-17
| | | | | | | | | | | | | | | | | | | | | | | Motivation: drawText can look up unicode mapping at draw time to see if ActualText should be used after crrev.com/2084533004 lands. For each SkTypeface, only call getAdvancedTypefaceMetrics() once per document. Cache the result in the SkPDFCanon, indexed by SkFontID. Also cache PDF FontDescriptors in the canon, also indexed by SkFontID (Type1 fonts only). Simplify PDF font lookup, map SkFontID+SkGlyphID into a uint64_t. Map that uint64_t to SkPDFFonts. Remove SkPDFCanon::findFont(), SkPDFCanon::addFont(), SkPDFFont::IsMatch(), and enum SkPDFFont::Match. SkPDFFont no longer holds on to ref of SkAdvancedTypefaceMetrics. Instead, SkPDFFont::GetFontResource() and SkPDFFont::getFontSubset() get metrics from canon. SkPDFFont multybite bool is now a function of type. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2253993002 Review-Url: https://codereview.chromium.org/2253993002
* SkPDF: pull out SkPDFMakeCIDGlyphWidthsArray.cppGravatar halcanary2016-08-17
| | | | | | | Extract from inside SkPDFFont.cpp GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2251803002 Review-Url: https://codereview.chromium.org/2251803002
* SkPDF: eliminate SkPDFCIDfont classGravatar halcanary2016-08-16
| | | | | | | | | get_glyph_widths() and set_glyph_widths() combined. set_glyph_widths() now takes a SkPDFGlyphSet*. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2244173005 Review-Url: https://codereview.chromium.org/2244173005
* SkPDF: SkPDFFont class changesGravatar halcanary2016-08-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkPDFFont: * inline some one-line methdods. - SkPDFFont::typeface() - SkPDFFont::fontInfo() - SkPDFFont::firstGlyphID() - SkPDFFont::lastGlyphID() - SkPDFFont::getFontDescriptor() * de-virtualize some methods: - SkPDFFont::getType() - SkPDFFont::multiByteGlyphs() * Constructor takes more arguments: fontType, multiByteGlyphs * re-order fields (pointers before shorts) * use sk_sp<T> more, T* less SkAdvancedTypefaceMetrics: * SkAdvancedTypefaceMetrics::fFont now a uint8_t * other enumes are sized. * SkAdvancedTypefaceMetrics::fStyle now big enough. * remove use of SkTBitOr, replaced with fancy templates No public API changes. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2246903002 Review-Url: https://codereview.chromium.org/2246903002
* SkPDF: unify drawText and drawPosTextGravatar halcanary2016-08-15
| | | | | | | | | | | | | Motivation: a later CL will add drawTextBlob() (after https://crrev.com/2084533004 lands). This CL is designed with that change in mind. Also fewer redundant lines of code. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241683005 Committed: https://skia.googlesource.com/skia/+/6059dc32fe36358175cb81541c91e74a2a7e771a Review-Url: https://codereview.chromium.org/2241683005
* Revert of SkPDF: unify drawText and drawPosText (patchset #2 id:40001 of ↵Gravatar robertphillips2016-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/2241683005/ ) Reason for revert: I believe this is breaking the Google3 roll Original issue's description: > SkPDF: unify drawText and drawPosText > > Motivation: a later CL will add drawTextBlob() (after > https://crrev.com/2084533004 lands). This CL is designed > with that change in mind. Also fewer redundant lines of > code. > > BUG=skia: > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241683005 > > Committed: https://skia.googlesource.com/skia/+/6059dc32fe36358175cb81541c91e74a2a7e771a TBR=bungeman@google.com,halcanary@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review-Url: https://codereview.chromium.org/2248923002
* SkPDF: unify drawText and drawPosTextGravatar halcanary2016-08-15
| | | | | | | | | | | | Motivation: a later CL will add drawTextBlob() (after https://crrev.com/2084533004 lands). This CL is designed with that change in mind. Also fewer redundant lines of code. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2241683005 Review-Url: https://codereview.chromium.org/2241683005
* SkPDF: Subset Type3 (fallback) fontGravatar halcanary2016-08-12
| | | | | | | | | | | | | | | | | | | Motivation: significant file-size reduction. Also: SkPDFFont::subsetFont() returns a sk_sp<SkPDFObject> rather than a SkPDFFont*. SkPDFType3Font constructor no longer populates font info; relies on subsetting. SkPDFFont::Create is easier to read Also: SkPDFType3Font are scaled by emSize rather than 1000. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2231483002 Committed: https://skia.googlesource.com/skia/+/88b138da99328b04cae9a8ee19c3882b8847a550 Review-Url: https://codereview.chromium.org/2231483002
* Revert of SkPDF: Subset Type3 (fallback) font (patchset #8 id:200001 of ↵Gravatar halcanary2016-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/2231483002/ ) Reason for revert: internal failing Original issue's description: > SkPDF: Subset Type3 (fallback) font > > Motivation: significant file-size reduction. > > Also: SkPDFFont::subsetFont() returns a sk_sp<SkPDFObject> > rather than a SkPDFFont*. > > SkPDFType3Font constructor no longer populates font info; > relies on subsetting. > > SkPDFFont::Create is easier to read > > Also: SkPDFType3Font are scaled by emSize rather than 1000. > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2231483002 > > Committed: https://skia.googlesource.com/skia/+/88b138da99328b04cae9a8ee19c3882b8847a550 TBR=bungeman@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2232283003
* SkPDF: Subset Type3 (fallback) fontGravatar halcanary2016-08-11
| | | | | | | | | | | | | | | | | | Motivation: significant file-size reduction. Also: SkPDFFont::subsetFont() returns a sk_sp<SkPDFObject> rather than a SkPDFFont*. SkPDFType3Font constructor no longer populates font info; relies on subsetting. SkPDFFont::Create is easier to read Also: SkPDFType3Font are scaled by emSize rather than 1000. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2231483002 Review-Url: https://codereview.chromium.org/2231483002
* SkPDF: SkPDFFont organization changes.Gravatar halcanary2016-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | SkPDFFont: - SkPDFType1Font::populate() encode advances correctly. - break out logically independent code into new files: * SkPDFConvertType1FontStream * SkPDFMakeToUnicodeCmap SkPDFFont.cpp is now 380 lines smaller. Expose `SkPDFAppendCmapSections()` for testing. SkPDFFontImpl.h - Fold into SkPDFFont. SkPDFConvertType1FontStream: - Now assume given a SkStreamAsset SkPDFFont: - AdvanceMetric now hidden in a anonymous namespace. No public API changes. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2221163002 Review-Url: https://codereview.chromium.org/2221163002
* SkPDF: Glyph Useage Map improvementsGravatar halcanary2016-06-30
| | | | | | | | | | | | | | | | | | | | Instead of having a fFontGlyphUsage on each device and one on each document, just have the one on the document, and never merge. Make fGlyphUsage accesible on SkPDFDocument. Remove SkPDFGlyphSetMap::merge, ::reset, and SkPDFGlyphSet::merge. SkPDFGlyphSetMap has an TArray of SkPDFGlyphSet, not TDArray of SkPDFGlyphSet pointers. SkPDFGlyphSet and SkPDFBitset get move constructors. All tests produce exactly identical output PDFs. BUG=skia:5434 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2112943002 Review-Url: https://codereview.chromium.org/2112943002
* Remove unnecessary includes in src/pdf/Gravatar martina.kollarova2016-06-29
| | | | | | | | | Use forward declaration more. BUG=None GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2110033002 Review-Url: https://codereview.chromium.org/2110033002
* Style bikeshed - remove extraneous whitespaceGravatar halcanary2016-03-29
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842753002 Review URL: https://codereview.chromium.org/1842753002
* SkPDF: Hold page objects, not SkPDFDevices.Gravatar halcanary2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Page Contents: serialize early, at endPage() SkPDFDocument: Rather than holding all SkPDFDevices until onClose(), store fGlyphUseage and array of pages objects. perform_font_subsetting function removed: First half moved to onEndPage. Second half moved to onClose. create_pdf_page function removed: Merged into onEndPage. generate_page_tree: Refactored to use SkTArray<sk_sp<T>> over SkTDArray<T*>. (the former is explicit about ownership, the latter is unclear.) No longer populates a structure of objects to be dumped, unnecessary since dump is always called after serialization. Takes ownership of fPages and returns root of tree-ified version. Less reference churn. SkPDFGlyphSetMap: use new-style iterator. BUG=skia:5087 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1823683005 Review URL: https://codereview.chromium.org/1823683005
* SkPDF: add drop() virtual to release resources early.Gravatar halcanary2016-03-21
| | | | | | | | | | | | | | | | | | | Call drop() after calling emitObject() on top-level objects. In Debug mode, assert that each object is emited exactly once by asserting that emitObject is never called after drop(). Same for addResources(). To make sure that top level objects don't get deleted prematurely, SkPDFObjNumMap takes a reference. Motivation: save RAM. Allow even earlier serialization with later changes. Also: Switch some SkTDArrays to SkTArrays. BUG=skia:5087 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1790023003 Review URL: https://codereview.chromium.org/1790023003
* SkPDF: s/SkAutoTUnref/sk_sp/gGravatar halcanary2016-03-07
| | | | Review URL: https://codereview.chromium.org/1771073002
* SkPDF: fall back on paths for unembeddable fonts.Gravatar halcanary2015-10-12
| | | | | | | | Add GM, SkPDFFont::CanEmbedTypeface BUG=skia:3866 Review URL: https://codereview.chromium.org/1401763002
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* remove SkInstCntGravatar mtklein2015-06-26
| | | | | | | | | | | | | | It's been outclassed by Valgrind and leak sanitizer, and it seems to be causing problems for external folks building Skia. I'm not sure why our own builds seem unaffected. Latest thread: https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0 BUG=skia: Review URL: https://codereview.chromium.org/1217573002
* SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMapGravatar halcanary2015-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: Keep separate features separate. Also, future linearization work will need to have several objNumMap objects share a substituteMap. Also "catalog" has a specific meaning in PDF. This catalog did not map to that catalog. - Modify SkPDFObject::emitObject and SkPDFObject::addResources interface to requiore SkPDFObjNumMap and SkPDFSubstituteMap. - SkPDFObjNumMap const in SkPDFObject::emitObject. - Remove SkPDFCatalog.cpp/.h - Modify SkDocument_PDF.cpp to use new functions - Fold in SkPDFStream::populate - Fold in SkPDFBitmap::emitDict - Move SkPDFObjNumMap and SkPDFSubstituteMap to SkPDFTypes.h - Note (via assert) that SkPDFArray & SkPDFDict don't need to check substitutes. - Remove extra space from SkPDFDict serialization. - SkPDFBitmap SkPDFType0Font SkPDFGraphicState SkPDFStream updated to new interface. - PDFPrimitivesTest updated for new interface. BUG=skia:3585 Review URL: https://codereview.chromium.org/1049753002
* PDF: Canon now owns a reference to all interned objectsGravatar halcanary2015-02-27
| | | | | | | | | | | | | Add SkPDFCanon::reset function to unref all objects. No longer possible to remove object from canon Motivation: this doesn't change these object's lifetime, (they will still be fully unrefed when SkDocument::close() is called, but we no longer have to remove them from the array when their destructor is called. Review URL: https://codereview.chromium.org/966863002
* PDF: remove unnecessary mutexes.Gravatar halcanary2015-02-20
| | | | | | | | We now force all SkPDFObjects to stay on one thread. TBR=mtklein@google.com Review URL: https://codereview.chromium.org/942153002
* PDF: Now threadsafe!Gravatar halcanary2015-02-20
| | | | | | | | | | | | | The PDF canvas is now just as threadsafe as any other Skia canvas. DM updated to thread PDF tests. SkDocument_PDF now owns SkPDFCanon, and pointers to that canon are passed around to all classes that need access to the canon. BUG=skia:2683 Review URL: https://codereview.chromium.org/944643002
* Simplify reference management in SkPDFGravatar halcanary2015-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, SkPDFObject subclasses were required to track their resources separately from the document structure. (An object has a resource if it depends, via an indirect reference, on another object). This led to a lot of extra code to duplicate effort. I replace the getResources() function with the much simpler addResources() function. I only define a non-trivial addResources() method on arrays, dictionaries, and indirect object references. All other specialized classes simply rely on their parent class's implementation. SkPDFObject::addResources() works by recursively walking the directed graph of object (direct and indirect) references and adding resources to a set. It doesn't matter that there are closed loops in the graph, since we check the set before walking down a branch. - Add SkPDFObject::addResources() virtual function, with four implementations - Remove SkPDFObject::getResources() virtual function and all implementations. - Remove SkPDFObject::GetResourcesHelper() - Remove SkPDFObject::AddResourceHelper() - In SkPDFCatalog::findObjectIndex(), add an object to the catalog if it doesn't exist yet. - SkPDFCatalog::setSubstitute() no longer sets up resources - SkPDFDocument.cpp no longer needs the Streamer object - SkPDFDocument.cpp calls fDocCatalog->addResources to build the resource list. - SkPDFFont::addResource() removed - All SkPDF-::fResource sets removed (they are redundant). - removed SkPDFImage::addSMask() function - SkPDFResourceDict::getReferencedResources() removed. Motivation: this removes quite a bit of code and makes the objects slightly slimmer in memory. Most importantly, this will lead the way towards removing SkPDFObject's inheritance from SkRefCnt, which will greatly simplify everything. Testing: I usually test changes to the PDF backend by comparing checksums of PDF files rendered from GMs and SKPs before and after the change. This change both re-orders and re-numbers the indirect PDF objects. I used the qpdf program to normalize the PDFs and then compared the normalized outputs from before and after the change; they matched. Review URL: https://codereview.chromium.org/870333002
* SkPDFCanonGravatar halcanary2015-01-21
| | | | | | | | | | | | | | | | | SkPDFCanon's fields and methods will eventually become part of SkPDFDocument/SkDocument_PDF. For now, it exists as a singleton to preflight that transition. This replaces three global arrays in SkPDFFont, SkPDFShader, and SkPDFGraphicsContext. This code is still thread-unsafe (http://skbug.com/2683), but moving this functionality into SkPDFDocument will fix that. This CL does not change pdf output from either GMs or SKPs. This change also simplifies some code around the SkPDFCanon methods. BUG=skia:2683 Review URL: https://codereview.chromium.org/842253003
* Fix int16_t for glyphs, const glyphs, and clarify glyph loop.Gravatar bungeman2014-10-03
| | | | | | | | | | | | | | | | | | Several places in the PDF code are using int16_t for glyphs. With newer NotoSans fonts, all possible glyph ids are being used, so this can lead to problems. The PDF glyphs from text code returns the text for the glyphs if the encoding is for glyphs. However, it returns this using an unsafe const cast which is hiding possible bugs and preventing correct use of const in other places. The way the glyph loop in SkPDFDevice::drawPosText is written uses a '--i' in the loop, which makes it appear this can loop forever. I don't believe it can, but it is an unecessary code folding. We should also at least assert the forward progress correctness here. Review URL: https://codereview.chromium.org/626613002
* Make SkPDFFont::fFontInfo a const pointer.Gravatar halcanary2014-07-11
| | | | | | | | | BUG=skia:2742 R=djsollen@google.com, scroggo@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/383063007
* [PDF] Fix font embedding restrictions.Gravatar vandebo2014-06-19
| | | | | | | | | | | | Stop using restricted font outlines and honor don't subset restriction. Resubmit of r12600. R=halcanary@google.com, bungeman@google.com, reed@google.com Author: vandebo@chromium.org Review URL: https://codereview.chromium.org/334443002
* fix int/size_t warningsGravatar reed@google.com2014-04-18
| | | | | | | | | | | patch from issue 239933002 BUG=skia: R=bungeman@google.com Review URL: https://codereview.chromium.org/242113010 git-svn-id: http://skia.googlecode.com/svn/trunk@14259 2bbb7eff-a529-9590-31e7-b0007b416f81
* SkNonCopyable should be used with private inheritance.Gravatar commit-bot@chromium.org2014-04-07
| | | | | | | | | | | | | | | This is mostly s/public SkNoncopyable/SkNoncopyable/g. Two classes (SkDrawLooper::Context and SkPicture::OperationList) don't actually work with SkNoncopyable because they introduce a virtual destructor. I added SkNoncopyableVirtual to make them work as intended. Sort of questionable whether they really need to be noncopyable in the first place, but I guess it doesn't hurt to keep the behavior the same. BUG=skia: R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/226183018 git-svn-id: http://skia.googlecode.com/svn/trunk@14081 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "[PDF] Fix font embedding restrictions."Gravatar vandebo@chromium.org2013-12-10
| | | | | | | | This reverts r12600 and r12601, likely causing crash on Mac. Review URL: https://codereview.chromium.org/111893002 git-svn-id: http://skia.googlecode.com/svn/trunk@12604 2bbb7eff-a529-9590-31e7-b0007b416f81
* [PDF] Fix font embedding restrictions.Gravatar commit-bot@chromium.org2013-12-10
| | | | | | | | | | | | Stop using restricted font outlines and honor don't subset restriction. R=reed@google.com, bungeman@google.com Author: vandebo@chromium.org Review URL: https://codereview.chromium.org/107863002 git-svn-id: http://skia.googlecode.com/svn/trunk@12600 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix compilation with SK_ENABLE_INST_COUNT=1Gravatar commit-bot@chromium.org2013-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add INHERITED declarations to class declarations that prevent compilation with the flag. Remove SK_DEFINE_INST_COUNT from all class implementations. Instead, use function-local static variables in the reference count helper classes to create the global instances to store the needed info. The accessor functions are defined inline in the helper classes, so definitions are not needed. The initialization point of the variables should be as well defined as previously. Remove SK_DECLARE_INST_COUNT_TEMPLATE and use SK_DECLARE_INST_COUNT instead. This avoids possible future compilation errors further. For SK_ENABLE_INST_COUNT=0 compilation, add an empty static member function to all classes that use SK_DECLARE_INST_COUNT and SK_DECLARE_INST_COUNT_ROOT macros. The function ensures that classes contain public INHERITED typedef. This member function seems to be compiled away. This shouĺd ensure that part of the compilation errors are caught earlier. Also adds DSK_DECLARE_INST_COUNT to few SkPDFDict subclasses. R=robertphillips@google.com, richardlin@chromium.org, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/98703002 git-svn-id: http://skia.googlecode.com/svn/trunk@12501 2bbb7eff-a529-9590-31e7-b0007b416f81
* resubmit https://code.google.com/p/skia/source/detail?r=7883 (in the meantime weGravatar edisonn@google.com2013-04-02
| | | | | | | added capability to collect minidump and callstack if buildbot fails with heap coruption in windows, and a NPE bug was fixed in SkPDFDocument, when document was destroyed without ever beeing used and a field was NULL + a few minor conflicts have been resolved) git-svn-id: http://skia.googlecode.com/svn/trunk@8487 2bbb7eff-a529-9590-31e7-b0007b416f81