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

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

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: original write flags were fine Created 6 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPixelXorXfermode.h" 10 #include "SkPixelXorXfermode.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkFlattenableBuffers.h" 12 #include "SkReadBuffer.h"
13 #include "SkWriteBuffer.h"
13 #include "SkString.h" 14 #include "SkString.h"
14 15
15 // we always return an opaque color, 'cause I don't know what to do with 16 // we always return an opaque color, 'cause I don't know what to do with
16 // the alpha-component and still return a valid premultiplied color. 17 // the alpha-component and still return a valid premultiplied color.
17 SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) const { 18 SkPMColor SkPixelXorXfermode::xferColor(SkPMColor src, SkPMColor dst) const {
18 SkPMColor res = src ^ dst ^ fOpColor; 19 SkPMColor res = src ^ dst ^ fOpColor;
19 res |= (SK_A32_MASK << SK_A32_SHIFT); // force it to be opaque 20 res |= (SK_A32_MASK << SK_A32_SHIFT); // force it to be opaque
20 return res; 21 return res;
21 } 22 }
22 23
23 void SkPixelXorXfermode::flatten(SkFlattenableWriteBuffer& wb) const { 24 void SkPixelXorXfermode::flatten(SkWriteBuffer& wb) const {
24 this->INHERITED::flatten(wb); 25 this->INHERITED::flatten(wb);
25 wb.writeColor(fOpColor); 26 wb.writeColor(fOpColor);
26 } 27 }
27 28
28 SkPixelXorXfermode::SkPixelXorXfermode(SkFlattenableReadBuffer& rb) 29 SkPixelXorXfermode::SkPixelXorXfermode(SkReadBuffer& rb)
29 : INHERITED(rb) { 30 : INHERITED(rb) {
30 fOpColor = rb.readColor(); 31 fOpColor = rb.readColor();
31 } 32 }
32 33
33 #ifdef SK_DEVELOPER 34 #ifdef SK_DEVELOPER
34 void SkPixelXorXfermode::toString(SkString* str) const { 35 void SkPixelXorXfermode::toString(SkString* str) const {
35 str->append("SkPixelXorXfermode: "); 36 str->append("SkPixelXorXfermode: ");
36 str->appendHex(fOpColor); 37 str->appendHex(fOpColor);
37 } 38 }
38 #endif 39 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698