1 /*
2 * Copyright 2013 Google Inc.
3
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkPdfMovieDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10
F(SkPdfNativeDoc * doc)11 SkPdfFileSpec SkPdfMovieDictionary::F(SkPdfNativeDoc* doc) {
12 SkPdfNativeObject* ret = get("F", "");
13 if (doc) {ret = doc->resolveReference(ret);}
14 if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference())) return ret->fileSpecValue();
15 // TODO(edisonn): warn about missing required field, assert for known good pdfs
16 return SkPdfFileSpec();
17 }
18
has_F() const19 bool SkPdfMovieDictionary::has_F() const {
20 return get("F", "") != NULL;
21 }
22
Aspect(SkPdfNativeDoc * doc)23 SkPdfArray* SkPdfMovieDictionary::Aspect(SkPdfNativeDoc* doc) {
24 SkPdfNativeObject* ret = get("Aspect", "");
25 if (doc) {ret = doc->resolveReference(ret);}
26 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
27 // TODO(edisonn): warn about missing default value for optional fields
28 return NULL;
29 }
30
has_Aspect() const31 bool SkPdfMovieDictionary::has_Aspect() const {
32 return get("Aspect", "") != NULL;
33 }
34
Rotate(SkPdfNativeDoc * doc)35 int64_t SkPdfMovieDictionary::Rotate(SkPdfNativeDoc* doc) {
36 SkPdfNativeObject* ret = get("Rotate", "");
37 if (doc) {ret = doc->resolveReference(ret);}
38 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
39 // TODO(edisonn): warn about missing default value for optional fields
40 return 0;
41 }
42
has_Rotate() const43 bool SkPdfMovieDictionary::has_Rotate() const {
44 return get("Rotate", "") != NULL;
45 }
46
isPosterABoolean(SkPdfNativeDoc * doc)47 bool SkPdfMovieDictionary::isPosterABoolean(SkPdfNativeDoc* doc) {
48 SkPdfNativeObject* ret = get("Poster", "");
49 if (doc) {ret = doc->resolveReference(ret);}
50 return ret != NULL && ret->isBoolean();
51 }
52
getPosterAsBoolean(SkPdfNativeDoc * doc)53 bool SkPdfMovieDictionary::getPosterAsBoolean(SkPdfNativeDoc* doc) {
54 SkPdfNativeObject* ret = get("Poster", "");
55 if (doc) {ret = doc->resolveReference(ret);}
56 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
57 // TODO(edisonn): warn about missing default value for optional fields
58 return false;
59 }
60
isPosterAStream(SkPdfNativeDoc * doc)61 bool SkPdfMovieDictionary::isPosterAStream(SkPdfNativeDoc* doc) {
62 SkPdfNativeObject* ret = get("Poster", "");
63 if (doc) {ret = doc->resolveReference(ret);}
64 return ret != NULL && ret->hasStream();
65 }
66
getPosterAsStream(SkPdfNativeDoc * doc)67 SkPdfStream* SkPdfMovieDictionary::getPosterAsStream(SkPdfNativeDoc* doc) {
68 SkPdfNativeObject* ret = get("Poster", "");
69 if (doc) {ret = doc->resolveReference(ret);}
70 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
71 // TODO(edisonn): warn about missing default value for optional fields
72 return NULL;
73 }
74
has_Poster() const75 bool SkPdfMovieDictionary::has_Poster() const {
76 return get("Poster", "") != NULL;
77 }
78