OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #include "SkPDFTypes.h" | 9 #include "SkPDFTypes.h" |
10 #include "SkPDFUtils.h" | 10 #include "SkPDFUtils.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 SkASSERT(ptr); | 253 SkASSERT(ptr); |
254 u.fObject = ptr; | 254 u.fObject = ptr; |
255 return u.move(); | 255 return u.move(); |
256 } | 256 } |
257 | 257 |
258 //////////////////////////////////////////////////////////////////////////////// | 258 //////////////////////////////////////////////////////////////////////////////// |
259 | 259 |
260 #if 0 // Enable if needed. | 260 #if 0 // Enable if needed. |
261 void SkPDFAtom::emitObject(SkWStream* stream, | 261 void SkPDFAtom::emitObject(SkWStream* stream, |
262 const SkPDFObjNumMap& objNumMap, | 262 const SkPDFObjNumMap& objNumMap, |
263 const SkPDFSubstituteMap& substitutes) { | 263 const SkPDFSubstituteMap& substitutes) const { |
264 fValue.emitObject(stream, objNumMap, substitutes); | 264 fValue.emitObject(stream, objNumMap, substitutes); |
265 } | 265 } |
266 void SkPDFAtom::addResources(SkPDFObjNumMap* map, | 266 void SkPDFAtom::addResources(SkPDFObjNumMap* map, |
267 const SkPDFSubstituteMap& substitutes) const { | 267 const SkPDFSubstituteMap& substitutes) const { |
268 fValue.addResources(map, substitutes); | 268 fValue.addResources(map, substitutes); |
269 } | 269 } |
270 #endif // 0 | 270 #endif // 0 |
271 | 271 |
272 //////////////////////////////////////////////////////////////////////////////// | 272 //////////////////////////////////////////////////////////////////////////////// |
273 | 273 |
274 SkPDFArray::SkPDFArray() {} | 274 SkPDFArray::SkPDFArray() {} |
275 SkPDFArray::~SkPDFArray() { | 275 SkPDFArray::~SkPDFArray() { |
276 for (SkPDFUnion& value : fValues) { | 276 for (SkPDFUnion& value : fValues) { |
277 value.~SkPDFUnion(); | 277 value.~SkPDFUnion(); |
278 } | 278 } |
279 fValues.reset(); | 279 fValues.reset(); |
280 } | 280 } |
281 | 281 |
282 int SkPDFArray::size() const { return fValues.count(); } | 282 int SkPDFArray::size() const { return fValues.count(); } |
283 | 283 |
284 void SkPDFArray::reserve(int length) { fValues.setReserve(length); } | 284 void SkPDFArray::reserve(int length) { fValues.setReserve(length); } |
285 | 285 |
286 void SkPDFArray::emitObject(SkWStream* stream, | 286 void SkPDFArray::emitObject(SkWStream* stream, |
287 const SkPDFObjNumMap& objNumMap, | 287 const SkPDFObjNumMap& objNumMap, |
288 const SkPDFSubstituteMap& substitutes) { | 288 const SkPDFSubstituteMap& substitutes) const { |
289 stream->writeText("["); | 289 stream->writeText("["); |
290 for (int i = 0; i < fValues.count(); i++) { | 290 for (int i = 0; i < fValues.count(); i++) { |
291 fValues[i].emitObject(stream, objNumMap, substitutes); | 291 fValues[i].emitObject(stream, objNumMap, substitutes); |
292 if (i + 1 < fValues.count()) { | 292 if (i + 1 < fValues.count()) { |
293 stream->writeText(" "); | 293 stream->writeText(" "); |
294 } | 294 } |
295 } | 295 } |
296 stream->writeText("]"); | 296 stream->writeText("]"); |
297 } | 297 } |
298 | 298 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 /////////////////////////////////////////////////////////////////////////////// | 346 /////////////////////////////////////////////////////////////////////////////// |
347 | 347 |
348 SkPDFDict::SkPDFDict() {} | 348 SkPDFDict::SkPDFDict() {} |
349 | 349 |
350 SkPDFDict::~SkPDFDict() { this->clear(); } | 350 SkPDFDict::~SkPDFDict() { this->clear(); } |
351 | 351 |
352 SkPDFDict::SkPDFDict(const char type[]) { this->insertName("Type", type); } | 352 SkPDFDict::SkPDFDict(const char type[]) { this->insertName("Type", type); } |
353 | 353 |
354 void SkPDFDict::emitObject(SkWStream* stream, | 354 void SkPDFDict::emitObject(SkWStream* stream, |
355 const SkPDFObjNumMap& objNumMap, | 355 const SkPDFObjNumMap& objNumMap, |
356 const SkPDFSubstituteMap& substitutes) { | 356 const SkPDFSubstituteMap& substitutes) const { |
357 stream->writeText("<<"); | 357 stream->writeText("<<"); |
358 for (int i = 0; i < fRecords.count(); i++) { | 358 for (int i = 0; i < fRecords.count(); i++) { |
359 fRecords[i].fKey.emitObject(stream, objNumMap, substitutes); | 359 fRecords[i].fKey.emitObject(stream, objNumMap, substitutes); |
360 stream->writeText(" "); | 360 stream->writeText(" "); |
361 fRecords[i].fValue.emitObject(stream, objNumMap, substitutes); | 361 fRecords[i].fValue.emitObject(stream, objNumMap, substitutes); |
362 if (i + 1 < fRecords.count()) { | 362 if (i + 1 < fRecords.count()) { |
363 stream->writeText("\n"); | 363 stream->writeText("\n"); |
364 } | 364 } |
365 } | 365 } |
366 stream->writeText(">>"); | 366 stream->writeText(">>"); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 fObjects.push(obj); | 466 fObjects.push(obj); |
467 return true; | 467 return true; |
468 } | 468 } |
469 | 469 |
470 int32_t SkPDFObjNumMap::getObjectNumber(SkPDFObject* obj) const { | 470 int32_t SkPDFObjNumMap::getObjectNumber(SkPDFObject* obj) const { |
471 int32_t* objectNumberFound = fObjectNumbers.find(obj); | 471 int32_t* objectNumberFound = fObjectNumbers.find(obj); |
472 SkASSERT(objectNumberFound); | 472 SkASSERT(objectNumberFound); |
473 return *objectNumberFound; | 473 return *objectNumberFound; |
474 } | 474 } |
475 | 475 |
OLD | NEW |