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 "SkFlate.h" | 9 #include "SkFlate.h" |
10 #include "SkPDFBitmap.h" | 10 #include "SkPDFBitmap.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 //////////////////////////////////////////////////////////////////////////////// | 239 //////////////////////////////////////////////////////////////////////////////// |
240 | 240 |
241 namespace { | 241 namespace { |
242 // This SkPDFObject only outputs the alpha layer of the given bitmap. | 242 // This SkPDFObject only outputs the alpha layer of the given bitmap. |
243 class PDFAlphaBitmap : public SkPDFObject { | 243 class PDFAlphaBitmap : public SkPDFObject { |
244 public: | 244 public: |
245 PDFAlphaBitmap(const SkBitmap& bm) : fBitmap(bm) {} | 245 PDFAlphaBitmap(const SkBitmap& bm) : fBitmap(bm) {} |
246 ~PDFAlphaBitmap() {} | 246 ~PDFAlphaBitmap() {} |
247 void emitObject(SkWStream*, SkPDFCatalog*) SK_OVERRIDE; | 247 void emitObject(SkWStream*, SkPDFCatalog*) override; |
248 | 248 |
249 private: | 249 private: |
250 const SkBitmap fBitmap; | 250 const SkBitmap fBitmap; |
251 void emitDict(SkWStream*, SkPDFCatalog*, size_t) const; | 251 void emitDict(SkWStream*, SkPDFCatalog*, size_t) const; |
252 }; | 252 }; |
253 | 253 |
254 void PDFAlphaBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { | 254 void PDFAlphaBitmap::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { |
255 SkAutoLockPixels autoLockPixels(fBitmap); | 255 SkAutoLockPixels autoLockPixels(fBitmap); |
256 SkASSERT(fBitmap.colorType() != kIndex_8_SkColorType || | 256 SkASSERT(fBitmap.colorType() != kIndex_8_SkColorType || |
257 fBitmap.getColorTable()); | 257 fBitmap.getColorTable()); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 return SkRef(canonBitmap); | 399 return SkRef(canonBitmap); |
400 } | 400 } |
401 SkPDFObject* smask = NULL; | 401 SkPDFObject* smask = NULL; |
402 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { | 402 if (!bm.isOpaque() && !SkBitmap::ComputeIsOpaque(bm)) { |
403 smask = SkNEW_ARGS(PDFAlphaBitmap, (bm)); | 403 smask = SkNEW_ARGS(PDFAlphaBitmap, (bm)); |
404 } | 404 } |
405 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(SkPDFBitmap, (bm, smask)); | 405 SkPDFBitmap* pdfBitmap = SkNEW_ARGS(SkPDFBitmap, (bm, smask)); |
406 canon->addBitmap(pdfBitmap); | 406 canon->addBitmap(pdfBitmap); |
407 return pdfBitmap; | 407 return pdfBitmap; |
408 } | 408 } |
OLD | NEW |