OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPDFTypes_DEFINED | 10 #ifndef SkPDFTypes_DEFINED |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 class SkPDFString : public SkPDFObject { | 166 class SkPDFString : public SkPDFObject { |
167 public: | 167 public: |
168 SK_DECLARE_INST_COUNT(SkPDFString) | 168 SK_DECLARE_INST_COUNT(SkPDFString) |
169 | 169 |
170 /** Create a PDF string. Maximum length (in bytes) is 65,535. | 170 /** Create a PDF string. Maximum length (in bytes) is 65,535. |
171 * @param value A string value. | 171 * @param value A string value. |
172 */ | 172 */ |
173 explicit SkPDFString(const char value[]); | 173 explicit SkPDFString(const char value[]); |
174 explicit SkPDFString(const SkString& value); | 174 explicit SkPDFString(const SkString& value); |
175 | 175 |
176 /** Create a PDF string. Maximum length (in bytes) is 65,535. | |
177 * @param value A string value. | |
178 * @param len The length of value. | |
179 * @param wideChars Indicates if the top byte in value is significant and | |
180 * should be encoded (true) or not (false). | |
181 */ | |
182 SkPDFString(const uint16_t* value, size_t len, bool wideChars); | |
183 virtual ~SkPDFString(); | 176 virtual ~SkPDFString(); |
184 | 177 |
185 // The SkPDFObject interface. | 178 // The SkPDFObject interface. |
186 virtual void emitObject(SkWStream* stream, | 179 virtual void emitObject(SkWStream* stream, |
187 const SkPDFObjNumMap& objNumMap, | 180 const SkPDFObjNumMap& objNumMap, |
188 const SkPDFSubstituteMap& substitutes) override; | 181 const SkPDFSubstituteMap& substitutes) override; |
189 | 182 |
190 static SkString FormatString(const char* input, size_t len); | 183 static SkString FormatString(const char* input, size_t len); |
191 static SkString FormatString(const uint16_t* input, size_t len, | |
192 bool wideChars); | |
193 private: | 184 private: |
194 static const size_t kMaxLen = 65535; | 185 static const size_t kMaxLen = 65535; |
195 | 186 |
196 const SkString fValue; | 187 const SkString fValue; |
197 | 188 |
198 static SkString DoFormatString(const void* input, size_t len, | |
199 bool wideInput, bool wideOutput); | |
200 | |
201 typedef SkPDFObject INHERITED; | 189 typedef SkPDFObject INHERITED; |
202 }; | 190 }; |
203 | 191 |
204 /** \class SkPDFName | 192 /** \class SkPDFName |
205 | 193 |
206 A name object in a PDF. | 194 A name object in a PDF. |
207 */ | 195 */ |
208 class SkPDFName : public SkPDFObject { | 196 class SkPDFName : public SkPDFObject { |
209 public: | 197 public: |
210 SK_DECLARE_INST_COUNT(SkPDFName) | 198 SK_DECLARE_INST_COUNT(SkPDFName) |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 int32_t getObjectNumber(SkPDFObject* obj) const; | 442 int32_t getObjectNumber(SkPDFObject* obj) const; |
455 | 443 |
456 const SkTDArray<SkPDFObject*>& objects() const { return fObjects; } | 444 const SkTDArray<SkPDFObject*>& objects() const { return fObjects; } |
457 | 445 |
458 private: | 446 private: |
459 SkTDArray<SkPDFObject*> fObjects; | 447 SkTDArray<SkPDFObject*> fObjects; |
460 SkTHashMap<SkPDFObject*, int32_t> fObjectNumbers; | 448 SkTHashMap<SkPDFObject*, int32_t> fObjectNumbers; |
461 }; | 449 }; |
462 | 450 |
463 #endif | 451 #endif |
OLD | NEW |