| 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 #include "SkAnnotationKeys.h" | 9 #include "SkAnnotationKeys.h" |
| 10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
| (...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 SkXfermode* xmode, const uint16_t indices[], | 1338 SkXfermode* xmode, const uint16_t indices[], |
| 1339 int indexCount, const SkPaint& paint) { | 1339 int indexCount, const SkPaint& paint) { |
| 1340 if (d.fRC->isEmpty()) { | 1340 if (d.fRC->isEmpty()) { |
| 1341 return; | 1341 return; |
| 1342 } | 1342 } |
| 1343 // TODO: implement drawVertices | 1343 // TODO: implement drawVertices |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device, | 1346 void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device, |
| 1347 int x, int y, const SkPaint& paint) { | 1347 int x, int y, const SkPaint& paint) { |
| 1348 SkASSERT(!paint.getImageFilter()); |
| 1349 |
| 1348 // Check if the source device is really a bitmapdevice (because that's what
we returned | 1350 // Check if the source device is really a bitmapdevice (because that's what
we returned |
| 1349 // from createDevice (likely due to an imagefilter) | 1351 // from createDevice (likely due to an imagefilter) |
| 1350 SkPixmap pmap; | 1352 SkPixmap pmap; |
| 1351 if (device->peekPixels(&pmap)) { | 1353 if (device->peekPixels(&pmap)) { |
| 1352 SkBitmap bitmap; | 1354 SkBitmap bitmap; |
| 1353 bitmap.installPixels(pmap); | 1355 bitmap.installPixels(pmap); |
| 1354 if (paint.getImageFilter()) { | 1356 this->drawSprite(d, bitmap, x, y, paint); |
| 1355 this->drawSpriteWithFilter(d, bitmap, x, y, paint); | |
| 1356 } else { | |
| 1357 this->drawSprite(d, bitmap, x, y, paint); | |
| 1358 } | |
| 1359 return; | 1357 return; |
| 1360 } | 1358 } |
| 1361 | 1359 |
| 1362 // our onCreateCompatibleDevice() always creates SkPDFDevice subclasses. | 1360 // our onCreateCompatibleDevice() always creates SkPDFDevice subclasses. |
| 1363 SkPDFDevice* pdfDevice = static_cast<SkPDFDevice*>(device); | 1361 SkPDFDevice* pdfDevice = static_cast<SkPDFDevice*>(device); |
| 1364 | 1362 |
| 1365 SkScalar scalarX = SkIntToScalar(x); | 1363 SkScalar scalarX = SkIntToScalar(x); |
| 1366 SkScalar scalarY = SkIntToScalar(y); | 1364 SkScalar scalarY = SkIntToScalar(y); |
| 1367 for (const RectWithData& l : pdfDevice->fLinkToURLs) { | 1365 for (const RectWithData& l : pdfDevice->fLinkToURLs) { |
| 1368 SkRect r = l.rect.makeOffset(scalarX, scalarY); | 1366 SkRect r = l.rect.makeOffset(scalarX, scalarY); |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2257 } | 2255 } |
| 2258 | 2256 |
| 2259 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { | 2257 sk_sp<SkSpecialImage> SkPDFDevice::makeSpecial(const SkImage* image) { |
| 2260 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), | 2258 return SkSpecialImage::MakeFromImage(SkIRect::MakeWH(image->width(), image->
height()), |
| 2261 image->makeNonTextureImage()); | 2259 image->makeNonTextureImage()); |
| 2262 } | 2260 } |
| 2263 | 2261 |
| 2264 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { | 2262 sk_sp<SkSpecialImage> SkPDFDevice::snapSpecial() { |
| 2265 return nullptr; | 2263 return nullptr; |
| 2266 } | 2264 } |
| OLD | NEW |