Changeset 170433 in webkit
- Timestamp:
- Jun 25, 2014 12:03:47 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r170429 r170433 1 2014-06-25 Dirk Schulze <krit@webkit.org> 2 3 Add all blend modes to feBlend 4 5 feBlend should support all blend modes from CSS and Canvas 6 https://bugs.webkit.org/show_bug.cgi?id=134296 7 8 Added tests for new blend modes in feBlend as well as a test for 'normal' blend mode 9 on HTML Canvas. 10 11 Reviewed by Dean Jackson. 12 13 * fast/canvas/canvas-blend-image-expected.txt: 14 * fast/canvas/canvas-blend-solid-expected.txt: 15 * fast/canvas/script-tests/canvas-blend-image.js: Test 'normal' blend mode in Canvas. 16 (prepareTestScenario): 17 * fast/canvas/script-tests/canvas-blend-solid.js: Ditto. 18 (prepareTestScenario): 19 * platform/mac/svg/W3C-SVG-1.1/filters-blend-01-b-expected.png: 20 * platform/mac/svg/W3C-SVG-1.1/filters-blend-01-b-expected.txt: DRT output is lowercase now. 21 * platform/mac/svg/filters/feBlend-all-blendmodes-expected.png: Added. 22 * platform/mac/svg/filters/feBlend-all-blendmodes-expected.txt: Added. 23 * svg/filters/feBlend-all-blendmodes.svg: Added. Tests all blend modes now supported by feBlend. 24 * svg/filters/feBlend-invalid-mode.xhtml: Add an upper bound check as well. 25 1 26 2014-06-25 Chris Fleizach <cfleizach@apple.com> 2 27 -
trunk/LayoutTests/css3/filters/effect-reference-expected.txt
r149088 r170433 23 23 [SourceGraphic] 24 24 RenderSVGResourceFilter {filter} [id="blend"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 25 [feBlend mode=" SCREEN"]25 [feBlend mode="screen"] 26 26 [feGaussianBlur stdDeviation="5.00, 5.00"] 27 27 [SourceGraphic] 28 28 [SourceGraphic] 29 29 RenderSVGResourceFilter {filter} [id="lighting"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 30 [feBlend mode=" MULTIPLY"]30 [feBlend mode="multiply"] 31 31 [feColorMatrix type="MATRIX" values="0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00"] 32 32 [feSpecularLighting surfaceScale="1.00" specualConstant="1.00" specularExponent="1.00"] -
trunk/LayoutTests/css3/filters/effect-reference-hw-expected.txt
r149088 r170433 23 23 [SourceGraphic] 24 24 RenderSVGResourceFilter {filter} [id="blend"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 25 [feBlend mode=" SCREEN"]25 [feBlend mode="screen"] 26 26 [feGaussianBlur stdDeviation="5.00, 5.00"] 27 27 [SourceGraphic] 28 28 [SourceGraphic] 29 29 RenderSVGResourceFilter {filter} [id="lighting"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 30 [feBlend mode=" MULTIPLY"]30 [feBlend mode="multiply"] 31 31 [feColorMatrix type="MATRIX" values="0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00"] 32 32 [feSpecularLighting surfaceScale="1.00" specualConstant="1.00" specularExponent="1.00"] -
trunk/LayoutTests/fast/canvas/canvas-blend-image-expected.txt
r138334 r170433 74 74 PASS pixelDataAtPoint(3)[3] is within 5 of 191 75 75 76 Testing blend mode "normal" 77 solid on solid 78 PASS pixelDataAtPoint(0)[0] is within 5 of 255 79 PASS pixelDataAtPoint(0)[1] is within 5 of 0 80 PASS pixelDataAtPoint(0)[2] is within 5 of 0 81 PASS pixelDataAtPoint(0)[3] is within 5 of 255 82 PASS pixelDataAtPoint(1)[0] is within 5 of 255 83 PASS pixelDataAtPoint(1)[1] is within 5 of 255 84 PASS pixelDataAtPoint(1)[2] is within 5 of 0 85 PASS pixelDataAtPoint(1)[3] is within 5 of 255 86 PASS pixelDataAtPoint(2)[0] is within 5 of 0 87 PASS pixelDataAtPoint(2)[1] is within 5 of 128 88 PASS pixelDataAtPoint(2)[2] is within 5 of 0 89 PASS pixelDataAtPoint(2)[3] is within 5 of 255 90 PASS pixelDataAtPoint(3)[0] is within 5 of 0 91 PASS pixelDataAtPoint(3)[1] is within 5 of 0 92 PASS pixelDataAtPoint(3)[2] is within 5 of 255 93 PASS pixelDataAtPoint(3)[3] is within 5 of 255 94 solid on alpha 95 PASS pixelDataAtPoint(0)[0] is within 5 of 128 96 PASS pixelDataAtPoint(0)[1] is within 5 of 0 97 PASS pixelDataAtPoint(0)[2] is within 5 of 127 98 PASS pixelDataAtPoint(0)[3] is within 5 of 255 99 PASS pixelDataAtPoint(1)[0] is within 5 of 128 100 PASS pixelDataAtPoint(1)[1] is within 5 of 128 101 PASS pixelDataAtPoint(1)[2] is within 5 of 127 102 PASS pixelDataAtPoint(1)[3] is within 5 of 255 103 PASS pixelDataAtPoint(2)[0] is within 5 of 0 104 PASS pixelDataAtPoint(2)[1] is within 5 of 64 105 PASS pixelDataAtPoint(2)[2] is within 5 of 127 106 PASS pixelDataAtPoint(2)[3] is within 5 of 255 107 PASS pixelDataAtPoint(3)[0] is within 5 of 0 108 PASS pixelDataAtPoint(3)[1] is within 5 of 0 109 PASS pixelDataAtPoint(3)[2] is within 5 of 255 110 PASS pixelDataAtPoint(3)[3] is within 5 of 255 111 alpha on solid 112 PASS pixelDataAtPoint(0)[0] is within 5 of 255 113 PASS pixelDataAtPoint(0)[1] is within 5 of 0 114 PASS pixelDataAtPoint(0)[2] is within 5 of 0 115 PASS pixelDataAtPoint(0)[3] is within 5 of 255 116 PASS pixelDataAtPoint(1)[0] is within 5 of 255 117 PASS pixelDataAtPoint(1)[1] is within 5 of 255 118 PASS pixelDataAtPoint(1)[2] is within 5 of 0 119 PASS pixelDataAtPoint(1)[3] is within 5 of 255 120 PASS pixelDataAtPoint(2)[0] is within 5 of 0 121 PASS pixelDataAtPoint(2)[1] is within 5 of 128 122 PASS pixelDataAtPoint(2)[2] is within 5 of 0 123 PASS pixelDataAtPoint(2)[3] is within 5 of 255 124 PASS pixelDataAtPoint(3)[0] is within 5 of 0 125 PASS pixelDataAtPoint(3)[1] is within 5 of 0 126 PASS pixelDataAtPoint(3)[2] is within 5 of 255 127 PASS pixelDataAtPoint(3)[3] is within 5 of 255 128 alpha on alpha 129 PASS pixelDataAtPoint(0)[0] is within 5 of 171 130 PASS pixelDataAtPoint(0)[1] is within 5 of 0 131 PASS pixelDataAtPoint(0)[2] is within 5 of 84 132 PASS pixelDataAtPoint(0)[3] is within 5 of 191 133 PASS pixelDataAtPoint(1)[0] is within 5 of 171 134 PASS pixelDataAtPoint(1)[1] is within 5 of 171 135 PASS pixelDataAtPoint(1)[2] is within 5 of 84 136 PASS pixelDataAtPoint(1)[3] is within 5 of 191 137 PASS pixelDataAtPoint(2)[0] is within 5 of 0 138 PASS pixelDataAtPoint(2)[1] is within 5 of 85 139 PASS pixelDataAtPoint(2)[2] is within 5 of 84 140 PASS pixelDataAtPoint(2)[3] is within 5 of 191 141 PASS pixelDataAtPoint(3)[0] is within 5 of 0 142 PASS pixelDataAtPoint(3)[1] is within 5 of 0 143 PASS pixelDataAtPoint(3)[2] is within 5 of 255 144 PASS pixelDataAtPoint(3)[3] is within 5 of 191 145 76 146 Testing blend mode "multiply" 77 147 solid on solid -
trunk/LayoutTests/fast/canvas/canvas-blend-solid-expected.txt
r138334 r170433 74 74 PASS pixelDataAtPoint(3)[3] is within 5 of 191 75 75 76 Testing blend mode "normal" 77 solid on solid 78 PASS pixelDataAtPoint(0)[0] is within 5 of 255 79 PASS pixelDataAtPoint(0)[1] is within 5 of 0 80 PASS pixelDataAtPoint(0)[2] is within 5 of 0 81 PASS pixelDataAtPoint(0)[3] is within 5 of 255 82 PASS pixelDataAtPoint(1)[0] is within 5 of 255 83 PASS pixelDataAtPoint(1)[1] is within 5 of 255 84 PASS pixelDataAtPoint(1)[2] is within 5 of 0 85 PASS pixelDataAtPoint(1)[3] is within 5 of 255 86 PASS pixelDataAtPoint(2)[0] is within 5 of 0 87 PASS pixelDataAtPoint(2)[1] is within 5 of 128 88 PASS pixelDataAtPoint(2)[2] is within 5 of 0 89 PASS pixelDataAtPoint(2)[3] is within 5 of 255 90 PASS pixelDataAtPoint(3)[0] is within 5 of 0 91 PASS pixelDataAtPoint(3)[1] is within 5 of 0 92 PASS pixelDataAtPoint(3)[2] is within 5 of 255 93 PASS pixelDataAtPoint(3)[3] is within 5 of 255 94 solid on alpha 95 PASS pixelDataAtPoint(0)[0] is within 5 of 128 96 PASS pixelDataAtPoint(0)[1] is within 5 of 0 97 PASS pixelDataAtPoint(0)[2] is within 5 of 127 98 PASS pixelDataAtPoint(0)[3] is within 5 of 255 99 PASS pixelDataAtPoint(1)[0] is within 5 of 128 100 PASS pixelDataAtPoint(1)[1] is within 5 of 128 101 PASS pixelDataAtPoint(1)[2] is within 5 of 127 102 PASS pixelDataAtPoint(1)[3] is within 5 of 255 103 PASS pixelDataAtPoint(2)[0] is within 5 of 0 104 PASS pixelDataAtPoint(2)[1] is within 5 of 64 105 PASS pixelDataAtPoint(2)[2] is within 5 of 127 106 PASS pixelDataAtPoint(2)[3] is within 5 of 255 107 PASS pixelDataAtPoint(3)[0] is within 5 of 0 108 PASS pixelDataAtPoint(3)[1] is within 5 of 0 109 PASS pixelDataAtPoint(3)[2] is within 5 of 255 110 PASS pixelDataAtPoint(3)[3] is within 5 of 255 111 alpha on solid 112 PASS pixelDataAtPoint(0)[0] is within 5 of 255 113 PASS pixelDataAtPoint(0)[1] is within 5 of 0 114 PASS pixelDataAtPoint(0)[2] is within 5 of 0 115 PASS pixelDataAtPoint(0)[3] is within 5 of 255 116 PASS pixelDataAtPoint(1)[0] is within 5 of 255 117 PASS pixelDataAtPoint(1)[1] is within 5 of 255 118 PASS pixelDataAtPoint(1)[2] is within 5 of 0 119 PASS pixelDataAtPoint(1)[3] is within 5 of 255 120 PASS pixelDataAtPoint(2)[0] is within 5 of 0 121 PASS pixelDataAtPoint(2)[1] is within 5 of 128 122 PASS pixelDataAtPoint(2)[2] is within 5 of 0 123 PASS pixelDataAtPoint(2)[3] is within 5 of 255 124 PASS pixelDataAtPoint(3)[0] is within 5 of 0 125 PASS pixelDataAtPoint(3)[1] is within 5 of 0 126 PASS pixelDataAtPoint(3)[2] is within 5 of 255 127 PASS pixelDataAtPoint(3)[3] is within 5 of 255 128 alpha on alpha 129 PASS pixelDataAtPoint(0)[0] is within 5 of 171 130 PASS pixelDataAtPoint(0)[1] is within 5 of 0 131 PASS pixelDataAtPoint(0)[2] is within 5 of 84 132 PASS pixelDataAtPoint(0)[3] is within 5 of 191 133 PASS pixelDataAtPoint(1)[0] is within 5 of 171 134 PASS pixelDataAtPoint(1)[1] is within 5 of 171 135 PASS pixelDataAtPoint(1)[2] is within 5 of 84 136 PASS pixelDataAtPoint(1)[3] is within 5 of 191 137 PASS pixelDataAtPoint(2)[0] is within 5 of 0 138 PASS pixelDataAtPoint(2)[1] is within 5 of 85 139 PASS pixelDataAtPoint(2)[2] is within 5 of 84 140 PASS pixelDataAtPoint(2)[3] is within 5 of 191 141 PASS pixelDataAtPoint(3)[0] is within 5 of 0 142 PASS pixelDataAtPoint(3)[1] is within 5 of 0 143 PASS pixelDataAtPoint(3)[2] is within 5 of 255 144 PASS pixelDataAtPoint(3)[3] is within 5 of 191 145 76 146 Testing blend mode "multiply" 77 147 solid on solid -
trunk/LayoutTests/fast/canvas/script-tests/canvas-blend-image.js
r138334 r170433 27 27 [ 28 28 ['source-over', 29 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 30 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 31 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 32 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] 29 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 30 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 31 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 32 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] 33 ], 34 ['normal', 35 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 36 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 37 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 38 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] 33 39 ], 34 40 ['multiply', 35 36 37 38 41 [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], 42 [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 43 [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], 44 [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] 39 45 ], 40 46 ['screen', 41 42 43 44 47 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], 48 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], 49 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], 50 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] 45 51 ], 46 52 ['overlay', 47 48 49 50 53 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 54 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 55 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 56 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] 51 57 ], 52 58 ['darken', 53 54 55 56 59 [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], 60 [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 61 [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], 62 [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] 57 63 ], 58 64 ['lighten', 59 60 61 62 65 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], 66 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], 67 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], 68 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] 63 69 ], 64 70 ['color-dodge', 65 66 67 68 71 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 72 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 73 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 74 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] 69 75 ], 70 76 ['color-burn', 71 72 73 74 77 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 78 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 79 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 80 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 0, 170, 191],[0, 0, 255, 191]] 75 81 76 82 ], 77 83 ['hard-light', 78 79 80 81 84 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 1, 0, 255],[0, 0, 255, 255]], 85 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 86 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 65, 0, 255],[0, 0, 255, 255]], 87 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] 82 88 ], 83 89 ['soft-light', 84 85 86 87 90 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 91 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 92 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 93 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] 88 94 ], 89 95 ['difference', 90 91 92 93 96 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], 97 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], 98 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], 99 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] 94 100 ], 95 101 ['exclusion', 96 97 98 99 102 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], 103 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], 104 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], 105 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] 100 106 ], 101 107 ['hue', 102 103 104 105 108 [[93, 0, 0, 255],[31, 31, 0, 255],[0, 46, 0, 255],[0, 0, 255, 255]], 109 [[49, 0, 127, 255],[16, 16, 127, 255],[0, 25, 127, 255],[0, 0, 255, 255]], 110 [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], 111 [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] 106 112 ], 107 113 ['saturation', 108 109 110 111 114 [[0, 0, 255, 255],[0, 0, 255, 255],[14, 14, 142, 255],[0, 0, 255, 255]], 115 [[0, 0, 255, 255],[0, 0, 255, 255],[7, 7, 198, 255],[0, 0, 255, 255]], 116 [[128, 0, 127, 255],[128, 128, 127, 255],[7, 71, 70, 255],[0, 0, 255, 255]], 117 [[85, 0, 167, 191],[85, 85, 167, 191],[0, 48, 130, 191],[0, 0, 255, 191]] 112 118 ], 113 119 ['color', 114 115 116 117 120 [[93, 0, 0, 255],[31, 31, 0, 255],[0, 47, 0, 255],[0, 0, 255, 255]], 121 [[49, 0, 127, 255],[16, 16, 127, 255],[0, 24, 127, 255],[0, 0, 255, 255]], 122 [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], 123 [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] 118 124 ], 119 125 ['luminosity', 120 121 122 123 126 [[55, 55, 255, 255],[224, 224, 255, 255],[54, 54, 255, 255],[0, 0, 255, 255]], 127 [[28, 28, 255, 255],[112, 112, 255, 255],[27, 27, 255, 255],[0, 0, 255, 255]], 128 [[155, 27, 127, 255],[239, 239, 127, 255],[26, 90, 127, 255],[0, 0, 255, 255]], 129 [[104, 19, 167, 191],[158, 158, 167, 191],[16, 58, 167, 191],[0, 0, 255, 191]] 124 130 ]]; 125 131 … … 154 160 // Check each blend mode individually. 155 161 for (var i = 0; i < blendModes.length; i++) { 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 162 debug('Testing blend mode "' + blendModes[i][0] + '"'); 163 for (var j = 0; j < testScenario.length; j++) { 164 ctx.clearRect(0,0,200,200); 165 ctx.save(); 166 167 // Draw backdrop. 168 ctx.fillStyle = 'rgba(0, 0, 255, ' + testScenario[j][1] + ')'; 169 ctx.fillRect(0,0,200,200); 170 171 // Apply blend mode. 172 ctx.globalCompositeOperation = blendModes[i][0]; 173 ctx.globalAlpha = testScenario[j][2]; 174 ctx.drawImage(img, 0, 0); 175 176 checkBlendModeResult(blendModes[i][0], testScenario[j][0], blendModes[i][j+1], sigma); 177 ctx.restore(); 178 } 179 debug(''); 180 } 175 181 } 176 182 -
trunk/LayoutTests/fast/canvas/script-tests/canvas-blend-solid.js
r138334 r170433 28 28 [ 29 29 ['source-over', 30 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 31 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 32 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 33 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] 30 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 31 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 32 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 33 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] 34 ], 35 ['normal', 36 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 37 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 38 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 128, 0, 255],[0, 0, 255, 255]], 39 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 85, 84, 191],[0, 0, 255, 191]] 34 40 ], 35 41 ['multiply', 36 37 38 39 42 [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], 43 [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 44 [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], 45 [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] 40 46 ], 41 47 ['screen', 42 43 44 45 48 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], 49 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], 50 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], 51 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] 46 52 ], 47 53 ['overlay', 48 49 50 51 54 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 55 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 56 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 57 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] 52 58 ], 53 59 ['darken', 54 55 56 57 60 [[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 0, 255],[0, 0, 255, 255]], 61 [[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 62 [[128, 0, 0, 255],[128, 128, 0, 255],[0, 64, 0, 255],[0, 0, 255, 255]], 63 [[85, 0, 84, 191],[85, 85, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] 58 64 ], 59 65 ['lighten', 60 61 62 63 66 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 255, 255]], 67 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 255, 255]], 68 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 255, 255]], 69 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 255, 191]] 64 70 ], 65 71 ['color-dodge', 66 67 68 69 72 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 73 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 74 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 75 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] 70 76 ], 71 77 ['color-burn', 72 73 74 75 78 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 79 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 80 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 81 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 0, 170, 191],[0, 0, 255, 191]] 76 82 77 83 ], 78 84 ['hard-light', 79 80 81 82 85 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 1, 0, 255],[0, 0, 255, 255]], 86 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 0, 127, 255],[0, 0, 255, 255]], 87 [[255, 0, 0, 255],[255, 255, 0, 255],[0, 65, 0, 255],[0, 0, 255, 255]], 88 [[171, 0, 84, 191],[171, 171, 84, 191],[0, 43, 84, 191],[0, 0, 255, 191]] 83 89 ], 84 90 ['soft-light', 85 86 87 88 91 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 92 [[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255],[0, 0, 255, 255]], 93 [[128, 0, 127, 255],[128, 128, 127, 255],[0, 64, 127, 255],[0, 0, 255, 255]], 94 [[85, 0, 170, 191],[85, 85, 170, 191],[0, 43, 170, 191],[0, 0, 255, 191]] 89 95 ], 90 96 ['difference', 91 92 93 94 97 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], 98 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], 99 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], 100 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] 95 101 ], 96 102 ['exclusion', 97 98 99 100 103 [[255, 0, 255, 255],[255, 255, 255, 255],[0, 128, 255, 255],[0, 0, 0, 255]], 104 [[128, 0, 255, 255],[128, 128, 255, 255],[0, 64, 255, 255],[0, 0, 127, 255]], 105 [[255, 0, 127, 255],[255, 255, 127, 255],[0, 128, 127, 255],[0, 0, 128, 255]], 106 [[171, 0, 170, 191],[171, 171, 170, 191],[0, 85, 170, 191],[0, 0, 171, 191]] 101 107 ], 102 108 ['hue', 103 104 105 106 109 [[93, 0, 0, 255],[31, 31, 0, 255],[0, 46, 0, 255],[0, 0, 255, 255]], 110 [[49, 0, 127, 255],[16, 16, 127, 255],[0, 25, 127, 255],[0, 0, 255, 255]], 111 [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], 112 [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] 107 113 ], 108 114 ['saturation', 109 110 111 112 115 [[0, 0, 255, 255],[0, 0, 255, 255],[14, 14, 142, 255],[0, 0, 255, 255]], 116 [[0, 0, 255, 255],[0, 0, 255, 255],[7, 7, 198, 255],[0, 0, 255, 255]], 117 [[128, 0, 127, 255],[128, 128, 127, 255],[7, 71, 70, 255],[0, 0, 255, 255]], 118 [[85, 0, 167, 191],[85, 85, 167, 191],[0, 48, 130, 191],[0, 0, 255, 191]] 113 119 ], 114 120 ['color', 115 116 117 118 121 [[93, 0, 0, 255],[31, 31, 0, 255],[0, 47, 0, 255],[0, 0, 255, 255]], 122 [[49, 0, 127, 255],[16, 16, 127, 255],[0, 24, 127, 255],[0, 0, 255, 255]], 123 [[175, 0, 0, 255],[144, 144, 0, 255],[0, 88, 0, 255],[0, 0, 255, 255]], 124 [[116, 0, 84, 191],[96, 96, 84, 191],[0, 58, 84, 191],[0, 0, 255, 191]] 119 125 ], 120 126 ['luminosity', 121 122 123 124 127 [[55, 55, 255, 255],[224, 224, 255, 255],[54, 54, 255, 255],[0, 0, 255, 255]], 128 [[28, 28, 255, 255],[112, 112, 255, 255],[27, 27, 255, 255],[0, 0, 255, 255]], 129 [[155, 27, 127, 255],[239, 239, 127, 255],[26, 90, 127, 255],[0, 0, 255, 255]], 130 [[104, 19, 167, 191],[158, 158, 167, 191],[16, 58, 167, 191],[0, 0, 255, 191]] 125 131 ]]; 126 132 … … 155 161 // Check each blend mode individually. 156 162 for (var i = 0; i < blendModes.length; i++) { 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 163 debug('Testing blend mode "' + blendModes[i][0] + '"'); 164 for (var j = 0; j < testScenario.length; j++) { 165 ctx.globalCompositeOperation = 'clear'; 166 ctx.fillRect(0,0,200,200); 167 ctx.globalCompositeOperation = 'source-over'; 168 ctx.save(); 169 170 // Draw backdrop. 171 ctx.fillStyle = 'rgba(0, 0, 255, ' + testScenario[j][1] + ')'; 172 ctx.fillRect(0,0,200,200); 173 174 // Apply blend mode. 175 ctx.globalCompositeOperation = blendModes[i][0]; 176 ctx.globalAlpha = testScenario[j][2]; 177 ctx.fillStyle = "red"; 178 ctx.fillRect(0,0,100,100); 179 ctx.fillStyle = "yellow"; 180 ctx.fillRect(100,0,100,100); 181 ctx.fillStyle = "green"; 182 ctx.fillRect(100,100,100,100); 183 ctx.fillStyle = "blue"; 184 ctx.fillRect(0,100,100,100); 185 ctx.restore(); 186 187 checkBlendModeResult(blendModes[i][0], testScenario[j][0], blendModes[i][j+1], sigma); 188 ctx.restore(); 189 } 190 debug(''); 185 191 } 186 192 } -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/filters-blend-01-b-expected.txt
r161884 r170433 7 7 RenderSVGHiddenContainer {defs} at (0,0) size 0x0 8 8 RenderSVGResourceFilter {filter} [id="BlendNormal"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 9 [feBlend mode=" NORMAL"]9 [feBlend mode="normal"] 10 10 [SourceGraphic] 11 11 [feFlood flood-color="#00FF00" flood-opacity="0.50"] 12 12 RenderSVGResourceFilter {filter} [id="BlendMultiply"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 13 [feBlend mode=" MULTIPLY"]13 [feBlend mode="multiply"] 14 14 [SourceGraphic] 15 15 [feFlood flood-color="#00FF00" flood-opacity="0.50"] 16 16 RenderSVGResourceFilter {filter} [id="BlendScreen"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 17 [feBlend mode=" SCREEN"]17 [feBlend mode="screen"] 18 18 [SourceGraphic] 19 19 [feFlood flood-color="#00FF00" flood-opacity="0.50"] 20 20 RenderSVGResourceFilter {filter} [id="BlendDarken"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 21 [feBlend mode=" DARKEN"]21 [feBlend mode="darken"] 22 22 [SourceGraphic] 23 23 [feFlood flood-color="#00FF00" flood-opacity="0.50"] 24 24 RenderSVGResourceFilter {filter} [id="BlendLighten"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 25 [feBlend mode=" LIGHTEN"]25 [feBlend mode="lighten"] 26 26 [SourceGraphic] 27 27 [feFlood flood-color="#00FF00" flood-opacity="0.50"] -
trunk/LayoutTests/svg/css/path-gradient-stroke-shadow-expected.txt
r119860 r170433 8 8 RenderSVGGradientStop {stop} [offset=1.00] [color=#0000FF] 9 9 RenderSVGResourceFilter {filter} [id="shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 10 [feBlend mode=" NORMAL"]10 [feBlend mode="normal"] 11 11 [SourceGraphic] 12 12 [feGaussianBlur stdDeviation="10.00, 10.00"] -
trunk/LayoutTests/svg/css/rect-gradient-stroke-shadow-expected.txt
r103407 r170433 8 8 RenderSVGGradientStop {stop} [offset=1.00] [color=#0000FF] 9 9 RenderSVGResourceFilter {filter} [id="shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse] 10 [feBlend mode=" NORMAL"]10 [feBlend mode="normal"] 11 11 [SourceGraphic] 12 12 [feGaussianBlur stdDeviation="10.00, 10.00"] -
trunk/Source/WebCore/ChangeLog
r170430 r170433 1 2014-06-25 Dirk Schulze <krit@webkit.org> 2 3 Add all blend modes to feBlend 4 5 feBlend should support all blend modes from CSS and Canvas 6 https://bugs.webkit.org/show_bug.cgi?id=134296 7 8 Reviewed by Dean Jackson. 9 10 Add all blend modes to <feBlend> (the SVG filter primitive) that are also 11 supported by HTML Canvas and CSS. 12 13 In addition, add "normal" blend mode to HTML Canvas as requested by the 14 CSS Compositing and Blending specification. (Referenced from HTML Canvas.) 15 With this change, SVG, CSS and Canvas truly share the same blend modes and 16 even the same keywords. This is much easier to for web authors. 17 18 http://www.w3.org/TR/2014/CR-compositing-1-20140220/#ltblendmodegt 19 20 Test: svg/filters/feBlend-all-blendmodes.svg 21 22 * platform/graphics/GraphicsTypes.cpp: Reorder blend mode text streams to match 23 enumeration order. Add a new function to parse blend modes independent of 24 compositing modes. Add a string "normal" that is supported by CSS, feBlend and 25 HTML Canvas now. 26 (WebCore::parseBlendMode): 27 (WebCore::parseCompositeAndBlendOperator): 28 * platform/graphics/GraphicsTypes.h: Reorder BlendMode enumeration values to match 29 the SVG JS enumeration for blend modes. 30 * platform/graphics/cpu/arm/filters/FEBlendNEON.h: Move all software code that is no 31 longer required by the software path but still used by NEON here. 32 (WebCore::FEBlend::platformApplySoftware): 33 (WebCore::FEBlend::platformApplyNEON): 34 * platform/graphics/filters/FEBlend.cpp: 35 Use drawImageBuffer() to blend the results of previous filter primitives. This 36 allows removing more than 60% of the code. 37 (WebCore::FEBlend::FEBlend): 38 (WebCore::FEBlend::create): 39 (WebCore::FEBlend::blendMode): 40 (WebCore::FEBlend::setBlendMode): 41 (WebCore::FEBlend::platformApplySoftware): 42 (WebCore::FEBlend::dump): 43 (WebCore::FEBlend::externalRepresentation): 44 (WebCore::feBlendNormal): Deleted. 45 (WebCore::feBlendMultiply): Deleted. 46 (WebCore::feBlendScreen): Deleted. 47 (WebCore::feBlendDarken): Deleted. 48 (WebCore::feBlendLighten): Deleted. 49 (WebCore::feBlendUnknown): Deleted. 50 (WebCore::platformApply): Deleted. 51 (WebCore::FEBlend::platformApplyGeneric): Deleted. 52 (WebCore::operator<<): Deleted. 53 * platform/graphics/filters/FEBlend.h: 54 * svg/SVGAnimatedEnumeration.cpp: Use the global BlendMode enumeration. 55 (WebCore::enumerationValueForTargetAttribute): 56 * svg/SVGFEBlendElement.cpp: 57 (WebCore::SVGFEBlendElement::SVGFEBlendElement): Use the global BlendMode enumeration. 58 No new enumeration values added or exposed to SVG DOM as requested by SVG WG. 59 (WebCore::SVGFEBlendElement::parseAttribute): 60 * svg/SVGFEBlendElement.h: Replace BlendModeType with global BlendMode enumeration. Remove 61 blend mode parsing code and use the code in GraphicsTypes instead. 62 (WebCore::SVGPropertyTraits<BlendMode>::highestEnumValue): 63 (WebCore::SVGPropertyTraits<BlendMode>::toString): 64 (WebCore::SVGPropertyTraits<BlendModeType>::highestEnumValue): Deleted. 65 (WebCore::SVGPropertyTraits<BlendModeType>::toString): Deleted. 66 (WebCore::SVGPropertyTraits<BlendModeType>::fromString): Deleted. 67 1 68 2014-06-25 Zalan Bujtas <zalan@apple.com> 2 69 -
trunk/Source/WebCore/platform/graphics/GraphicsTypes.cpp
r165676 r170433 2 2 * Copyright (C) 2006 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2012 Rik Cabanier (cabanier@adobe.com) 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 50 51 51 52 static const char* const blendOperatorNames[] = { 53 "normal", 52 54 "multiply", 53 55 "screen", 54 "overlay",55 56 "darken", 56 57 "lighten", 58 "overlay", 57 59 "color-dodge", 58 60 "color-burn", … … 69 71 const int numBlendOperatorNames = WTF_ARRAY_LENGTH(blendOperatorNames); 70 72 73 bool parseBlendMode(const String& s, BlendMode& blendMode) 74 { 75 for (int i = 0; i < numBlendOperatorNames; i++) { 76 if (s == blendOperatorNames[i]) { 77 blendMode = static_cast<BlendMode>(i+1); 78 return true; 79 } 80 } 81 82 return false; 83 } 84 71 85 bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, BlendMode& blendOp) 72 86 { … … 79 93 } 80 94 81 for (int i = 0; i < numBlendOperatorNames; i++) { 82 if (s == blendOperatorNames[i]) { 83 blendOp = static_cast<BlendMode>(i+1); 84 // For now, blending will always assume source-over. This will be fixed in the future 85 op = CompositeSourceOver; 86 return true; 87 } 95 if (parseBlendMode(s, blendOp)) { 96 // For now, blending will always assume source-over. This will be fixed in the future 97 op = CompositeSourceOver; 98 return true; 88 99 } 89 100 -
trunk/Source/WebCore/platform/graphics/GraphicsTypes.h
r165676 r170433 49 49 50 50 enum BlendMode { 51 BlendModeNormal ,51 BlendModeNormal = 1, // Start with 1 to match SVG's blendmode enumeration. 52 52 BlendModeMultiply, 53 53 BlendModeScreen, 54 BlendModeOverlay,55 54 BlendModeDarken, 56 55 BlendModeLighten, 56 BlendModeOverlay, 57 57 BlendModeColorDodge, 58 58 BlendModeColorBurn, … … 84 84 85 85 String compositeOperatorName(CompositeOperator, BlendMode); 86 bool parseBlendMode(const String&, BlendMode&); 86 87 bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, BlendMode&); 87 88 -
trunk/Source/WebCore/platform/graphics/cpu/arm/filters/FEBlendNEON.h
r143499 r170433 2 2 * Copyright (C) 2012 University of Szeged 3 3 * Copyright (C) 2012 Gabor Rapcsanyi 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 106 107 }; 107 108 109 void FEBlend::platformApplySoftware() 110 { 111 FilterEffect* in = inputEffect(0); 112 FilterEffect* in2 = inputEffect(1); 113 114 Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); 115 if (!dstPixelArray) 116 return; 117 118 IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); 119 RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect); 120 121 IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect()); 122 RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect); 123 124 unsigned pixelArrayLength = srcPixelArrayA->length(); 125 ASSERT(pixelArrayLength == srcPixelArrayB->length()); 126 127 if (pixelArrayLength >= 8) { 128 platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength); 129 return 130 } 131 // If there is just one pixel we expand it to two. 132 ASSERT(pixelArrayLength > 0); 133 uint32_t sourceA[2] = {0, 0}; 134 uint32_t sourceBAndDest[2] = {0, 0}; 135 136 sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0]; 137 sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[0]; 138 platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8); 139 reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0]; 140 } 141 108 142 void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, 109 143 unsigned colorArrayLength) … … 130 164 uint16x8_t result; 131 165 switch (m_mode) { 132 case FEBLEND_MODE_NORMAL:166 case BlendModeNormal: 133 167 result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); 134 168 break; 135 case FEBLEND_MODE_MULTIPLY:169 case BlendModeMultiply: 136 170 result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); 137 171 break; 138 case FEBLEND_MODE_SCREEN:172 case BlendModeScreen: 139 173 result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); 140 174 break; 141 case FEBLEND_MODE_DARKEN:175 case BlendModeDarken: 142 176 result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); 143 177 break; 144 case FEBLEND_MODE_LIGHTEN:178 case BlendModeLighten: 145 179 result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); 146 180 break; 147 case FEBLEND_MODE_UNKNOWN:148 181 default: 149 182 result = vdupq_n_u16(0); -
trunk/Source/WebCore/platform/graphics/filters/FEBlend.cpp
r158183 r170433 5 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 6 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 7 8 * 8 9 * This library is free software; you can redistribute it and/or … … 35 36 #include <runtime/Uint8ClampedArray.h> 36 37 37 typedef unsigned char (*BlendType)(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB);38 39 38 namespace WebCore { 40 39 41 FEBlend::FEBlend(Filter* filter, BlendMode Typemode)40 FEBlend::FEBlend(Filter* filter, BlendMode mode) 42 41 : FilterEffect(filter) 43 42 , m_mode(mode) … … 45 44 } 46 45 47 PassRefPtr<FEBlend> FEBlend::create(Filter* filter, BlendMode Typemode)46 PassRefPtr<FEBlend> FEBlend::create(Filter* filter, BlendMode mode) 48 47 { 49 48 return adoptRef(new FEBlend(filter, mode)); 50 49 } 51 50 52 BlendMode TypeFEBlend::blendMode() const51 BlendMode FEBlend::blendMode() const 53 52 { 54 53 return m_mode; 55 54 } 56 55 57 bool FEBlend::setBlendMode(BlendMode Typemode)56 bool FEBlend::setBlendMode(BlendMode mode) 58 57 { 59 58 if (m_mode == mode) … … 63 62 } 64 63 65 inline unsigned char feBlendNormal(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char) 66 { 67 return fastDivideBy255((255 - alphaA) * colorB + colorA * 255); 68 } 69 70 inline unsigned char feBlendMultiply(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) 71 { 72 return fastDivideBy255((255 - alphaA) * colorB + (255 - alphaB + colorB) * colorA); 73 } 74 75 inline unsigned char feBlendScreen(unsigned char colorA, unsigned char colorB, unsigned char, unsigned char) 76 { 77 return fastDivideBy255((colorB + colorA) * 255 - colorA * colorB); 78 } 79 80 inline unsigned char feBlendDarken(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) 81 { 82 return fastDivideBy255(std::min((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)); 83 } 84 85 inline unsigned char feBlendLighten(unsigned char colorA, unsigned char colorB, unsigned char alphaA, unsigned char alphaB) 86 { 87 return fastDivideBy255(std::max((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)); 88 } 89 90 inline unsigned char feBlendUnknown(unsigned char, unsigned char, unsigned char, unsigned char) 91 { 92 return 0; 93 } 94 95 template<BlendType BlendFunction> 96 static void platformApply(unsigned char* sourcePixelA, unsigned char* sourcePixelB, 97 unsigned char* destinationPixel, unsigned pixelArrayLength) 98 { 99 unsigned len = pixelArrayLength / 4; 100 for (unsigned pixelOffset = 0; pixelOffset < len; pixelOffset++) { 101 unsigned char alphaA = sourcePixelA[3]; 102 unsigned char alphaB = sourcePixelB[3]; 103 destinationPixel[0] = BlendFunction(sourcePixelA[0], sourcePixelB[0], alphaA, alphaB); 104 destinationPixel[1] = BlendFunction(sourcePixelA[1], sourcePixelB[1], alphaA, alphaB); 105 destinationPixel[2] = BlendFunction(sourcePixelA[2], sourcePixelB[2], alphaA, alphaB); 106 destinationPixel[3] = 255 - fastDivideBy255((255 - alphaA) * (255 - alphaB)); 107 sourcePixelA += 4; 108 sourcePixelB += 4; 109 destinationPixel += 4; 110 } 111 } 112 113 void FEBlend::platformApplyGeneric(unsigned char* sourcePixelA, unsigned char* sourcePixelB, 114 unsigned char* destinationPixel, unsigned pixelArrayLength) 115 { 116 switch (m_mode) { 117 case FEBLEND_MODE_NORMAL: 118 platformApply<feBlendNormal>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); 119 break; 120 case FEBLEND_MODE_MULTIPLY: 121 platformApply<feBlendMultiply>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); 122 break; 123 case FEBLEND_MODE_SCREEN: 124 platformApply<feBlendScreen>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); 125 break; 126 case FEBLEND_MODE_DARKEN: 127 platformApply<feBlendDarken>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); 128 break; 129 case FEBLEND_MODE_LIGHTEN: 130 platformApply<feBlendLighten>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); 131 break; 132 case FEBLEND_MODE_UNKNOWN: 133 platformApply<feBlendUnknown>(sourcePixelA, sourcePixelB, destinationPixel, pixelArrayLength); 134 break; 135 } 136 } 137 64 #if !HAVE(ARM_NEON_INTRINSICS) 138 65 void FEBlend::platformApplySoftware() 139 66 { … … 141 68 FilterEffect* in2 = inputEffect(1); 142 69 143 ASSERT(m_mode > FEBLEND_MODE_UNKNOWN); 144 ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN); 70 ImageBuffer* resultImage = createImageBufferResult(); 71 if (!resultImage) 72 return; 73 GraphicsContext* filterContext = resultImage->context(); 145 74 146 Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); 147 if (!dstPixelArray) 148 return; 75 ImageBuffer* imageBuffer = in->asImageBuffer(); 76 ImageBuffer* imageBuffer2 = in2->asImageBuffer(); 77 ASSERT(imageBuffer); 78 ASSERT(imageBuffer2); 149 79 150 IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); 151 RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect); 152 153 IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect()); 154 RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect); 155 156 unsigned pixelArrayLength = srcPixelArrayA->length(); 157 ASSERT(pixelArrayLength == srcPixelArrayB->length()); 158 159 #if HAVE(ARM_NEON_INTRINSICS) 160 if (pixelArrayLength >= 8) 161 platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength); 162 else { // If there is just one pixel we expand it to two. 163 ASSERT(pixelArrayLength > 0); 164 uint32_t sourceA[2] = {0, 0}; 165 uint32_t sourceBAndDest[2] = {0, 0}; 166 167 sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0]; 168 sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[0]; 169 platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8); 170 reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0]; 171 } 172 #else 173 platformApplyGeneric(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength); 80 filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 81 filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), ImagePaintingOptions(CompositeSourceOver, m_mode)); 82 } 174 83 #endif 175 }176 84 177 85 void FEBlend::dump() 178 86 { 179 }180 181 static TextStream& operator<<(TextStream& ts, const BlendModeType& type)182 {183 switch (type) {184 case FEBLEND_MODE_UNKNOWN:185 ts << "UNKNOWN";186 break;187 case FEBLEND_MODE_NORMAL:188 ts << "NORMAL";189 break;190 case FEBLEND_MODE_MULTIPLY:191 ts << "MULTIPLY";192 break;193 case FEBLEND_MODE_SCREEN:194 ts << "SCREEN";195 break;196 case FEBLEND_MODE_DARKEN:197 ts << "DARKEN";198 break;199 case FEBLEND_MODE_LIGHTEN:200 ts << "LIGHTEN";201 break;202 }203 return ts;204 87 } 205 88 … … 209 92 ts << "[feBlend"; 210 93 FilterEffect::externalRepresentation(ts); 211 ts << " mode=\"" << m_mode<< "\"]\n";94 ts << " mode=\"" << (m_mode == BlendModeNormal ? "normal" : compositeOperatorName(CompositeSourceOver, m_mode)) << "\"]\n"; 212 95 inputEffect(0)->externalRepresentation(ts, indent + 1); 213 96 inputEffect(1)->externalRepresentation(ts, indent + 1); -
trunk/Source/WebCore/platform/graphics/filters/FEBlend.h
r149193 r170433 3 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 5 6 * 6 7 * This library is free software; you can redistribute it and/or … … 30 31 namespace WebCore { 31 32 32 enum BlendModeType {33 FEBLEND_MODE_UNKNOWN = 0,34 FEBLEND_MODE_NORMAL = 1,35 FEBLEND_MODE_MULTIPLY = 2,36 FEBLEND_MODE_SCREEN = 3,37 FEBLEND_MODE_DARKEN = 4,38 FEBLEND_MODE_LIGHTEN = 539 };40 41 33 class FEBlend : public FilterEffect { 42 34 public: 43 static PassRefPtr<FEBlend> create(Filter*, BlendMode Type);35 static PassRefPtr<FEBlend> create(Filter*, BlendMode); 44 36 45 BlendMode TypeblendMode() const;46 bool setBlendMode(BlendMode Type);37 BlendMode blendMode() const; 38 bool setBlendMode(BlendMode); 47 39 48 40 void platformApplyGeneric(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, … … 56 48 57 49 private: 58 FEBlend(Filter*, BlendMode Type);50 FEBlend(Filter*, BlendMode); 59 51 60 BlendMode Typem_mode;52 BlendMode m_mode; 61 53 }; 62 54 -
trunk/Source/WebCore/svg/SVGAnimatedEnumeration.cpp
r163440 r170433 87 87 } 88 88 89 if (attrName == SVGNames::modeAttr) 90 return SVGPropertyTraits<BlendModeType>::fromString(value); 89 if (attrName == SVGNames::modeAttr) { 90 BlendMode mode = BlendModeNormal; 91 parseBlendMode(value, mode); 92 return mode; 93 } 91 94 if (attrName == SVGNames::stitchTilesAttr) 92 95 return SVGPropertyTraits<SVGStitchOptions>::fromString(value); -
trunk/Source/WebCore/svg/SVGFEBlendElement.cpp
r168469 r170433 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 36 37 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::inAttr, In1, in1) 37 38 DEFINE_ANIMATED_STRING(SVGFEBlendElement, SVGNames::in2Attr, In2, in2) 38 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, BlendMode Type)39 DEFINE_ANIMATED_ENUMERATION(SVGFEBlendElement, SVGNames::modeAttr, Mode, mode, BlendMode) 39 40 40 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEBlendElement) … … 47 48 inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document& document) 48 49 : SVGFilterPrimitiveStandardAttributes(tagName, document) 49 , m_mode( FEBLEND_MODE_NORMAL)50 , m_mode(BlendModeNormal) 50 51 { 51 52 ASSERT(hasTagName(SVGNames::feBlendTag)); … … 77 78 78 79 if (name == SVGNames::modeAttr) { 79 BlendMode Type propertyValue = SVGPropertyTraits<BlendModeType>::fromString(value);80 if (p ropertyValue > 0)81 setModeBaseValue( propertyValue);80 BlendMode mode = BlendModeNormal; 81 if (parseBlendMode(value, mode)) 82 setModeBaseValue(mode); 82 83 return; 83 84 } -
trunk/Source/WebCore/svg/SVGFEBlendElement.h
r163440 r170433 2 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 4 * Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved. 4 5 * 5 6 * This library is free software; you can redistribute it and/or … … 30 31 31 32 template<> 32 struct SVGPropertyTraits<BlendMode Type> {33 static unsigned highestEnumValue() { return FEBLEND_MODE_LIGHTEN; }33 struct SVGPropertyTraits<BlendMode> { 34 static unsigned highestEnumValue() { return BlendModeLighten; } 34 35 35 static String toString(BlendMode Typetype)36 static String toString(BlendMode type) 36 37 { 37 38 switch (type) { 38 case FEBLEND_MODE_UNKNOWN: 39 case BlendModeNormal: 40 return "normal"; 41 case BlendModeMultiply: 42 return "multiply"; 43 case BlendModeScreen: 44 return "screen"; 45 case BlendModeDarken: 46 return "darken"; 47 case BlendModeLighten: 48 return "lighten"; 49 default: 39 50 return emptyString(); 40 case FEBLEND_MODE_NORMAL:41 return "normal";42 case FEBLEND_MODE_MULTIPLY:43 return "multiply";44 case FEBLEND_MODE_SCREEN:45 return "screen";46 case FEBLEND_MODE_DARKEN:47 return "darken";48 case FEBLEND_MODE_LIGHTEN:49 return "lighten";50 51 } 51 52 ASSERT_NOT_REACHED();53 return emptyString();54 }55 56 static BlendModeType fromString(const String& value)57 {58 if (value == "normal")59 return FEBLEND_MODE_NORMAL;60 if (value == "multiply")61 return FEBLEND_MODE_MULTIPLY;62 if (value == "screen")63 return FEBLEND_MODE_SCREEN;64 if (value == "darken")65 return FEBLEND_MODE_DARKEN;66 if (value == "lighten")67 return FEBLEND_MODE_LIGHTEN;68 return FEBLEND_MODE_UNKNOWN;69 52 } 70 53 }; … … 86 69 DECLARE_ANIMATED_STRING(In1, in1) 87 70 DECLARE_ANIMATED_STRING(In2, in2) 88 DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendMode Type)71 DECLARE_ANIMATED_ENUMERATION(Mode, mode, BlendMode) 89 72 END_DECLARE_ANIMATED_PROPERTIES 90 73 };
Note: See TracChangeset
for help on using the changeset viewer.