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

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

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkArithmeticMode.cpp ('k') | src/effects/SkBitmapSource.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 2006 The Android Open Source Project 2 * Copyright 2006 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 "SkAvoidXfermode.h" 8 #include "SkAvoidXfermode.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 SkAvoidXfermode::SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode) { 14 SkAvoidXfermode::SkAvoidXfermode(SkColor opColor, U8CPU tolerance, Mode mode) {
15 if (tolerance > 255) { 15 if (tolerance > 255) {
16 tolerance = 255; 16 tolerance = 255;
17 } 17 }
18 fTolerance = SkToU8(tolerance); 18 fTolerance = SkToU8(tolerance);
19 fOpColor = opColor; 19 fOpColor = opColor;
20 fDistMul = (256 << 14) / (tolerance + 1); 20 fDistMul = (256 << 14) / (tolerance + 1);
21 fMode = mode; 21 fMode = mode;
22 } 22 }
23 23
24 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
25 SkAvoidXfermode::SkAvoidXfermode(SkReadBuffer& buffer) : INHERITED(buffer) {
26 fOpColor = buffer.readColor();
27 fDistMul = buffer.readUInt();
28 fMode = (Mode)buffer.readUInt();
29 }
30 #endif
31
24 SkFlattenable* SkAvoidXfermode::CreateProc(SkReadBuffer& buffer) { 32 SkFlattenable* SkAvoidXfermode::CreateProc(SkReadBuffer& buffer) {
25 const SkColor color = buffer.readColor(); 33 const SkColor color = buffer.readColor();
26 const unsigned tolerance = buffer.readUInt(); 34 const unsigned tolerance = buffer.readUInt();
27 const unsigned mode = buffer.readUInt(); 35 const unsigned mode = buffer.readUInt();
28 return Create(color, tolerance, (Mode)mode); 36 return Create(color, tolerance, (Mode)mode);
29 } 37 }
30 38
31 void SkAvoidXfermode::flatten(SkWriteBuffer& buffer) const { 39 void SkAvoidXfermode::flatten(SkWriteBuffer& buffer) const {
32 buffer.writeColor(fOpColor); 40 buffer.writeColor(fOpColor);
33 buffer.writeUInt(fTolerance); 41 buffer.writeUInt(fTolerance);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 void SkAvoidXfermode::toString(SkString* str) const { 177 void SkAvoidXfermode::toString(SkString* str) const {
170 str->append("SkAvoidXfermode: opColor: "); 178 str->append("SkAvoidXfermode: opColor: ");
171 str->appendHex(fOpColor); 179 str->appendHex(fOpColor);
172 str->appendf("distMul: %d ", fDistMul); 180 str->appendf("distMul: %d ", fDistMul);
173 181
174 static const char* gModeStrings[] = { "Avoid", "Target" }; 182 static const char* gModeStrings[] = { "Avoid", "Target" };
175 183
176 str->appendf("mode: %s", gModeStrings[fMode]); 184 str->appendf("mode: %s", gModeStrings[fMode]);
177 } 185 }
178 #endif 186 #endif
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkBitmapSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698