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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 }; | 434 }; |
435 | 435 |
436 private: | 436 private: |
437 static const int kMaxLen = 4095; | 437 static const int kMaxLen = 4095; |
438 | 438 |
439 SkTDArray<struct Rec> fValue; | 439 SkTDArray<struct Rec> fValue; |
440 | 440 |
441 typedef SkPDFObject INHERITED; | 441 typedef SkPDFObject INHERITED; |
442 }; | 442 }; |
443 | 443 |
444 /** \class SkPDFResourceDict | |
445 | |
446 A resource dictionary, which also allows generation of a list of referenced | |
447 SkPDFObjects. These must be added to the dict with insertResource. | |
448 */ | |
449 class SkPDFResourceDict : public SkPDFDict { | |
vandebo (ex-Chrome)
2013/07/08 19:02:25
Not sure I'm happy with how this turned out. It's
ducky
2013/07/09 02:56:23
Looks like it can be used in SkPDFDevice, the only
| |
450 public: | |
451 SK_DECLARE_INST_COUNT(SkPDFResourceDict) | |
452 | |
453 /** Create a PDF dictionary. Maximum number of entries is 4095. | |
vandebo (ex-Chrome)
2013/07/08 19:02:25
comments are out of date....
ducky
2013/07/09 02:56:23
Done.
| |
454 */ | |
455 SkPDFResourceDict() : SkPDFDict() {}; | |
456 | |
457 /** Create a PDF dictionary with a Type entry. | |
458 * @param type The value of the Type entry. | |
459 */ | |
460 explicit SkPDFResourceDict(const char type[]) : SkPDFDict(type) {}; | |
461 | |
462 | |
463 /** Add the value to the dictionary with the given key. Refs value. | |
464 * The object will NOT be part of the resource list when requested later. | |
465 * @param type The type of resource being entered, like Pattern or ExtGSta te. | |
466 * @param key The resource key, unique within the type. | |
467 * @param value The resource itself. | |
468 * @return The value argument is returned. | |
469 */ | |
470 SkPDFObject* insertResource(SkPDFName* type, SkPDFName* key, | |
471 SkPDFObject* value); | |
472 | |
473 /** Add the value to the dictionary with the given key. Refs value. | |
474 * The object will NOT be part of the resource list when requested later. | |
475 * This method will create the SkPDFName object. | |
476 * @param type The type of resource being entered, like Pattern or ExtGSta te. | |
477 * @param key The resource key, unique within the type. | |
478 * @param value The resource itself. | |
479 * @return The value argument is returned. | |
480 */ | |
481 SkPDFObject* insertResource(const char type[], const char key[], | |
482 SkPDFObject* value); | |
483 | |
484 /** Add the value SkPDFObject as a reference to the dictionary | |
485 * with the given key. Refs value. | |
486 * This object will be part of the resource list when requested later. | |
487 * This method will create the SkPDFName object. | |
488 * @param type The type of resource being entered, like Pattern or ExtGSta te. | |
489 * @param key The resource key, unique within the type. | |
490 * @param value The resource itself. | |
491 * @return The value argument is returned. | |
492 */ | |
493 SkPDFObject* insertResourceAsRef(const char type[], const char key[], | |
494 SkPDFObject* value); | |
495 | |
496 /** | |
497 * Gets resources inserted into this dictionary. | |
498 * | |
499 * @param knownResourceObjects Set containing currently known resources. | |
500 * Resources in the dict and in this set will not be added to the output . | |
501 * @param newResourceObjects Output set to which non-preexisting resources | |
502 * will be added. | |
503 */ | |
504 void getResources( | |
505 const SkTSet<SkPDFObject*>& knownResourceObjects, | |
506 SkTSet<SkPDFObject*>* newResourceObjects); | |
507 | |
508 private: | |
509 /** | |
510 * Returns the sub-dict associated with the resource type type. | |
511 * If none currently exists, this will create a sub-dict and index it for | |
512 * future use. | |
513 */ | |
514 SkPDFDict* getResourceTypeDict(SkPDFName* type); | |
515 | |
516 SkTSet<SkPDFObject*> fResources; | |
517 | |
518 struct DictRec { | |
519 SkPDFName* key; | |
520 SkPDFDict* value; | |
521 }; | |
522 SkTDArray<struct DictRec> fTypes; | |
523 }; | |
524 | |
444 #endif | 525 #endif |
OLD | NEW |