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

Side by Side Diff: Source/core/platform/graphics/GraphicsContextState.h

Issue 23947005: Implement CSS luminance masking using skia SkLumaMaskXfermode class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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 // Copyright (C) 2013 Google Inc. All rights reserved. 1 // Copyright (C) 2013 Google Inc. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer 10 // copyright notice, this list of conditions and the following disclaimer
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 , m_compositeOperator(CompositeSourceOver) 58 , m_compositeOperator(CompositeSourceOver)
59 , m_blendMode(BlendModeNormal) 59 , m_blendMode(BlendModeNormal)
60 #if USE(LOW_QUALITY_IMAGE_INTERPOLATION) 60 #if USE(LOW_QUALITY_IMAGE_INTERPOLATION)
61 , m_interpolationQuality(InterpolationLow) 61 , m_interpolationQuality(InterpolationLow)
62 #else 62 #else
63 , m_interpolationQuality(InterpolationHigh) 63 , m_interpolationQuality(InterpolationHigh)
64 #endif 64 #endif
65 , m_shouldAntialias(true) 65 , m_shouldAntialias(true)
66 , m_shouldSmoothFonts(true) 66 , m_shouldSmoothFonts(true)
67 , m_shouldClampToSourceRect(true) 67 , m_shouldClampToSourceRect(true)
68 , m_drawLuminanceMask(false)
68 { 69 {
69 } 70 }
70 71
71 GraphicsContextState(const GraphicsContextState& other) 72 GraphicsContextState(const GraphicsContextState& other)
72 : m_strokeData(other.m_strokeData) 73 : m_strokeData(other.m_strokeData)
73 , m_fillColor(other.m_fillColor) 74 , m_fillColor(other.m_fillColor)
74 , m_fillRule(other.m_fillRule) 75 , m_fillRule(other.m_fillRule)
75 , m_fillGradient(other.m_fillGradient) 76 , m_fillGradient(other.m_fillGradient)
76 , m_fillPattern(other.m_fillPattern) 77 , m_fillPattern(other.m_fillPattern)
77 , m_looper(other.m_looper) 78 , m_looper(other.m_looper)
78 , m_textDrawingMode(other.m_textDrawingMode) 79 , m_textDrawingMode(other.m_textDrawingMode)
79 , m_alpha(other.m_alpha) 80 , m_alpha(other.m_alpha)
80 , m_xferMode(other.m_xferMode) 81 , m_xferMode(other.m_xferMode)
81 , m_colorFilter(other.m_colorFilter) 82 , m_colorFilter(other.m_colorFilter)
82 , m_compositeOperator(other.m_compositeOperator) 83 , m_compositeOperator(other.m_compositeOperator)
83 , m_blendMode(other.m_blendMode) 84 , m_blendMode(other.m_blendMode)
84 , m_interpolationQuality(other.m_interpolationQuality) 85 , m_interpolationQuality(other.m_interpolationQuality)
85 , m_shouldAntialias(other.m_shouldAntialias) 86 , m_shouldAntialias(other.m_shouldAntialias)
86 , m_shouldSmoothFonts(other.m_shouldSmoothFonts) 87 , m_shouldSmoothFonts(other.m_shouldSmoothFonts)
87 , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect) 88 , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect)
89 , m_drawLuminanceMask(other.m_drawLuminanceMask)
88 { 90 {
89 } 91 }
90 92
91 // Helper function for applying the state's alpha value to the given input 93 // Helper function for applying the state's alpha value to the given input
92 // color to produce a new output color. 94 // color to produce a new output color.
93 SkColor applyAlpha(SkColor c) const 95 SkColor applyAlpha(SkColor c) const
94 { 96 {
95 int s = roundf(m_alpha * 256); 97 int s = roundf(m_alpha * 256);
96 if (s >= 256) 98 if (s >= 256)
97 return c; 99 return c;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Compositing control, for the CSS and Canvas compositing spec. 133 // Compositing control, for the CSS and Canvas compositing spec.
132 CompositeOperator m_compositeOperator; 134 CompositeOperator m_compositeOperator;
133 BlendMode m_blendMode; 135 BlendMode m_blendMode;
134 136
135 // Image interpolation control. 137 // Image interpolation control.
136 InterpolationQuality m_interpolationQuality; 138 InterpolationQuality m_interpolationQuality;
137 139
138 bool m_shouldAntialias : 1; 140 bool m_shouldAntialias : 1;
139 bool m_shouldSmoothFonts : 1; 141 bool m_shouldSmoothFonts : 1;
140 bool m_shouldClampToSourceRect : 1; 142 bool m_shouldClampToSourceRect : 1;
143 bool m_drawLuminanceMask : 1;
141 }; 144 };
142 145
143 } // namespace WebCore 146 } // namespace WebCore
144 147
145 #endif // GraphicsContextState_h 148 #endif // GraphicsContextState_h
146 149
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698