From 76d6de0845910f18306125bbcaef7edf6e8f6649 Mon Sep 17 00:00:00 2001 From: "vandebo@chromium.org" Date: Wed, 21 Mar 2012 20:31:08 +0000 Subject: [PATCH] Revert "[PDF] Move most of the headers to be private." This reverts r3457 TBR=epoger@google.com Review URL: https://codereview.appspot.com/5866051 git-svn-id: http://skia.googlecode.com/svn/trunk@3458 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gyp/tests.gyp | 1 - {src => include}/pdf/SkBitSet.h | 0 {src => include}/pdf/SkPDFCatalog.h | 2 +- include/pdf/SkPDFDocument.h | 11 ++++------- {src => include}/pdf/SkPDFFont.h | 18 +++++++++--------- {src => include}/pdf/SkPDFFormXObject.h | 0 {src => include}/pdf/SkPDFGraphicState.h | 0 {src => include}/pdf/SkPDFImage.h | 0 {src => include}/pdf/SkPDFPage.h | 2 +- {src => include}/pdf/SkPDFShader.h | 0 {src => include}/pdf/SkPDFStream.h | 0 {src => include}/pdf/SkPDFTypes.h | 0 {src => include}/pdf/SkPDFUtils.h | 0 src/pdf/SkPDFDocument.cpp | 22 +++------------------- 14 files changed, 18 insertions(+), 38 deletions(-) rename {src => include}/pdf/SkBitSet.h (100%) rename {src => include}/pdf/SkPDFCatalog.h (99%) rename {src => include}/pdf/SkPDFFont.h (92%) rename {src => include}/pdf/SkPDFFormXObject.h (100%) rename {src => include}/pdf/SkPDFGraphicState.h (100%) rename {src => include}/pdf/SkPDFImage.h (100%) rename {src => include}/pdf/SkPDFPage.h (98%) rename {src => include}/pdf/SkPDFShader.h (100%) rename {src => include}/pdf/SkPDFStream.h (100%) rename {src => include}/pdf/SkPDFTypes.h (100%) rename {src => include}/pdf/SkPDFUtils.h (100%) diff --git a/gyp/tests.gyp b/gyp/tests.gyp index 52f44bb..2492274 100644 --- a/gyp/tests.gyp +++ b/gyp/tests.gyp @@ -11,7 +11,6 @@ '../src/core', '../src/effects', '../src/gpu', - '../src/pdf', ], 'sources': [ '../tests/AAClipTest.cpp', diff --git a/src/pdf/SkBitSet.h b/include/pdf/SkBitSet.h similarity index 100% rename from src/pdf/SkBitSet.h rename to include/pdf/SkBitSet.h diff --git a/src/pdf/SkPDFCatalog.h b/include/pdf/SkPDFCatalog.h similarity index 99% rename from src/pdf/SkPDFCatalog.h rename to include/pdf/SkPDFCatalog.h index 44005c6..68a244f 100644 --- a/src/pdf/SkPDFCatalog.h +++ b/include/pdf/SkPDFCatalog.h @@ -22,7 +22,7 @@ The PDF catalog manages object numbers and file offsets. It is used to create the PDF cross reference table. */ -class SkPDFCatalog { +class SK_API SkPDFCatalog { public: /** Create a PDF catalog. */ diff --git a/include/pdf/SkPDFDocument.h b/include/pdf/SkPDFDocument.h index 1a4a51f..c1c6fb4 100644 --- a/include/pdf/SkPDFDocument.h +++ b/include/pdf/SkPDFDocument.h @@ -10,17 +10,15 @@ #ifndef SkPDFDocument_DEFINED #define SkPDFDocument_DEFINED -#include "SkAdvancedTypefaceMetrics.h" +#include "SkPDFTypes.h" #include "SkRefCnt.h" #include "SkTDArray.h" #include "SkTScopedPtr.h" class SkPDFCatalog; class SkPDFDevice; -class SkPDFDict; class SkPDFPage; -class SkPDFObject; -class SkWStream; +class SkWSteam; /** \class SkPDFDocument @@ -64,10 +62,9 @@ public: */ SK_API bool appendPage(SkPDFDevice* pdfDevice); - /** Get the count of unique font types used in the document. + /** Get the list of pages in this document. */ - SK_API void getCountOfFontTypes( - int counts[SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1]) const; + SK_API const SkTDArray& getPages(); private: SkTScopedPtr fCatalog; diff --git a/src/pdf/SkPDFFont.h b/include/pdf/SkPDFFont.h similarity index 92% rename from src/pdf/SkPDFFont.h rename to include/pdf/SkPDFFont.h index f463ed7..2ebdec7 100644 --- a/src/pdf/SkPDFFont.h +++ b/include/pdf/SkPDFFont.h @@ -79,27 +79,27 @@ private: */ class SkPDFFont : public SkPDFDict { public: - virtual ~SkPDFFont(); + SK_API virtual ~SkPDFFont(); - virtual void getResources(SkTDArray* resourceList); + SK_API virtual void getResources(SkTDArray* resourceList); /** Returns the typeface represented by this class. Returns NULL for the * default typeface. */ - SkTypeface* typeface(); + SK_API SkTypeface* typeface(); /** Returns the font type represented in this font. For Type0 fonts, * returns the type of the decendant font. */ - virtual SkAdvancedTypefaceMetrics::FontType getType(); + SK_API virtual SkAdvancedTypefaceMetrics::FontType getType(); /** Returns true if this font encoding supports glyph IDs above 255. */ - virtual bool multiByteGlyphs() const = 0; + SK_API virtual bool multiByteGlyphs() const = 0; /** Return true if this font has an encoding for the passed glyph id. */ - bool hasGlyph(uint16_t glyphID); + SK_API bool hasGlyph(uint16_t glyphID); /** Convert (in place) the input glyph IDs into the font encoding. If the * font has more glyphs than can be encoded (like a type 1 font with more @@ -109,7 +109,7 @@ public: * @param numGlyphs The number of input glyphs. * @return Returns the number of glyphs consumed. */ - size_t glyphsToPDFFontEncoding(uint16_t* glyphIDs, size_t numGlyphs); + SK_API size_t glyphsToPDFFontEncoding(uint16_t* glyphIDs, size_t numGlyphs); /** Get the font resource for the passed typeface and glyphID. The * reference count of the object is incremented and it is the caller's @@ -119,7 +119,7 @@ public: * @param typeface The typeface to find. * @param glyphID Specify which section of a large font is of interest. */ - static SkPDFFont* GetFontResource(SkTypeface* typeface, + SK_API static SkPDFFont* GetFontResource(SkTypeface* typeface, uint16_t glyphID); /** Subset the font based on usage set. Returns a SkPDFFont instance with @@ -128,7 +128,7 @@ public: * @return NULL if font does not support subsetting, a new instance * of SkPDFFont otherwise. */ - virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); + SK_API virtual SkPDFFont* getFontSubset(const SkPDFGlyphSet* usage); protected: // Common constructor to handle common members. diff --git a/src/pdf/SkPDFFormXObject.h b/include/pdf/SkPDFFormXObject.h similarity index 100% rename from src/pdf/SkPDFFormXObject.h rename to include/pdf/SkPDFFormXObject.h diff --git a/src/pdf/SkPDFGraphicState.h b/include/pdf/SkPDFGraphicState.h similarity index 100% rename from src/pdf/SkPDFGraphicState.h rename to include/pdf/SkPDFGraphicState.h diff --git a/src/pdf/SkPDFImage.h b/include/pdf/SkPDFImage.h similarity index 100% rename from src/pdf/SkPDFImage.h rename to include/pdf/SkPDFImage.h diff --git a/src/pdf/SkPDFPage.h b/include/pdf/SkPDFPage.h similarity index 98% rename from src/pdf/SkPDFPage.h rename to include/pdf/SkPDFPage.h index 8ef909e..e726638 100644 --- a/src/pdf/SkPDFPage.h +++ b/include/pdf/SkPDFPage.h @@ -82,7 +82,7 @@ public: /** Get the fonts used on this page. */ - const SkTDArray& getFontResources() const; + SK_API const SkTDArray& getFontResources() const; /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font * that shows on this page. diff --git a/src/pdf/SkPDFShader.h b/include/pdf/SkPDFShader.h similarity index 100% rename from src/pdf/SkPDFShader.h rename to include/pdf/SkPDFShader.h diff --git a/src/pdf/SkPDFStream.h b/include/pdf/SkPDFStream.h similarity index 100% rename from src/pdf/SkPDFStream.h rename to include/pdf/SkPDFStream.h diff --git a/src/pdf/SkPDFTypes.h b/include/pdf/SkPDFTypes.h similarity index 100% rename from src/pdf/SkPDFTypes.h rename to include/pdf/SkPDFTypes.h diff --git a/src/pdf/SkPDFUtils.h b/include/pdf/SkPDFUtils.h similarity index 100% rename from src/pdf/SkPDFUtils.h rename to include/pdf/SkPDFUtils.h diff --git a/src/pdf/SkPDFDocument.cpp b/src/pdf/SkPDFDocument.cpp index 3ec4877..cb87d8f 100644 --- a/src/pdf/SkPDFDocument.cpp +++ b/src/pdf/SkPDFDocument.cpp @@ -10,9 +10,8 @@ #include "SkPDFCatalog.h" #include "SkPDFDevice.h" #include "SkPDFDocument.h" -#include "SkPDFFont.h" #include "SkPDFPage.h" -#include "SkPDFTypes.h" +#include "SkPDFFont.h" #include "SkStream.h" // Add the resources, starting at firstIndex to the catalog, removing any dupes. @@ -223,23 +222,8 @@ bool SkPDFDocument::appendPage(SkPDFDevice* pdfDevice) { return true; } -void SkPDFDocument::getCountOfFontTypes( - int counts[SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1]) const { - memset(counts, 0, - sizeof(int)* SkAdvancedTypefaceMetrics::kNotEmbeddable_Font + 1); - SkTDArray seenFonts; - - for (int pageNumber = 0; pageNumber < fPages.count(); pageNumber++) { - const SkTDArray& fontResources = - fPages[pageNumber]->getFontResources(); - for (int font = 0; font < fontResources.count(); font++) { - SkFontID fontID = fontResources[font]->typeface()->uniqueID(); - if (seenFonts.find(fontID) == -1) { - counts[fontResources[font]->getType()]++; - seenFonts.push(fontID); - } - } - } +const SkTDArray& SkPDFDocument::getPages() { + return fPages; } void SkPDFDocument::emitHeader(SkWStream* stream) { -- 2.7.4