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

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

Issue 769953002: 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
32 SkFlattenable* SkAvoidXfermode::CreateProc(SkReadBuffer& buffer) { 24 SkFlattenable* SkAvoidXfermode::CreateProc(SkReadBuffer& buffer) {
33 const SkColor color = buffer.readColor(); 25 const SkColor color = buffer.readColor();
34 const unsigned tolerance = buffer.readUInt(); 26 const unsigned tolerance = buffer.readUInt();
35 const unsigned mode = buffer.readUInt(); 27 const unsigned mode = buffer.readUInt();
36 return Create(color, tolerance, (Mode)mode); 28 return Create(color, tolerance, (Mode)mode);
37 } 29 }
38 30
39 void SkAvoidXfermode::flatten(SkWriteBuffer& buffer) const { 31 void SkAvoidXfermode::flatten(SkWriteBuffer& buffer) const {
40 buffer.writeColor(fOpColor); 32 buffer.writeColor(fOpColor);
41 buffer.writeUInt(fTolerance); 33 buffer.writeUInt(fTolerance);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void SkAvoidXfermode::toString(SkString* str) const { 169 void SkAvoidXfermode::toString(SkString* str) const {
178 str->append("SkAvoidXfermode: opColor: "); 170 str->append("SkAvoidXfermode: opColor: ");
179 str->appendHex(fOpColor); 171 str->appendHex(fOpColor);
180 str->appendf("distMul: %d ", fDistMul); 172 str->appendf("distMul: %d ", fDistMul);
181 173
182 static const char* gModeStrings[] = { "Avoid", "Target" }; 174 static const char* gModeStrings[] = { "Avoid", "Target" };
183 175
184 str->appendf("mode: %s", gModeStrings[fMode]); 176 str->appendf("mode: %s", gModeStrings[fMode]);
185 } 177 }
186 #endif 178 #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