| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkOffsetImageFilter.h" | 8 #include "SkOffsetImageFilter.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| 11 #include "SkMatrix.h" | 11 #include "SkMatrix.h" |
| 12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
| 13 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
| 14 #include "SkSpecialImage.h" | 14 #include "SkSpecialImage.h" |
| 15 #include "SkSpecialSurface.h" | 15 #include "SkSpecialSurface.h" |
| 16 #include "SkWriteBuffer.h" | 16 #include "SkWriteBuffer.h" |
| 17 | 17 |
| 18 sk_sp<SkImageFilter> SkOffsetImageFilter::Make(SkScalar dx, SkScalar dy, |
| 19 sk_sp<SkImageFilter> input, |
| 20 const CropRect* cropRect) { |
| 21 if (!SkScalarIsFinite(dx) || !SkScalarIsFinite(dy)) { |
| 22 return nullptr; |
| 23 } |
| 24 |
| 25 return sk_sp<SkImageFilter>(new SkOffsetImageFilter(dx, dy, std::move(input)
, cropRect)); |
| 26 } |
| 27 |
| 18 sk_sp<SkSpecialImage> SkOffsetImageFilter::onFilterImage(SkSpecialImage* source, | 28 sk_sp<SkSpecialImage> SkOffsetImageFilter::onFilterImage(SkSpecialImage* source, |
| 19 const Context& ctx, | 29 const Context& ctx, |
| 20 SkIPoint* offset) const
{ | 30 SkIPoint* offset) const
{ |
| 21 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 31 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
| 22 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &srcOffset)); | 32 sk_sp<SkSpecialImage> input(this->filterInput(0, source, ctx, &srcOffset)); |
| 23 if (!input) { | 33 if (!input) { |
| 24 return nullptr; | 34 return nullptr; |
| 25 } | 35 } |
| 26 | 36 |
| 27 SkVector vec; | 37 SkVector vec; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 void SkOffsetImageFilter::toString(SkString* str) const { | 115 void SkOffsetImageFilter::toString(SkString* str) const { |
| 106 str->appendf("SkOffsetImageFilter: ("); | 116 str->appendf("SkOffsetImageFilter: ("); |
| 107 str->appendf("offset: (%f, %f) ", fOffset.fX, fOffset.fY); | 117 str->appendf("offset: (%f, %f) ", fOffset.fX, fOffset.fY); |
| 108 str->append("input: ("); | 118 str->append("input: ("); |
| 109 if (this->getInput(0)) { | 119 if (this->getInput(0)) { |
| 110 this->getInput(0)->toString(str); | 120 this->getInput(0)->toString(str); |
| 111 } | 121 } |
| 112 str->append("))"); | 122 str->append("))"); |
| 113 } | 123 } |
| 114 #endif | 124 #endif |
| OLD | NEW |