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 "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 | 1350 |
1351 SkMatrix matrix; | 1351 SkMatrix matrix; |
1352 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y)); | 1352 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y)); |
1353 ScopedContentEntry content(this, d.fClipStack, *d.fClip, matrix, paint); | 1353 ScopedContentEntry content(this, d.fClipStack, *d.fClip, matrix, paint); |
1354 if (!content.entry()) { | 1354 if (!content.entry()) { |
1355 return; | 1355 return; |
1356 } | 1356 } |
1357 if (content.needShape()) { | 1357 if (content.needShape()) { |
1358 SkPath shape; | 1358 SkPath shape; |
1359 shape.addRect(SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y), | 1359 shape.addRect(SkRect::MakeXYWH(SkIntToScalar(x), SkIntToScalar(y), |
1360 device->width(), device->height())); | 1360 SkIntToScalar(device->width()), |
| 1361 SkIntToScalar(device->height()))); |
1361 content.setShape(shape); | 1362 content.setShape(shape); |
1362 } | 1363 } |
1363 if (!content.needSource()) { | 1364 if (!content.needSource()) { |
1364 return; | 1365 return; |
1365 } | 1366 } |
1366 | 1367 |
1367 SkAutoTUnref<SkPDFFormXObject> xObject(new SkPDFFormXObject(pdfDevice)); | 1368 SkAutoTUnref<SkPDFFormXObject> xObject(new SkPDFFormXObject(pdfDevice)); |
1368 SkPDFUtils::DrawFormXObject(this->addXObjectResource(xObject.get()), | 1369 SkPDFUtils::DrawFormXObject(this->addXObjectResource(xObject.get()), |
1369 &content.entry()->fContent); | 1370 &content.entry()->fContent); |
1370 | 1371 |
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 SkIRect subset = SkIRect::MakeWH(bitmap->width(), bitmap->height()); | 2240 SkIRect subset = SkIRect::MakeWH(bitmap->width(), bitmap->height()); |
2240 scaled.postScale(SkIntToScalar(subset.width()), | 2241 scaled.postScale(SkIntToScalar(subset.width()), |
2241 SkIntToScalar(subset.height())); | 2242 SkIntToScalar(subset.height())); |
2242 scaled.postConcat(matrix); | 2243 scaled.postConcat(matrix); |
2243 ScopedContentEntry content(this, clipStack, *clipRegion, scaled, paint); | 2244 ScopedContentEntry content(this, clipStack, *clipRegion, scaled, paint); |
2244 if (!content.entry() || (srcRect && !subset.intersect(*srcRect))) { | 2245 if (!content.entry() || (srcRect && !subset.intersect(*srcRect))) { |
2245 return; | 2246 return; |
2246 } | 2247 } |
2247 if (content.needShape()) { | 2248 if (content.needShape()) { |
2248 SkPath shape; | 2249 SkPath shape; |
2249 shape.addRect(SkRect::MakeWH(subset.width(), subset.height())); | 2250 shape.addRect(SkRect::MakeWH(SkIntToScalar(subset.width()), |
| 2251 SkIntToScalar( subset.height()))); |
2250 shape.transform(matrix); | 2252 shape.transform(matrix); |
2251 content.setShape(shape); | 2253 content.setShape(shape); |
2252 } | 2254 } |
2253 if (!content.needSource()) { | 2255 if (!content.needSource()) { |
2254 return; | 2256 return; |
2255 } | 2257 } |
2256 | 2258 |
2257 SkAutoTUnref<SkPDFImage> image( | 2259 SkAutoTUnref<SkPDFImage> image( |
2258 SkPDFImage::CreateImage(*bitmap, subset, fEncoder)); | 2260 SkPDFImage::CreateImage(*bitmap, subset, fEncoder)); |
2259 if (!image) { | 2261 if (!image) { |
2260 return; | 2262 return; |
2261 } | 2263 } |
2262 | 2264 |
2263 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2265 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
2264 &content.entry()->fContent); | 2266 &content.entry()->fContent); |
2265 } | 2267 } |
2266 | 2268 |
2267 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, | 2269 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, |
2268 SkCanvas::Config8888) { | 2270 SkCanvas::Config8888) { |
2269 return false; | 2271 return false; |
2270 } | 2272 } |
2271 | 2273 |
2272 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { | 2274 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { |
2273 return false; | 2275 return false; |
2274 } | 2276 } |
OLD | NEW |