| 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 "SkAdvancedTypefaceMetrics.h" | 10 #include "SkAdvancedTypefaceMetrics.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // PDF does not support image filters, so render them on CPU. | 341 // PDF does not support image filters, so render them on CPU. |
| 342 // Note that this rendering is done at "screen" resolution (100dpi), not | 342 // Note that this rendering is done at "screen" resolution (100dpi), not |
| 343 // printer resolution. | 343 // printer resolution. |
| 344 // TODO: It may be possible to express some filters natively using PDF | 344 // TODO: It may be possible to express some filters natively using PDF |
| 345 // to improve quality and file size (https://bug.skia.org/3043) | 345 // to improve quality and file size (https://bug.skia.org/3043) |
| 346 | 346 |
| 347 // TODO: should we return true if there is a colorfilter? | 347 // TODO: should we return true if there is a colorfilter? |
| 348 return layerPaint.getImageFilter() != nullptr; | 348 return layerPaint.getImageFilter() != nullptr; |
| 349 } | 349 } |
| 350 | 350 |
| 351 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
* layerPaint) { | 351 SkBaseDevice* SkPDFDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
* layerPaint, |
| 352 SkRasterCanvasLayerAllocator*) { |
| 352 if (layerPaint && not_supported_for_layers(*layerPaint)) { | 353 if (layerPaint && not_supported_for_layers(*layerPaint)) { |
| 353 // need to return a raster device, which we will detect in drawDevice() | 354 // need to return a raster device, which we will detect in drawDevice() |
| 354 return SkBitmapDevice::Create(cinfo.fInfo, SkSurfaceProps(0, kUnknown_Sk
PixelGeometry)); | 355 return SkBitmapDevice::Create(cinfo.fInfo, SkSurfaceProps(0, kUnknown_Sk
PixelGeometry)); |
| 355 } | 356 } |
| 356 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); | 357 SkISize size = SkISize::Make(cinfo.fInfo.width(), cinfo.fInfo.height()); |
| 357 return SkPDFDevice::Create(size, fRasterDpi, fDocument); | 358 return SkPDFDevice::Create(size, fRasterDpi, fDocument); |
| 358 } | 359 } |
| 359 | 360 |
| 360 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); } | 361 SkPDFCanon* SkPDFDevice::getCanon() const { return fDocument->canon(); } |
| 361 | 362 |
| (...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2309 } | 2310 } |
| 2310 | 2311 |
| 2311 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { | 2312 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { |
| 2312 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), | 2313 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), |
| 2313 image->makeNonTextureImage()); | 2314 image->makeNonTextureImage()); |
| 2314 } | 2315 } |
| 2315 | 2316 |
| 2316 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { | 2317 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { |
| 2317 return nullptr; | 2318 return nullptr; |
| 2318 } | 2319 } |
| OLD | NEW |