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

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

Issue 1852273002: Revert of Update SkXfermodeImageFilter to 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 | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.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"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkReadBuffer.h" 12 #include "SkReadBuffer.h"
13 #include "SkWriteBuffer.h" 13 #include "SkWriteBuffer.h"
14 #include "SkXfermode.h" 14 #include "SkXfermode.h"
15 #if SK_SUPPORT_GPU 15 #if SK_SUPPORT_GPU
16 #include "GrContext.h" 16 #include "GrContext.h"
17 #include "GrDrawContext.h" 17 #include "GrDrawContext.h"
18 #include "effects/GrConstColorProcessor.h" 18 #include "effects/GrConstColorProcessor.h"
19 #include "effects/GrTextureDomain.h" 19 #include "effects/GrTextureDomain.h"
20 #include "effects/GrSimpleTextureEffect.h" 20 #include "effects/GrSimpleTextureEffect.h"
21 #include "SkGr.h" 21 #include "SkGr.h"
22 #endif 22 #endif
23 23
24 /////////////////////////////////////////////////////////////////////////////// 24 ///////////////////////////////////////////////////////////////////////////////
25 25
26 sk_sp<SkImageFilter> SkXfermodeImageFilter::Make(sk_sp<SkXfermode> mode, 26 sk_sp<SkImageFilter> SkXfermodeImageFilter::Make(sk_sp<SkXfermode> mode, SkImage Filter* background,
27 sk_sp<SkImageFilter> background , 27 SkImageFilter* foreground,
28 sk_sp<SkImageFilter> foreground ,
29 const CropRect* cropRect) { 28 const CropRect* cropRect) {
30 sk_sp<SkImageFilter> inputs[2] = { std::move(background), std::move(foregrou nd) }; 29 SkImageFilter* inputs[2] = { background, foreground };
31 return sk_sp<SkImageFilter>(new SkXfermodeImageFilter(mode, inputs, cropRect )); 30 return sk_sp<SkImageFilter>(new SkXfermodeImageFilter(mode, inputs, cropRect ));
32 } 31 }
33 32
34 SkXfermodeImageFilter::SkXfermodeImageFilter(sk_sp<SkXfermode> mode, 33 SkXfermodeImageFilter::SkXfermodeImageFilter(sk_sp<SkXfermode> mode,
35 sk_sp<SkImageFilter> inputs[2], 34 SkImageFilter* inputs[2],
36 const CropRect* cropRect) 35 const CropRect* cropRect)
37 : INHERITED(inputs, 2, cropRect) 36 : INHERITED(2, inputs, cropRect)
38 , fMode(std::move(mode)) 37 , fMode(std::move(mode))
39 {} 38 {}
40 39
41 sk_sp<SkFlattenable> SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) { 40 sk_sp<SkFlattenable> SkXfermodeImageFilter::CreateProc(SkReadBuffer& buffer) {
42 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2); 41 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2);
43 sk_sp<SkXfermode> mode(buffer.readXfermode()); 42 sk_sp<SkXfermode> mode(buffer.readXfermode());
44 return Make(std::move(mode), common.getInput(0), common.getInput(1), 43 return Make(std::move(mode), common.getInput(0).get(), common.getInput(1).ge t(),
45 &common.cropRect()); 44 &common.cropRect());
46 } 45 }
47 46
48 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const { 47 void SkXfermodeImageFilter::flatten(SkWriteBuffer& buffer) const {
49 this->INHERITED::flatten(buffer); 48 this->INHERITED::flatten(buffer);
50 buffer.writeFlattenable(fMode.get()); 49 buffer.writeFlattenable(fMode.get());
51 } 50 }
52 51
53 bool SkXfermodeImageFilter::onFilterImageDeprecated(Proxy* proxy, 52 bool SkXfermodeImageFilter::onFilterImageDeprecated(Proxy* proxy,
54 const SkBitmap& src, 53 const SkBitmap& src,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ())); 240 matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top ()));
242 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds )); 241 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(bounds ));
243 242
244 offset->fX = bounds.left(); 243 offset->fX = bounds.left();
245 offset->fY = bounds.top(); 244 offset->fY = bounds.top();
246 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); 245 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);
247 return true; 246 return true;
248 } 247 }
249 248
250 #endif 249 #endif
OLDNEW
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698