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

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

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkPixelXorXfermode.h" 8 #include "SkPixelXorXfermode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
11 #include "SkWriteBuffer.h" 11 #include "SkWriteBuffer.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 13
14 // we always return an opaque color, 'cause I don't know what to do with 14 // we always return an opaque color, 'cause I don't know what to do with
15 // the alpha-component and still return a valid premultiplied color. 15 // the alpha-component and still return a valid premultiplied color.
16 SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) const { 16 SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) const {
17 SkPMColor res = src ^ dst ^ fOpColor; 17 SkPMColor res = src ^ dst ^ fOpColor;
18 18
19 res |= (SK_A32_MASK << SK_A32_SHIFT); // force it to be opaque 19 res |= (SK_A32_MASK << SK_A32_SHIFT); // force it to be opaque
20 return res; 20 return res;
21 } 21 }
22 22
23 void SkPixelXorXfermode::flatten(SkWriteBuffer& wb) const { 23 void SkPixelXorXfermode::flatten(SkWriteBuffer& wb) const {
24 wb.writeColor(SkColorSetRGB(SkGetPackedR32(fOpColor), 24 wb.writeColor(SkColorSetRGB(SkGetPackedR32(fOpColor),
25 SkGetPackedG32(fOpColor), 25 SkGetPackedG32(fOpColor),
26 SkGetPackedB32(fOpColor))); 26 SkGetPackedB32(fOpColor)));
27 } 27 }
28 28
29 SkFlattenable* SkPixelXorXfermode::CreateProc(SkReadBuffer& buffer) { 29 SkFlattenable* SkPixelXorXfermode::CreateProc(SkReadBuffer& buffer) {
30 return Create(buffer.readColor()); 30 return Make(buffer.readColor()).release();
31 } 31 }
32 32
33 #ifndef SK_IGNORE_TO_STRING 33 #ifndef SK_IGNORE_TO_STRING
34 void SkPixelXorXfermode::toString(SkString* str) const { 34 void SkPixelXorXfermode::toString(SkString* str) const {
35 str->append("SkPixelXorXfermode: "); 35 str->append("SkPixelXorXfermode: ");
36 str->appendHex(fOpColor); 36 str->appendHex(fOpColor);
37 } 37 }
38 #endif 38 #endif
39 39
40 #if SK_SUPPORT_GPU 40 #if SK_SUPPORT_GPU
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 const GrFragmentProcessor* SkPixelXorXfermode::getFragmentProcessorForImageFilte r( 371 const GrFragmentProcessor* SkPixelXorXfermode::getFragmentProcessorForImageFilte r(
372 const GrFragmentProcesso r* dst) const { 372 const GrFragmentProcesso r* dst) const {
373 return PixelXorFP::Create(fOpColor, dst); 373 return PixelXorFP::Create(fOpColor, dst);
374 } 374 }
375 375
376 GrXPFactory* SkPixelXorXfermode::asXPFactory() const { 376 GrXPFactory* SkPixelXorXfermode::asXPFactory() const {
377 return GrPixelXorXPFactory::Create(fOpColor); 377 return GrPixelXorXPFactory::Create(fOpColor);
378 } 378 }
379 379
380 #endif 380 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698