| 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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 if (srcIR.fLeft > 0) { | 901 if (srcIR.fLeft > 0) { |
| 902 dx = SkIntToScalar(srcIR.fLeft); | 902 dx = SkIntToScalar(srcIR.fLeft); |
| 903 } | 903 } |
| 904 if (srcIR.fTop > 0) { | 904 if (srcIR.fTop > 0) { |
| 905 dy = SkIntToScalar(srcIR.fTop); | 905 dy = SkIntToScalar(srcIR.fTop); |
| 906 } | 906 } |
| 907 if (dx || dy) { | 907 if (dx || dy) { |
| 908 matrix.preTranslate(dx, dy); | 908 matrix.preTranslate(dx, dy); |
| 909 } | 909 } |
| 910 } | 910 } |
| 911 this->drawBitmap(draw, *bitmapPtr, NULL, matrix, paint); | 911 this->drawBitmap(draw, *bitmapPtr, matrix, paint); |
| 912 } | 912 } |
| 913 | 913 |
| 914 void SkPDFDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, | 914 void SkPDFDevice::drawBitmap(const SkDraw& d, const SkBitmap& bitmap, |
| 915 const SkIRect* srcRect, const SkMatrix& matrix, | 915 const SkMatrix& matrix, const SkPaint& paint) { |
| 916 const SkPaint& paint) { | |
| 917 if (d.fClip->isEmpty()) { | 916 if (d.fClip->isEmpty()) { |
| 918 return; | 917 return; |
| 919 } | 918 } |
| 920 | 919 |
| 921 SkMatrix transform = matrix; | 920 SkMatrix transform = matrix; |
| 922 transform.postConcat(*d.fMatrix); | 921 transform.postConcat(*d.fMatrix); |
| 923 internalDrawBitmap(transform, d.fClipStack, *d.fClip, bitmap, srcRect, | 922 this->internalDrawBitmap(transform, d.fClipStack, *d.fClip, bitmap, NULL, pa
int); |
| 924 paint); | |
| 925 } | 923 } |
| 926 | 924 |
| 927 void SkPDFDevice::drawSprite(const SkDraw& d, const SkBitmap& bitmap, | 925 void SkPDFDevice::drawSprite(const SkDraw& d, const SkBitmap& bitmap, |
| 928 int x, int y, const SkPaint& paint) { | 926 int x, int y, const SkPaint& paint) { |
| 929 if (d.fClip->isEmpty()) { | 927 if (d.fClip->isEmpty()) { |
| 930 return; | 928 return; |
| 931 } | 929 } |
| 932 | 930 |
| 933 SkMatrix matrix; | 931 SkMatrix matrix; |
| 934 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y)); | 932 matrix.setTranslate(SkIntToScalar(x), SkIntToScalar(y)); |
| 935 internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, NULL, paint); | 933 this->internalDrawBitmap(matrix, d.fClipStack, *d.fClip, bitmap, NULL, paint
); |
| 936 } | 934 } |
| 937 | 935 |
| 938 void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len, | 936 void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len, |
| 939 SkScalar x, SkScalar y, const SkPaint& paint) { | 937 SkScalar x, SkScalar y, const SkPaint& paint) { |
| 940 NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false); | 938 NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false); |
| 941 if (paint.getMaskFilter() != NULL) { | 939 if (paint.getMaskFilter() != NULL) { |
| 942 // Don't pretend we support drawing MaskFilters, it makes for artifacts | 940 // Don't pretend we support drawing MaskFilters, it makes for artifacts |
| 943 // making text unreadable (e.g. same text twice when using CSS shadows). | 941 // making text unreadable (e.g. same text twice when using CSS shadows). |
| 944 return; | 942 return; |
| 945 } | 943 } |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 } | 1751 } |
| 1754 | 1752 |
| 1755 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, | 1753 bool SkPDFDevice::onReadPixels(const SkBitmap& bitmap, int x, int y, |
| 1756 SkCanvas::Config8888) { | 1754 SkCanvas::Config8888) { |
| 1757 return false; | 1755 return false; |
| 1758 } | 1756 } |
| 1759 | 1757 |
| 1760 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { | 1758 bool SkPDFDevice::allowImageFilter(SkImageFilter*) { |
| 1761 return false; | 1759 return false; |
| 1762 } | 1760 } |
| OLD | NEW |