OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The Android Open Source Project | 2 * Copyright 2013 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 "SkXfermodeImageFilter.h" | 8 #include "SkXfermodeImageFilter.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 sk_sp<SkFlattenable> SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) { | 43 sk_sp<SkFlattenable> SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) { |
44 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); | 44 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); |
45 sk_sp<SkXfermode> mode(buffer.readXfermode()); | 45 sk_sp<SkXfermode> mode(buffer.readXfermode()); |
46 return Make(std::move(mode), common.getInput(0), common.getInput(1), &common
.cropRect()); | 46 return Make(std::move(mode), common.getInput(0), common.getInput(1), &common
.cropRect()); |
47 } | 47 } |
48 | 48 |
49 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const { | 49 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const { |
50 this->INHERITED::flatten(buffer); | 50 this->INHERITED::flatten(buffer); |
51 buffer.writeFlattenable(fMode.get()); | 51 buffer.writeFlattenable("fMode", fMode.get()); |
52 } | 52 } |
53 | 53 |
54 sk_sp<SkSpecialImage> SkXfermodeImageFilter::onFilterImage(SkSpecialImage* sourc
e, | 54 sk_sp<SkSpecialImage> SkXfermodeImageFilter::onFilterImage(SkSpecialImage* sourc
e, |
55 const Context& ctx, | 55 const Context& ctx, |
56 SkIPoint* offset) con
st { | 56 SkIPoint* offset) con
st { |
57 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); | 57 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); |
58 sk_sp<SkSpecialImage> background(this->filterInput(0, source, ctx, &backgrou
ndOffset)); | 58 sk_sp<SkSpecialImage> background(this->filterInput(0, source, ctx, &backgrou
ndOffset)); |
59 | 59 |
60 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); | 60 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); |
61 sk_sp<SkSpecialImage> foreground(this->filterInput(1, source, ctx, &foregrou
ndOffset)); | 61 sk_sp<SkSpecialImage> foreground(this->filterInput(1, source, ctx, &foregrou
ndOffset)); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 SkMatrix matrix; | 256 SkMatrix matrix; |
257 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); | 257 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top
())); |
258 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); | 258 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds
)); |
259 | 259 |
260 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), | 260 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.he
ight()), |
261 kNeedNewImageUniqueID_SpecialImage, | 261 kNeedNewImageUniqueID_SpecialImage, |
262 dst.get()); | 262 dst.get()); |
263 } | 263 } |
264 | 264 |
265 #endif | 265 #endif |
OLD | NEW |