Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Rik Cabanier (cabanier@adobe.com) | 3 * Copyright (C) 2012 Rik Cabanier (cabanier@adobe.com) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 "destination-over", | 42 "destination-over", |
| 43 "destination-in", | 43 "destination-in", |
| 44 "destination-out", | 44 "destination-out", |
| 45 "destination-atop", | 45 "destination-atop", |
| 46 "xor", | 46 "xor", |
| 47 "darker", | 47 "darker", |
| 48 "lighter" | 48 "lighter" |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 static const char* const blendOperatorNames[] = { | 51 static const char* const blendOperatorNames[] = { |
| 52 "normal", | |
| 52 "multiply", | 53 "multiply", |
| 53 "screen", | 54 "screen", |
| 54 "overlay", | 55 "overlay", |
| 55 "darken", | 56 "darken", |
| 56 "lighten", | 57 "lighten", |
| 57 "color-dodge", | 58 "color-dodge", |
| 58 "color-burn", | 59 "color-burn", |
| 59 "hard-light", | 60 "hard-light", |
| 60 "soft-light", | 61 "soft-light", |
| 61 "difference", | 62 "difference", |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 73 for (int i = 0; i < numCompositeOperatorNames; i++) { | 74 for (int i = 0; i < numCompositeOperatorNames; i++) { |
| 74 if (s == compositeOperatorNames[i]) { | 75 if (s == compositeOperatorNames[i]) { |
| 75 op = static_cast<CompositeOperator>(i); | 76 op = static_cast<CompositeOperator>(i); |
| 76 blendOp = WebBlendModeNormal; | 77 blendOp = WebBlendModeNormal; |
| 77 return true; | 78 return true; |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 for (int i = 0; i < numBlendOperatorNames; i++) { | 82 for (int i = 0; i < numBlendOperatorNames; i++) { |
| 82 if (s == blendOperatorNames[i]) { | 83 if (s == blendOperatorNames[i]) { |
| 83 blendOp = static_cast<WebBlendMode>(i+1); | 84 blendOp = static_cast<WebBlendMode>(i); |
| 84 // For now, blending will always assume source-over. This will be fi xed in the future | 85 // For now, blending will always assume source-over. This will be fi xed in the future |
| 85 op = CompositeSourceOver; | 86 op = CompositeSourceOver; |
| 86 return true; | 87 return true; |
| 87 } | 88 } |
| 88 } | 89 } |
| 89 | 90 |
| 90 return false; | 91 return false; |
| 91 } | 92 } |
| 92 | 93 |
| 93 // FIXME: when we support blend modes in combination with compositing other than source-over | 94 // FIXME: when we support blend modes in combination with compositing other than source-over |
| 94 // this routine needs to be updated. | 95 // this routine needs to be updated. |
| 95 String compositeOperatorName(CompositeOperator op, WebBlendMode blendOp) | 96 String compositeOperatorName(CompositeOperator op, WebBlendMode blendOp) |
| 96 { | 97 { |
| 97 ASSERT(op >= 0); | 98 ASSERT(op >= 0); |
| 98 ASSERT(op < numCompositeOperatorNames); | 99 ASSERT(op < numCompositeOperatorNames); |
| 99 ASSERT(blendOp >= 0); | 100 ASSERT(blendOp >= 0); |
| 100 ASSERT(blendOp <= numBlendOperatorNames); | 101 ASSERT(blendOp <= numBlendOperatorNames); |
|
Justin Novosad
2014/10/22 15:22:38
This assert is now a tautology. You can remove it
| |
| 101 if (blendOp != WebBlendModeNormal) | 102 if (blendOp != WebBlendModeNormal) |
| 102 return blendOperatorNames[blendOp-1]; | 103 return blendOperatorNames[blendOp-1]; |
|
Justin Novosad
2014/10/22 15:22:38
I think you would need to remove the '-1' here.
| |
| 103 return compositeOperatorNames[op]; | 104 return compositeOperatorNames[op]; |
| 104 } | 105 } |
| 105 | 106 |
| 106 bool parseLineCap(const String& s, LineCap& cap) | 107 bool parseLineCap(const String& s, LineCap& cap) |
| 107 { | 108 { |
| 108 if (s == "butt") { | 109 if (s == "butt") { |
| 109 cap = ButtCap; | 110 cap = ButtCap; |
| 110 return true; | 111 return true; |
| 111 } | 112 } |
| 112 if (s == "round") { | 113 if (s == "round") { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 return true; | 218 return true; |
| 218 } | 219 } |
| 219 if (s == "hanging") { | 220 if (s == "hanging") { |
| 220 baseline = HangingTextBaseline; | 221 baseline = HangingTextBaseline; |
| 221 return true; | 222 return true; |
| 222 } | 223 } |
| 223 return false; | 224 return false; |
| 224 } | 225 } |
| 225 | 226 |
| 226 } // namespace blink | 227 } // namespace blink |
| OLD | NEW |