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

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

Issue 1647963002: Fix SkPixelXorXfermode serialization bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | 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 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(fOpColor); 24 wb.writeColor(SkColorSetRGB(SkGetPackedR32(fOpColor),
25 SkGetPackedG32(fOpColor),
26 SkGetPackedB32(fOpColor)));
25 } 27 }
26 28
27 SkFlattenable* SkPixelXorXfermode::CreateProc(SkReadBuffer& buffer) { 29 SkFlattenable* SkPixelXorXfermode::CreateProc(SkReadBuffer& buffer) {
28 return Create(buffer.readColor()); 30 return Create(buffer.readColor());
29 } 31 }
30 32
31 #ifndef SK_IGNORE_TO_STRING 33 #ifndef SK_IGNORE_TO_STRING
32 void SkPixelXorXfermode::toString(SkString* str) const { 34 void SkPixelXorXfermode::toString(SkString* str) const {
33 str->append("SkPixelXorXfermode: "); 35 str->append("SkPixelXorXfermode: ");
34 str->appendHex(fOpColor); 36 str->appendHex(fOpColor);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 381 }
380 382
381 bool SkPixelXorXfermode::asXPFactory(GrXPFactory** xpf) const { 383 bool SkPixelXorXfermode::asXPFactory(GrXPFactory** xpf) const {
382 if (xpf) { 384 if (xpf) {
383 *xpf = GrPixelXorXPFactory::Create(fOpColor); 385 *xpf = GrPixelXorXPFactory::Create(fOpColor);
384 } 386 }
385 return true; 387 return true;
386 } 388 }
387 389
388 #endif 390 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698