| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #ifndef SkPDFCanon_DEFINED | 7 #ifndef SkPDFCanon_DEFINED |
| 8 #define SkPDFCanon_DEFINED | 8 #define SkPDFCanon_DEFINED |
| 9 | 9 |
| 10 #include "SkPDFShader.h" | 10 #include "SkPDFShader.h" |
| 11 #include "SkThread.h" | 11 #include "SkThread.h" |
| 12 #include "SkTDArray.h" | 12 #include "SkTDArray.h" |
| 13 | 13 |
| 14 struct SkIRect; | 14 struct SkIRect; |
| 15 class SkMatrix; | 15 class SkMatrix; |
| 16 class SkPDFFont; | 16 class SkPDFFont; |
| 17 class SkPDFGraphicState; | 17 class SkPDFGraphicState; |
| 18 class SkPaint; | 18 class SkPaint; |
| 19 class SkShader; | |
| 20 | 19 |
| 21 // This class's fields and methods will eventually become part of | 20 // This class's fields and methods will eventually become part of |
| 22 // SkPDFDocument/SkDocument_PDF. For now, it exists as a singleton to | 21 // SkPDFDocument/SkDocument_PDF. For now, it exists as a singleton to |
| 23 // preflight that transition. This replaces three global arrays in | 22 // preflight that transition. This replaces three global arrays in |
| 24 // SkPDFFont, SkPDFShader, and SkPDFGraphicsContext. | 23 // SkPDFFont, SkPDFShader, and SkPDFGraphicsContext. |
| 25 // | 24 // |
| 26 // IF YOU ARE LOOKING AT THIS API PLEASE DO NOT WRITE THE CHANGE | 25 // IF YOU ARE LOOKING AT THIS API PLEASE DO NOT WRITE THE CHANGE |
| 27 // YOU ARE ABOUT TO WRITE WITHOUT TALKING TO HALCANARY@. | 26 // YOU ARE ABOUT TO WRITE WITHOUT TALKING TO HALCANARY@. |
| 28 // | 27 // |
| 29 // Note that this class does not create, delete, reference or | 28 // Note that this class does not create, delete, reference or |
| (...skipping 14 matching lines...) Expand all Loading... |
| 44 | 43 |
| 45 // Returns exact match if there is one. If not, it returns NULL. | 44 // Returns exact match if there is one. If not, it returns NULL. |
| 46 // If there is no exact match, but there is a related font, we | 45 // If there is no exact match, but there is a related font, we |
| 47 // still return NULL, but also set *relatedFont. | 46 // still return NULL, but also set *relatedFont. |
| 48 SkPDFFont* findFont(uint32_t fontID, | 47 SkPDFFont* findFont(uint32_t fontID, |
| 49 uint16_t glyphID, | 48 uint16_t glyphID, |
| 50 SkPDFFont** relatedFont) const; | 49 SkPDFFont** relatedFont) const; |
| 51 void addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID); | 50 void addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID); |
| 52 void removeFont(SkPDFFont*); | 51 void removeFont(SkPDFFont*); |
| 53 | 52 |
| 54 SkPDFShader* findShader(const SkPDFShader::State&) const; | 53 SkPDFFunctionShader* findFunctionShader(const SkPDFShader::State&) const; |
| 55 void addShader(SkPDFShader*); | 54 void addFunctionShader(SkPDFFunctionShader*); |
| 56 void removeShader(SkPDFShader*); | 55 void removeFunctionShader(SkPDFFunctionShader*); |
| 56 |
| 57 SkPDFAlphaFunctionShader* findAlphaShader(const SkPDFShader::State&) const; |
| 58 void addAlphaShader(SkPDFAlphaFunctionShader*); |
| 59 void removeAlphaShader(SkPDFAlphaFunctionShader*); |
| 60 |
| 61 SkPDFImageShader* findImageShader(const SkPDFShader::State&) const; |
| 62 void addImageShader(SkPDFImageShader*); |
| 63 void removeImageShader(SkPDFImageShader*); |
| 57 | 64 |
| 58 SkPDFGraphicState* findGraphicState(const SkPaint&) const; | 65 SkPDFGraphicState* findGraphicState(const SkPaint&) const; |
| 59 void addGraphicState(SkPDFGraphicState*); | 66 void addGraphicState(SkPDFGraphicState*); |
| 60 void removeGraphicState(SkPDFGraphicState*); | 67 void removeGraphicState(SkPDFGraphicState*); |
| 61 | 68 |
| 62 private: | 69 private: |
| 63 struct FontRec { | 70 struct FontRec { |
| 64 SkPDFFont* fFont; | 71 SkPDFFont* fFont; |
| 65 uint32_t fFontID; | 72 uint32_t fFontID; |
| 66 uint16_t fGlyphID; | 73 uint16_t fGlyphID; |
| 67 }; | 74 }; |
| 68 SkTDArray<FontRec> fFontRecords; | 75 SkTDArray<FontRec> fFontRecords; |
| 69 | 76 |
| 70 SkTDArray<SkPDFShader*> fShaderRecords; | 77 SkTDArray<SkPDFFunctionShader*> fFunctionShaderRecords; |
| 78 |
| 79 SkTDArray<SkPDFAlphaFunctionShader*> fAlphaShaderRecords; |
| 80 |
| 81 SkTDArray<SkPDFImageShader*> fImageShaderRecords; |
| 71 | 82 |
| 72 SkTDArray<SkPDFGraphicState*> fGraphicStateRecords; | 83 SkTDArray<SkPDFGraphicState*> fGraphicStateRecords; |
| 73 }; | 84 }; |
| 74 #endif // SkPDFCanon_DEFINED | 85 #endif // SkPDFCanon_DEFINED |
| OLD | NEW |