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

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

Issue 1461403002: SkPDF: add `final` keyword to leaf classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/SkDeflate.h ('k') | src/pdf/SkPDFDevice.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 "SkData.h" 9 #include "SkData.h"
10 #include "SkDeflate.h" 10 #include "SkDeflate.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 373
374 pdf_stream_begin(stream); 374 pdf_stream_begin(stream);
375 stream->writeStream(asset.get(), asset->getLength()); 375 stream->writeStream(asset.get(), asset->getLength());
376 pdf_stream_end(stream); 376 pdf_stream_end(stream);
377 } 377 }
378 378
379 //////////////////////////////////////////////////////////////////////////////// 379 ////////////////////////////////////////////////////////////////////////////////
380 380
381 namespace { 381 namespace {
382 // This SkPDFObject only outputs the alpha layer of the given bitmap. 382 // This SkPDFObject only outputs the alpha layer of the given bitmap.
383 class PDFAlphaBitmap : public SkPDFObject { 383 class PDFAlphaBitmap final : public SkPDFObject {
384 public: 384 public:
385 PDFAlphaBitmap(const SkImage* image) : fImage(SkRef(image)) {} 385 PDFAlphaBitmap(const SkImage* image) : fImage(SkRef(image)) {}
386 ~PDFAlphaBitmap() {} 386 ~PDFAlphaBitmap() {}
387 void emitObject(SkWStream* stream, 387 void emitObject(SkWStream* stream,
388 const SkPDFObjNumMap& objNumMap, 388 const SkPDFObjNumMap& objNumMap,
389 const SkPDFSubstituteMap& subs) const override { 389 const SkPDFSubstituteMap& subs) const override {
390 emit_image_xobject(stream, fImage, true, nullptr, objNumMap, subs); 390 emit_image_xobject(stream, fImage, true, nullptr, objNumMap, subs);
391 } 391 }
392 392
393 private: 393 private:
394 SkAutoTUnref<const SkImage> fImage; 394 SkAutoTUnref<const SkImage> fImage;
395 }; 395 };
396 396
397 } // namespace 397 } // namespace
398 398
399 //////////////////////////////////////////////////////////////////////////////// 399 ////////////////////////////////////////////////////////////////////////////////
400 400
401 namespace { 401 namespace {
402 class PDFDefaultBitmap : public SkPDFObject { 402 class PDFDefaultBitmap final : public SkPDFObject {
403 public: 403 public:
404 void emitObject(SkWStream* stream, 404 void emitObject(SkWStream* stream,
405 const SkPDFObjNumMap& objNumMap, 405 const SkPDFObjNumMap& objNumMap,
406 const SkPDFSubstituteMap& subs) const override { 406 const SkPDFSubstituteMap& subs) const override {
407 emit_image_xobject(stream, fImage, false, fSMask, objNumMap, subs); 407 emit_image_xobject(stream, fImage, false, fSMask, objNumMap, subs);
408 } 408 }
409 void addResources(SkPDFObjNumMap* catalog, 409 void addResources(SkPDFObjNumMap* catalog,
410 const SkPDFSubstituteMap& subs) const override { 410 const SkPDFSubstituteMap& subs) const override {
411 if (fSMask.get()) { 411 if (fSMask.get()) {
412 SkPDFObject* obj = subs.getSubstitute(fSMask.get()); 412 SkPDFObject* obj = subs.getSubstitute(fSMask.get());
(...skipping 11 matching lines...) Expand all
424 } // namespace 424 } // namespace
425 425
426 //////////////////////////////////////////////////////////////////////////////// 426 ////////////////////////////////////////////////////////////////////////////////
427 427
428 namespace { 428 namespace {
429 /** 429 /**
430 * This PDFObject assumes that its constructor was handed YUV or 430 * This PDFObject assumes that its constructor was handed YUV or
431 * Grayscale JFIF Jpeg-encoded data that can be directly embedded 431 * Grayscale JFIF Jpeg-encoded data that can be directly embedded
432 * into a PDF. 432 * into a PDF.
433 */ 433 */
434 class PDFJpegBitmap : public SkPDFObject { 434 class PDFJpegBitmap final : public SkPDFObject {
435 public: 435 public:
436 SkISize fSize; 436 SkISize fSize;
437 SkAutoTUnref<SkData> fData; 437 SkAutoTUnref<SkData> fData;
438 bool fIsYUV; 438 bool fIsYUV;
439 PDFJpegBitmap(SkISize size, SkData* data, bool isYUV) 439 PDFJpegBitmap(SkISize size, SkData* data, bool isYUV)
440 : fSize(size), fData(SkRef(data)), fIsYUV(isYUV) {} 440 : fSize(size), fData(SkRef(data)), fIsYUV(isYUV) {}
441 void emitObject(SkWStream*, 441 void emitObject(SkWStream*,
442 const SkPDFObjNumMap&, 442 const SkPDFObjNumMap&,
443 const SkPDFSubstituteMap&) const override; 443 const SkPDFSubstituteMap&) const override;
444 }; 444 };
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 return new PDFJpegBitmap(info.fSize, data, yuv); 481 return new PDFJpegBitmap(info.fSize, data, yuv);
482 } 482 }
483 } 483 }
484 SkPDFObject* smask = 484 SkPDFObject* smask =
485 image_compute_is_opaque(image) ? nullptr : new PDFAlphaBitmap(image) ; 485 image_compute_is_opaque(image) ? nullptr : new PDFAlphaBitmap(image) ;
486 #ifdef SK_PDF_IMAGE_STATS 486 #ifdef SK_PDF_IMAGE_STATS
487 gRegularImageObjects.fetch_add(1); 487 gRegularImageObjects.fetch_add(1);
488 #endif 488 #endif
489 return new PDFDefaultBitmap(image, smask); 489 return new PDFDefaultBitmap(image, smask);
490 } 490 }
OLDNEW
« no previous file with comments | « src/pdf/SkDeflate.h ('k') | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698