Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/pdf/SkPDFBitmap.cpp

Issue 1038523004: SkPDF SkPDFObject::addResources signature simplified (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-25 (Wednesday) 15:53:41 EDT Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFBitmap.h ('k') | src/pdf/SkPDFCatalog.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkFlate.h" 9 #include "SkFlate.h"
10 #include "SkPDFBitmap.h" 10 #include "SkPDFBitmap.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 pdfDict.insertName("ColorSpace", "DeviceGray"); 279 pdfDict.insertName("ColorSpace", "DeviceGray");
280 pdfDict.insertInt("BitsPerComponent", 8); 280 pdfDict.insertInt("BitsPerComponent", 8);
281 pdfDict.insertName("Filter", "FlateDecode"); 281 pdfDict.insertName("Filter", "FlateDecode");
282 pdfDict.insertInt("Length", length); 282 pdfDict.insertInt("Length", length);
283 pdfDict.emitObject(stream, catalog); 283 pdfDict.emitObject(stream, catalog);
284 } 284 }
285 } // namespace 285 } // namespace
286 286
287 //////////////////////////////////////////////////////////////////////////////// 287 ////////////////////////////////////////////////////////////////////////////////
288 288
289 void SkPDFBitmap::addResources(SkTSet<SkPDFObject*>* resourceSet, 289 void SkPDFBitmap::addResources(SkPDFCatalog* catalog) const {
290 SkPDFCatalog* catalog) const {
291 if (fSMask.get()) { 290 if (fSMask.get()) {
292 if (resourceSet->add(fSMask.get())) { 291 if (catalog->addObject(fSMask.get())) {
293 fSMask->addResources(resourceSet, catalog); 292 fSMask->addResources(catalog);
294 } 293 }
295 } 294 }
296 } 295 }
297 296
298 void SkPDFBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { 297 void SkPDFBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
299 SkAutoLockPixels autoLockPixels(fBitmap); 298 SkAutoLockPixels autoLockPixels(fBitmap);
300 SkASSERT(fBitmap.colorType() != kIndex_8_SkColorType || 299 SkASSERT(fBitmap.colorType() != kIndex_8_SkColorType ||
301 fBitmap.getColorTable()); 300 fBitmap.getColorTable());
302 301
303 // Write to a temporary buffer to get the compressed length. 302 // Write to a temporary buffer to get the compressed length.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 return SkRef(canonBitmap); 399 return SkRef(canonBitmap);
401 } 400 }
402 SkPDFObject* smask = NULL; 401 SkPDFObject* smask = NULL;
403 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { 402 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) {
404 smask = SkNEW_ARGS(PDFAlphaBitmap, (bm)); 403 smask = SkNEW_ARGS(PDFAlphaBitmap, (bm));
405 } 404 }
406 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(SkPDFBitmap, (bm, smask)); 405 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(SkPDFBitmap, (bm, smask));
407 canon->addBitmap(pdfBitmap); 406 canon->addBitmap(pdfBitmap);
408 return pdfBitmap; 407 return pdfBitmap;
409 } 408 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFBitmap.h ('k') | src/pdf/SkPDFCatalog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698