aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFFont.cpp
Commit message (Collapse)AuthorAge
* 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: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName.Gravatar halcanary2016-09-08
| | | | | | | | Also, minor code refactoring. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2258233002 Committed: https://skia.googlesource.com/skia/+/fce190647285423bf36c44bca09db78a6af30f9f Review-Url: https://codereview.chromium.org/2258233002
* SkPDF: revert changes to CMapName/Registry/Ordering in 3d01c62Gravatar halcanary2016-09-01
| | | | | | | | BUG=skia:5606 TBR=bungeman@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2305803002 Review-Url: https://codereview.chromium.org/2305803002
* SkPDF: Fix Type3 ToUnicode table.Gravatar halcanary2016-08-31
| | | | | | | | | | | | | | | | | | | | This seems to fix text extraction on Adobe Reader - Registry/Ordering is now set to Skia/SkiaOrdering. - Type3 fonts now get a FontDescriptor (force symbolic font). - CMapName is now Skia-Identity-SkiaOrdering - CMap behaves correctly for single-byte fonts. Also: - SkTestTypeface returns tounicode map for testing. - Unit test updated All PDFs render the same BUG=skia:5606 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2292303004 Review-Url: https://codereview.chromium.org/2292303004
* Revert of SkPDF: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName. ↵Gravatar halcanary2016-08-30
| | | | | | | | | | | | | | | | | | | | | | | (patchset #3 id:40001 of https://codereview.chromium.org/2258233002/ ) Reason for revert: forgot to roll sfntly in android! Original issue's description: > SkPDF: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName. > > Also, minor code refactoring. > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2258233002 > > Committed: https://skia.googlesource.com/skia/+/fce190647285423bf36c44bca09db78a6af30f9f 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/2296683004
* SkPDF: SK_SFNTLY_SUBSETTER is goneGravatar halcanary2016-08-30
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2296823002 Review-Url: https://codereview.chromium.org/2296823002
* SkPDF: hand SfntlyWrapper::SubsetFont() ttcIndex, not fontName.Gravatar halcanary2016-08-30
| | | | | | | Also, minor code refactoring. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2258233002 Review-Url: https://codereview.chromium.org/2258233002
* SkPDF: Remove some unused glyphs from fallback fontsGravatar halcanary2016-08-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the /Widths and the /Differences arrays smaller. Example diff in output PDF (lines are wrapped for easy viewing): <</Type /Font /Subtype /Type3 /FontMatrix [.00100000005 0 0 -.00100000005 0 0] /FirstChar 0 -/LastChar 255 +/LastChar 118 /FontBBox [23 228 669 -694] /CIDToGIDMap /Identity /ToUnicode 8 0 R -/Widths [280 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -525 0 0 0 525 0 0 0 0 525 525 525 525 0 0 0 0 0 0 525 0 0 0 0 0 0 0 0 -0 0 0 0 0 525 0 525 0 0 0 525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/g0 /g57 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 +/g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g0 /g6E /g0 /g0 /g0 +/g0 /g0 /g0 /g0 /g76]>> /CharProcs <</g0 9 0 R /g1D 10 0 R /g21 11 0 R ....... BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2287393002 Review-Url: https://codereview.chromium.org/2287393002
* 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: Stop `#include PREPROCESSOR_DEFINE` patternGravatar halcanary2016-08-25
| | | | | | | | | | | | | | | | | | No more: #include SK_SFNTLY_SUBSETTER #include ZLIB_INCLUDE Also, rename SK_SFNTLY_SUBSETTER to SK_PDF_USE_SFNTLY to follow my pattern of prefixing SkPDF-specific defines with 'SK_PDF_'. The ZLIB_INCLUDE define is no longer is used by anyone. TODO: rename Sfntly to something pronounceable. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2273343002 Review-Url: https://codereview.chromium.org/2273343002
* SkPDF: set SK_SFNTLY_SUBSETTER uniformlyGravatar halcanary2016-08-24
| | | | | | | | | | | | | | When Skia is built into the Android framework, SK_SFNTLY_SUBSETTER="sample/chromium/font_subsetter.h". This #includes the same value for GOOGLE3. Once Chrome is also using this value, we can do away with the `#ifdef GOOGLE3` line. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2272103002 Review-Url: https://codereview.chromium.org/2272103002
* GN: more optional components: jpeg, pdf, png, xmlGravatar mtklein2016-08-24
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2267343004 Review-Url: https://codereview.chromium.org/2267343004
* 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: Font names need escapingGravatar halcanary2016-08-16
| | | | | | NOTRY=true Review-Url: https://codereview.chromium.org/2250763002
* 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/SkAdvancedTypefaceMetrics: simplify ATM, PDF takes overGravatar halcanary2016-08-08
| | | | | | | | | No public API changes. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2222523003 Review-Url: https://codereview.chromium.org/2222523003
* SkPDF: Stop using kHAdvance_PerGlyphInfoGravatar halcanary2016-08-05
| | | | | | | | | | | | | | | SkPDFFont: - never request kHAdvance_PerGlyphInfo from typeface. - set_glyph_widths() fn uses a glyph cache to get advances. - stop expecting vertical advances that are never requested. - composeAdvanceData() now non-templated - appendAdvance() one-line function removed SkPDFDevice: - use a glyph cache for getting repeated advances. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2219733004 Review-Url: https://codereview.chromium.org/2219733004
* Move off SK_SUPPORT_LEGACY_DATA_FACTORIES.Gravatar bungeman2016-08-02
| | | | | | | This moves Skia code off of SK_SUPPORT_LEGACY_DATA_FACTORIES. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2206633004 Review-Url: https://codereview.chromium.org/2206633004
* SkPDF: PDFStream has-a not is-a PDFDictGravatar halcanary2016-07-29
| | | | | | | | | | | | | | | Motivation: SkPDFStream and SkPDFSharedStream now work the same. Also: - move SkPDFStream into SkPDFTypes (it's a fundamental PDF type). - minor refactor of SkPDFSharedStream - SkPDFSharedStream takes unique_ptr to represent ownership BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2190883003 Review-Url: https://codereview.chromium.org/2190883003
* SkPDF: refactor font subset: fewer copiesGravatar halcanary2016-07-27
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2190643002 Review-Url: https://codereview.chromium.org/2190643002
* SkPDF: SkPDFStream takes a unique_ptrGravatar halcanary2016-07-27
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2188623004 Review-Url: https://codereview.chromium.org/2188623004
* SkPDF: Always give a default advance for glyphs.Gravatar halcanary2016-07-15
| | | | | | | | | | Prior to this we assumed the default default was 0. It is actually 1000, according to the spec. fixes BUG=skia:5321 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2146403005 Review-Url: https://codereview.chromium.org/2146403005
* SkPDF: Fix encoding of unichr outside of basic planeGravatar halcanary2016-07-07
| | | | | | | | | | | | | | In ToUnicode table, write unicode codepoints as one or two UTF16BE values, rather than a single hex, as the standard requires. Factor out uint16 -> big-endian hex code. SkUtils is now a namespace. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2120533002 Review-Url: https://codereview.chromium.org/2120533002
* 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
* SkPDF: SkPDFStream takes only SkStreamAssetGravatar halcanary2016-06-29
| | | | | | | | | This is possible since https://crrev.com/869763002. Later, I'll clean up the logic and class constructors. For now, I assert everywhere I expect a SkStreamAsset to be well-behaved (duplcate, hasLength). GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2098393002 Review-Url: https://codereview.chromium.org/2098393002
* 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
* Move SkTypeface to sk_sp.Gravatar bungeman2016-05-12
| | | | | | | Committed: https://skia.googlesource.com/skia/+/6296da736fbf40aae881650c239420f64e576c3f GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1933393002 Review-Url: https://codereview.chromium.org/1933393002
* Revert of Move SkTypeface to sk_sp. (patchset #5 id:80001 of ↵Gravatar scroggo2016-05-12
| | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1933393002/ ) Reason for revert: fontmgr_iterAndroid failing to draw emoji. E.g. https://gold.skia.org/search2?blame=6296da736fbf40aae881650c239420f64e576c3f&unt=true&head=true&query=source_type%3Dgm Original issue's description: > Move SkTypeface to sk_sp. > > Committed: https://skia.googlesource.com/skia/+/6296da736fbf40aae881650c239420f64e576c3f TBR=reed@google.com,fmalita@chromium.org,tomhudson@google.com,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/1974783002
* Move SkTypeface to sk_sp.Gravatar bungeman2016-05-11
| | | | Review-Url: https://codereview.chromium.org/1933393002
* SkAdvancedTypefaceMetrics: abstract out linked listGravatar halcanary2016-05-08
| | | | | | | | | | | | | + use SkSinglyLinkedList<T> + move SkSinglyLinkedList.h to core + remove SkHackyAutoTDelete + getAdvanceData() -> setGlyphWidths() + finishRange no longer templated + remove unused templated functions GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1953153004 Review-Url: https://codereview.chromium.org/1953153004
* SkPDF: SkTypeface::openStream could return nullptrGravatar halcanary2016-03-30
| | | | | | | | | Speculative fix for hard-to-reproduce bug. BUG=163892 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842163002 Review URL: https://codereview.chromium.org/1842163002
* SkPDF s/SkAutoTDelete/std::unique_ptr/Gravatar halcanary2016-03-28
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1837553002 Review URL: https://codereview.chromium.org/1837553002
* Change type of SkGlyph::fAdvance[XY] to float.Gravatar benjaminwagner2016-03-24
| | | | | | | BUG=skia:4632 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1737693006 Review URL: https://codereview.chromium.org/1737693006
* 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
* detach -> releaseGravatar mtklein2016-03-16
| | | | | | | | | | | | | The C++ standard library uses the name "release" for the operation we call "detach". Rewriting each "detach(" to "release(" brings us a step closer to using standard library types directly (e.g. std::unique_ptr instead of SkAutoTDelete). This was a fairly blind transformation. There may have been unintentional conversions in here, but it's probably for the best to have everything uniformly say "release". BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1809733002 Review URL: https://codereview.chromium.org/1809733002
* SkPDF: use sk_ref_spGravatar halcanary2016-03-09
| | | | | | | | s/sk_sp<[^>]*>(SkRef(\([^)]*\)))/sk_ref_sp(\1)/ GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1777923002 Review URL: https://codereview.chromium.org/1777923002
* SkPDF: Add sk_sp setters; .release() becomes std::move()Gravatar halcanary2016-03-08
| | | | | | | | | | | | | | | | Note to reviewers: Start with changes to SkPDFTypes.h Many places that had a bare pointer owning a reference are refactored to use a sk_sp. There remain several places where a non-owning pointer `T*` should be replaced with `const sk_sp<T>&` to eliminate the common pattern `sk_sp<T>(SkRef(x))`. Committed: https://skia.googlesource.com/skia/+/9904c9212074279380e21f96575078734dbbd308 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1775043002 Review URL: https://codereview.chromium.org/1775043002