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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 : INHERITED(background, foreground, cropRect), fMode(mode) { | 27 : INHERITED(background, foreground, cropRect), fMode(mode) { |
28 SkSafeRef(fMode); | 28 SkSafeRef(fMode); |
29 } | 29 } |
30 | 30 |
31 SkXfermodeImageFilter::~SkXfermodeImageFilter() { | 31 SkXfermodeImageFilter::~SkXfermodeImageFilter() { |
32 SkSafeUnref(fMode); | 32 SkSafeUnref(fMode); |
33 } | 33 } |
34 | 34 |
35 SkXfermodeImageFilter::SkXfermodeImageFilter(SkFlattenableReadBuffer& buffer) | 35 SkXfermodeImageFilter::SkXfermodeImageFilter(SkFlattenableReadBuffer& buffer) |
36 : INHERITED(buffer) { | 36 : INHERITED(buffer) { |
37 fMode = buffer.readFlattenableT<SkXfermode>(); | 37 fMode = buffer.readXfermode(); |
38 } | 38 } |
39 | 39 |
40 void SkXfermodeImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { | 40 void SkXfermodeImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
41 this->INHERITED::flatten(buffer); | 41 this->INHERITED::flatten(buffer); |
42 buffer.writeFlattenable(fMode); | 42 buffer.writeFlattenable(fMode); |
43 } | 43 } |
44 | 44 |
45 bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy, | 45 bool SkXfermodeImageFilter::onFilterImage(Proxy* proxy, |
46 const SkBitmap& src, | 46 const SkBitmap& src, |
47 const SkMatrix& ctm, | 47 const SkMatrix& ctm, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); | 149 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen
d(dm)); |
150 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); | 150 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); |
151 context->drawRect(foregroundPaint, srcRect); | 151 context->drawRect(foregroundPaint, srcRect); |
152 } | 152 } |
153 offset->fX += backgroundOffset.fX; | 153 offset->fX += backgroundOffset.fX; |
154 offset->fY += backgroundOffset.fY; | 154 offset->fY += backgroundOffset.fY; |
155 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); | 155 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul
t); |
156 } | 156 } |
157 | 157 |
158 #endif | 158 #endif |
OLD | NEW |