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 14 matching lines...) Expand all Loading... |
25 const CropRect* cropRect, | 25 const CropRect* cropRect, |
26 uint32_t uniqueID) | 26 uint32_t uniqueID) |
27 : INHERITED(2, inputs, cropRect, uniqueID), fMode(mode) { | 27 : INHERITED(2, inputs, cropRect, uniqueID), 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 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
36 SkXfermodeImageFilter::SkXfermodeImageFilter(SkReadBuffer& buffer) | |
37 : INHERITED(2, buffer) { | |
38 fMode = buffer.readXfermode(); | |
39 } | |
40 #endif | |
41 | |
42 SkFlattenable* SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) { | 35 SkFlattenable* SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) { |
43 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); | 36 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); |
44 SkAutoTUnref<SkXfermode> mode(buffer.readXfermode()); | 37 SkAutoTUnref<SkXfermode> mode(buffer.readXfermode()); |
45 return Create(mode, common.getInput(0), common.getInput(1), &common.cropRect
(), common.uniqueID()); | 38 return Create(mode, common.getInput(0), common.getInput(1), &common.cropRect
(), common.uniqueID()); |
46 } | 39 } |
47 | 40 |
48 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const { | 41 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const { |
49 this->INHERITED::flatten(buffer); | 42 this->INHERITED::flatten(buffer); |
50 buffer.writeFlattenable(fMode); | 43 buffer.writeFlattenable(fMode); |
51 } | 44 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 paint.addColorProcessor(xferProcessor)->unref(); | 158 paint.addColorProcessor(xferProcessor)->unref(); |
166 context->drawRect(paint, srcRect); | 159 context->drawRect(paint, srcRect); |
167 | 160 |
168 offset->fX = backgroundOffset.fX; | 161 offset->fX = backgroundOffset.fX; |
169 offset->fY = backgroundOffset.fY; | 162 offset->fY = backgroundOffset.fY; |
170 WrapTexture(dst, src.width(), src.height(), result); | 163 WrapTexture(dst, src.width(), src.height(), result); |
171 return true; | 164 return true; |
172 } | 165 } |
173 | 166 |
174 #endif | 167 #endif |
OLD | NEW |