OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 #include "SkColorPriv.h" | 8 #include "SkColorPriv.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDeflate.h" | 10 #include "SkDeflate.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 if (fSMask.get()) { | 307 if (fSMask.get()) { |
308 SkPDFObject* obj = substitutes.getSubstitute(fSMask.get()); | 308 SkPDFObject* obj = substitutes.getSubstitute(fSMask.get()); |
309 SkASSERT(obj); | 309 SkASSERT(obj); |
310 if (catalog->addObject(obj)) { | 310 if (catalog->addObject(obj)) { |
311 obj->addResources(catalog, substitutes); | 311 obj->addResources(catalog, substitutes); |
312 } | 312 } |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 static SkPDFArray* make_indexed_color_space(const SkColorTable* table) { | 316 static SkPDFArray* make_indexed_color_space(const SkColorTable* table) { |
317 SkPDFArray* result = SkNEW(SkPDFArray); | 317 SkPDFArray* result = new SkPDFArray; |
318 result->reserve(4); | 318 result->reserve(4); |
319 result->appendName("Indexed"); | 319 result->appendName("Indexed"); |
320 result->appendName("DeviceRGB"); | 320 result->appendName("DeviceRGB"); |
321 SkASSERT(table); | 321 SkASSERT(table); |
322 if (table->count() < 1) { | 322 if (table->count() < 1) { |
323 result->appendInt(0); | 323 result->appendInt(0); |
324 char shortTableArray[3] = {0, 0, 0}; | 324 char shortTableArray[3] = {0, 0, 0}; |
325 SkString tableString(shortTableArray, SK_ARRAY_COUNT(shortTableArray)); | 325 SkString tableString(shortTableArray, SK_ARRAY_COUNT(shortTableArray)); |
326 result->appendString(tableString); | 326 result->appendString(tableString); |
327 return result; | 327 return result; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 return SkRef(canonBitmap); | 450 return SkRef(canonBitmap); |
451 } | 451 } |
452 | 452 |
453 if (bm.pixelRef() && bm.pixelRefOrigin().isZero() && | 453 if (bm.pixelRef() && bm.pixelRefOrigin().isZero() && |
454 bm.dimensions() == bm.pixelRef()->info().dimensions()) { | 454 bm.dimensions() == bm.pixelRef()->info().dimensions()) { |
455 // Requires the bitmap to be backed by lazy pixels. | 455 // Requires the bitmap to be backed by lazy pixels. |
456 SkAutoTUnref<SkData> data(bm.pixelRef()->refEncodedData()); | 456 SkAutoTUnref<SkData> data(bm.pixelRef()->refEncodedData()); |
457 SkJFIFInfo info; | 457 SkJFIFInfo info; |
458 if (data && SkIsJFIF(data, &info)) { | 458 if (data && SkIsJFIF(data, &info)) { |
459 bool yuv = info.fType == SkJFIFInfo::kYCbCr; | 459 bool yuv = info.fType == SkJFIFInfo::kYCbCr; |
460 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(PDFJpegBitmap, (bm, data, yuv)); | 460 SkPDFBitmap* pdfBitmap = new PDFJpegBitmap(bm, data, yuv); |
461 canon->addBitmap(pdfBitmap); | 461 canon->addBitmap(pdfBitmap); |
462 return pdfBitmap; | 462 return pdfBitmap; |
463 } | 463 } |
464 } | 464 } |
465 | 465 |
466 SkPDFObject* smask = NULL; | 466 SkPDFObject* smask = NULL; |
467 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { | 467 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { |
468 smask = SkNEW_ARGS(PDFAlphaBitmap, (bm)); | 468 smask = new PDFAlphaBitmap(bm); |
469 } | 469 } |
470 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(PDFDefaultBitmap, (bm, smask)); | 470 SkPDFBitmap* pdfBitmap = new PDFDefaultBitmap(bm, smask); |
471 canon->addBitmap(pdfBitmap); | 471 canon->addBitmap(pdfBitmap); |
472 return pdfBitmap; | 472 return pdfBitmap; |
473 } | 473 } |
OLD | NEW |