| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkLatticeIter.h" | 8 #include "SkLatticeIter.h" |
| 9 #include "SkPDFCanvas.h" | 9 #include "SkPDFCanvas.h" |
| 10 #include "SkPDFDevice.h" | 10 #include "SkPDFDevice.h" |
| 11 | 11 |
| 12 SkPDFCanvas::SkPDFCanvas(const sk_sp<SkPDFDevice>& dev) | 12 SkPDFCanvas::SkPDFCanvas(const sk_sp<SkPDFDevice>& dev) |
| 13 : SkCanvas(dev.get()) {} | 13 : SkCanvas(dev.get()) {} |
| 14 | 14 |
| 15 SkPDFCanvas::~SkPDFCanvas() {} | 15 SkPDFCanvas::~SkPDFCanvas() {} |
| 16 | 16 |
| 17 /* | 17 /* |
| 18 * PDF's impl sometimes wants to access the raster clip as a SkRegion. To keep
this valid, | 18 * PDF's impl sometimes wants to access the raster clip as a SkRegion. To keep
this valid, |
| 19 * we intercept all clip calls to ensure that the clip stays BW (i.e. never ant
ialiased), since | 19 * we intercept all clip calls to ensure that the clip stays BW (i.e. never ant
ialiased), since |
| 20 * an antialiased clip won't build a SkRegion (it builds SkAAClip). | 20 * an antialiased clip won't build a SkRegion (it builds SkAAClip). |
| 21 */ | 21 */ |
| 22 void SkPDFCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle
edgeStyle) { | 22 void SkPDFCanvas::onClipRect(const SkRect& rect, ClipOp op, ClipEdgeStyle edgeSt
yle) { |
| 23 this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle); | 23 this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void SkPDFCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeSty
le edgeStyle) { | 26 void SkPDFCanvas::onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle edg
eStyle) { |
| 27 this->INHERITED::onClipRRect(rrect, op, kHard_ClipEdgeStyle); | 27 this->INHERITED::onClipRRect(rrect, op, kHard_ClipEdgeStyle); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SkPDFCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle
edgeStyle) { | 30 void SkPDFCanvas::onClipPath(const SkPath& path, ClipOp op, ClipEdgeStyle edgeSt
yle) { |
| 31 this->INHERITED::onClipPath(path, op, kHard_ClipEdgeStyle); | 31 this->INHERITED::onClipPath(path, op, kHard_ClipEdgeStyle); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void SkPDFCanvas::onDrawBitmapNine(const SkBitmap& bitmap, | 34 void SkPDFCanvas::onDrawBitmapNine(const SkBitmap& bitmap, |
| 35 const SkIRect& center, | 35 const SkIRect& center, |
| 36 const SkRect& dst, | 36 const SkRect& dst, |
| 37 const SkPaint* paint) { | 37 const SkPaint* paint) { |
| 38 SkLatticeIter iter(bitmap.width(), bitmap.height(), center, dst); | 38 SkLatticeIter iter(bitmap.width(), bitmap.height(), center, dst); |
| 39 SkRect srcR, dstR; | 39 SkRect srcR, dstR; |
| 40 while (iter.next(&srcR, &dstR)) { | 40 while (iter.next(&srcR, &dstR)) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const Lattice& lattice, | 100 const Lattice& lattice, |
| 101 const SkRect& dst, | 101 const SkRect& dst, |
| 102 const SkPaint* paint) { | 102 const SkPaint* paint) { |
| 103 SkLatticeIter iter(bitmap.width(), bitmap.height(), lattice, dst); | 103 SkLatticeIter iter(bitmap.width(), bitmap.height(), lattice, dst); |
| 104 SkRect srcR, dstR; | 104 SkRect srcR, dstR; |
| 105 while (iter.next(&srcR, &dstR)) { | 105 while (iter.next(&srcR, &dstR)) { |
| 106 this->drawBitmapRect(bitmap, srcR, dstR, paint); | 106 this->drawBitmapRect(bitmap, srcR, dstR, paint); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| OLD | NEW |