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 maintains the relevant sub-dicts and | |
447 allows generation of a list of referenced SkPDFObjects inserted with | |
448 insertResourceAsRef. | |
449 */ | |
450 class SkPDFResourceDict : public SkPDFDict { | |
vandebo (ex-Chrome)
2013/07/09 17:47:44
This should go in its own file.
ducky
2013/07/10 21:42:26
Done. Will also move to a separate CL.
| |
451 public: | |
452 SK_DECLARE_INST_COUNT(SkPDFResourceDict) | |
453 | |
454 /** Create a PDF resource dictionary. | |
455 */ | |
456 SkPDFResourceDict() : SkPDFDict() {}; | |
vandebo (ex-Chrome)
2013/07/09 17:47:44
Should this take a parameter indicating whether it
ducky
2013/07/10 21:42:26
Done. Added a boolean parameter to automatically c
| |
457 | |
458 /** Create a PDF dictionary with a Type entry. | |
459 * @param type The value of the Type entry. | |
460 */ | |
461 explicit SkPDFResourceDict(const char type[]) : SkPDFDict(type) {}; | |
vandebo (ex-Chrome)
2013/07/09 17:47:44
Is this used/needed?
ducky
2013/07/10 21:42:26
Looks like no, as the spec makes no mention of a T
| |
462 | |
463 | |
464 /** Add the value to the dictionary with the given key. Refs value. | |
465 * The object will NOT be part of the resource list when requested later. | |
466 * @param type The type of resource being entered, like Pattern or ExtGSta te. | |
467 * @param key The resource key, unique within the type. | |
468 * @param value The resource itself. | |
469 * @return The value argument is returned. | |
470 */ | |
471 SkPDFObject* insertResource(SkPDFName* type, SkPDFName* key, | |
vandebo (ex-Chrome)
2013/07/09 17:47:44
|type| should probably be an enum.
vandebo (ex-Chrome)
2013/07/09 17:47:44
|key| should probably be an int with class static
ducky
2013/07/10 21:42:26
Done.
ducky
2013/07/10 21:42:26
Done.
| |
472 SkPDFObject* value); | |
473 | |
474 /** Add the value to the dictionary with the given key. Refs value. | |
475 * The object will NOT be part of the resource list when requested later. | |
476 * This method will create the SkPDFName object. | |
477 * @param type The type of resource being entered, like Pattern or ExtGSta te. | |
478 * @param key The resource key, unique within the type. | |
479 * @param value The resource itself. | |
480 * @return The value argument is returned. | |
481 */ | |
482 SkPDFObject* insertResource(const char type[], const char key[], | |
483 SkPDFObject* value); | |
484 | |
485 /** Add the value SkPDFObject as a reference to the dictionary | |
486 * with the given key. Refs value. | |
487 * This object will be part of the resource list when requested later. | |
488 * This method will create the SkPDFName object. | |
489 * @param type The type of resource being entered, like Pattern or ExtGSta te. | |
490 * @param key The resource key, unique within the type. | |
491 * @param value The resource itself. | |
492 * @return The value argument is returned. | |
493 */ | |
494 SkPDFObject* insertResourceAsRef(const char type[], const char key[], | |
vandebo (ex-Chrome)
2013/07/09 17:47:44
Aside from proc set, shouldn't all resources in th
ducky
2013/07/10 21:42:26
It doesn't have to be - I've seen PDFs where resou
| |
495 SkPDFObject* value); | |
496 | |
497 /** | |
498 * Gets resources inserted into this dictionary. | |
499 * | |
500 * @param knownResourceObjects Set containing currently known resources. | |
501 * Resources in the dict and in this set will not be added to the output . | |
502 * @param newResourceObjects Output set to which non-preexisting resources | |
503 * will be added. | |
504 */ | |
505 void getResources( | |
506 const SkTSet<SkPDFObject*>& knownResourceObjects, | |
507 SkTSet<SkPDFObject*>* newResourceObjects); | |
508 | |
509 private: | |
510 /** | |
511 * Returns the sub-dict associated with the resource type type. | |
512 * If none currently exists, this will create a sub-dict and index it for | |
513 * future use. | |
514 */ | |
515 SkPDFDict* getResourceTypeDict(SkPDFName* type); | |
516 | |
517 SkTSet<SkPDFObject*> fResources; | |
518 | |
519 struct DictRec { | |
520 SkPDFName* key; | |
521 SkPDFDict* value; | |
522 }; | |
523 SkTDArray<struct DictRec> fTypes; | |
524 }; | |
525 | |
444 #endif | 526 #endif |
OLD | NEW |