| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkPDFDevice.h" | 8 #include "SkPDFDevice.h" |
| 9 | 9 |
| 10 #include "SkAnnotationKeys.h" | 10 #include "SkAnnotationKeys.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 // PDF does not support image filters, so render them on CPU. | 339 // PDF does not support image filters, so render them on CPU. |
| 340 // Note that this rendering is done at "screen" resolution (100dpi), not | 340 // Note that this rendering is done at "screen" resolution (100dpi), not |
| 341 // printer resolution. | 341 // printer resolution. |
| 342 // TODO: It may be possible to express some filters natively using PDF | 342 // TODO: It may be possible to express some filters natively using PDF |
| 343 // to improve quality and file size (https://bug.skia.org/3043) | 343 // to improve quality and file size (https://bug.skia.org/3043) |
| 344 | 344 |
| 345 // TODO: should we return true if there is a colorfilter? | 345 // TODO: should we return true if there is a colorfilter? |
| 346 return layerPaint.getImageFilter() != nullptr; | 346 return layerPaint.getImageFilter() != nullptr; |
| 347 } | 347 } |
| 348 | 348 |
| 349 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
* layerPaint) { | 349 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
* layerPaint, |
| 350 SkRasterCanvasLayerAllocator*) { |
| 350 if (layerPaint && not_supported_for_layers(*layerPaint)) { | 351 if (layerPaint && not_supported_for_layers(*layerPaint)) { |
| 351 // need to return a raster device, which we will detect in drawDevice() | 352 // need to return a raster device, which we will detect in drawDevice() |
| 352 return SkBitmapDevice::Create(cinfo.fInfo, SkSurfaceProps(0, kUnknown_Sk
PixelGeometry)); | 353 return SkBitmapDevice::Create(cinfo.fInfo, SkSurfaceProps(0, kUnknown_Sk
PixelGeometry)); |
| 353 } | 354 } |
| 354 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); | 355 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); |
| 355 return SkPDFDevice::Create(size, fRasterDpi, fDocument); | 356 return SkPDFDevice::Create(size, fRasterDpi, fDocument); |
| 356 } | 357 } |
| 357 | 358 |
| 358 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); } | 359 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); } |
| 359 | 360 |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 } | 2040 } |
| 2040 | 2041 |
| 2041 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { | 2042 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { |
| 2042 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), | 2043 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), |
| 2043 image->makeNonTextureImage()); | 2044 image->makeNonTextureImage()); |
| 2044 } | 2045 } |
| 2045 | 2046 |
| 2046 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { | 2047 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { |
| 2047 return nullptr; | 2048 return nullptr; |
| 2048 } | 2049 } |
| OLD | NEW |