Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 return sk_sp<SkImageFilter>(new SkXfermodeImageFilter(mode, inputs, cropRect )); 30 return sk_sp<SkImageFilter>(new SkXfermodeImageFilter(mode, inputs, cropRect ));
31 } 31 }
32 32
33 SkXfermodeImageFilter::SkXfermodeImageFilter(sk_sp<SkXfermode> mode, 33 SkXfermodeImageFilter::SkXfermodeImageFilter(sk_sp<SkXfermode> mode,
34 SkImageFilter* inputs[2], 34 SkImageFilter* inputs[2],
35 const CropRect* cropRect) 35 const CropRect* cropRect)
36 : INHERITED(2, inputs, cropRect) 36 : INHERITED(2, inputs, cropRect)
37 , fMode(std::move(mode)) 37 , fMode(std::move(mode))
38 {} 38 {}
39 39
40 SkFlattenable* SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) { 40 sk_sp<SkFlattenable> SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) {
41 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); 41 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2);
42 sk_sp<SkXfermode> mode(buffer.readXfermode()); 42 sk_sp<SkXfermode> mode(buffer.readXfermode());
43 return Make(std::move(mode), common.getInput(0).get(), 43 return Make(std::move(mode), common.getInput(0).get(), common.getInput(1).ge t(),
44 common.getInput(1).get(), &common.cropRect()).release(); 44 &common.cropRect());
45 } 45 }
46 46
47 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const { 47 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const {
48 this->INHERITED::flatten(buffer); 48 this->INHERITED::flatten(buffer);
49 buffer.writeFlattenable(fMode.get()); 49 buffer.writeFlattenable(fMode.get());
50 } 50 }
51 51
52 bool SkXfermodeImageFilter::onFilterImageDeprecated(Proxy* proxy, 52 bool SkXfermodeImageFilter::onFilterImageDeprecated(Proxy* proxy,
53 const SkBitmap& src, 53 const SkBitmap& src,
54 const Context& ctx, 54 const Context& ctx,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); 240 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ()));
241 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds )); 241 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds ));
242 242
243 offset->fX = bounds.left(); 243 offset->fX = bounds.left();
244 offset->fY = bounds.top(); 244 offset->fY = bounds.top();
245 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); 245 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);
246 return true; 246 return true;
247 } 247 }
248 248
249 #endif 249 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698