| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 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 | 7 |
| 8 | 8 |
| 9 #ifndef SkPDFTypes_DEFINED | 9 #ifndef SkPDFTypes_DEFINED |
| 10 #define SkPDFTypes_DEFINED | 10 #define SkPDFTypes_DEFINED |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 SkPDFUnion objects. */ | 83 SkPDFUnion objects. */ |
| 84 | 84 |
| 85 static SkPDFUnion Int(int32_t); | 85 static SkPDFUnion Int(int32_t); |
| 86 | 86 |
| 87 static SkPDFUnion Int(size_t v) { return SkPDFUnion::Int(SkToS32(v)); } | 87 static SkPDFUnion Int(size_t v) { return SkPDFUnion::Int(SkToS32(v)); } |
| 88 | 88 |
| 89 static SkPDFUnion Bool(bool); | 89 static SkPDFUnion Bool(bool); |
| 90 | 90 |
| 91 static SkPDFUnion Scalar(SkScalar); | 91 static SkPDFUnion Scalar(SkScalar); |
| 92 | 92 |
| 93 static SkPDFUnion ColorComponent(uint8_t); |
| 94 |
| 93 /** These two functions do NOT take ownership of char*, and do NOT | 95 /** These two functions do NOT take ownership of char*, and do NOT |
| 94 copy the string. Suitable for passing in static const | 96 copy the string. Suitable for passing in static const |
| 95 strings. For example: | 97 strings. For example: |
| 96 SkPDFUnion n = SkPDFUnion::Name("Length"); | 98 SkPDFUnion n = SkPDFUnion::Name("Length"); |
| 97 SkPDFUnion u = SkPDFUnion::String("Identity"); */ | 99 SkPDFUnion u = SkPDFUnion::String("Identity"); */ |
| 98 | 100 |
| 99 /** SkPDFUnion::Name(const char*) assumes that the passed string | 101 /** SkPDFUnion::Name(const char*) assumes that the passed string |
| 100 is already a valid name (that is: it has no control or | 102 is already a valid name (that is: it has no control or |
| 101 whitespace characters). This will not copy the name. */ | 103 whitespace characters). This will not copy the name. */ |
| 102 static SkPDFUnion Name(const char*); | 104 static SkPDFUnion Name(const char*); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 132 SkScalar fScalarValue; | 134 SkScalar fScalarValue; |
| 133 const char* fStaticString; | 135 const char* fStaticString; |
| 134 char fSkString[sizeof(SkString)]; | 136 char fSkString[sizeof(SkString)]; |
| 135 SkPDFObject* fObject; | 137 SkPDFObject* fObject; |
| 136 }; | 138 }; |
| 137 enum class Type : char { | 139 enum class Type : char { |
| 138 /** It is an error to call emitObject() or addResources() on an | 140 /** It is an error to call emitObject() or addResources() on an |
| 139 kDestroyed object. */ | 141 kDestroyed object. */ |
| 140 kDestroyed = 0, | 142 kDestroyed = 0, |
| 141 kInt, | 143 kInt, |
| 144 kColorComponent, |
| 142 kBool, | 145 kBool, |
| 143 kScalar, | 146 kScalar, |
| 144 kName, | 147 kName, |
| 145 kString, | 148 kString, |
| 146 kNameSkS, | 149 kNameSkS, |
| 147 kStringSkS, | 150 kStringSkS, |
| 148 kObjRef, | 151 kObjRef, |
| 149 kObject, | 152 kObject, |
| 150 }; | 153 }; |
| 151 Type fType; | 154 Type fType; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 208 |
| 206 /** Preallocate space for the given number of entries. | 209 /** Preallocate space for the given number of entries. |
| 207 * @param length The number of array slots to preallocate. | 210 * @param length The number of array slots to preallocate. |
| 208 */ | 211 */ |
| 209 void reserve(int length); | 212 void reserve(int length); |
| 210 | 213 |
| 211 /** Appends a value to the end of the array. | 214 /** Appends a value to the end of the array. |
| 212 * @param value The value to add to the array. | 215 * @param value The value to add to the array. |
| 213 */ | 216 */ |
| 214 void appendInt(int32_t); | 217 void appendInt(int32_t); |
| 218 void appendColorComponent(uint8_t); |
| 215 void appendBool(bool); | 219 void appendBool(bool); |
| 216 void appendScalar(SkScalar); | 220 void appendScalar(SkScalar); |
| 217 void appendName(const char[]); | 221 void appendName(const char[]); |
| 218 void appendName(const SkString&); | 222 void appendName(const SkString&); |
| 219 void appendString(const char[]); | 223 void appendString(const char[]); |
| 220 void appendString(const SkString&); | 224 void appendString(const SkString&); |
| 221 void appendObject(sk_sp<SkPDFObject>); | 225 void appendObject(sk_sp<SkPDFObject>); |
| 222 void appendObjRef(sk_sp<SkPDFObject>); | 226 void appendObjRef(sk_sp<SkPDFObject>); |
| 223 | 227 |
| 224 private: | 228 private: |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 }; | 387 }; |
| 384 | 388 |
| 385 #ifdef SK_PDF_IMAGE_STATS | 389 #ifdef SK_PDF_IMAGE_STATS |
| 386 extern SkAtomic<int> gDrawImageCalls; | 390 extern SkAtomic<int> gDrawImageCalls; |
| 387 extern SkAtomic<int> gJpegImageObjects; | 391 extern SkAtomic<int> gJpegImageObjects; |
| 388 extern SkAtomic<int> gRegularImageObjects; | 392 extern SkAtomic<int> gRegularImageObjects; |
| 389 extern void SkPDFImageDumpStats(); | 393 extern void SkPDFImageDumpStats(); |
| 390 #endif // SK_PDF_IMAGE_STATS | 394 #endif // SK_PDF_IMAGE_STATS |
| 391 | 395 |
| 392 #endif | 396 #endif |
| OLD | NEW |