| OLD | NEW |
| 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 18 matching lines...) Expand all Loading... |
| 29 #ifndef GraphicsContextState_h | 29 #ifndef GraphicsContextState_h |
| 30 #define GraphicsContextState_h | 30 #define GraphicsContextState_h |
| 31 | 31 |
| 32 #include "core/platform/graphics/ColorSpace.h" | 32 #include "core/platform/graphics/ColorSpace.h" |
| 33 #include "core/platform/graphics/Gradient.h" | 33 #include "core/platform/graphics/Gradient.h" |
| 34 #include "core/platform/graphics/GraphicsTypes.h" | 34 #include "core/platform/graphics/GraphicsTypes.h" |
| 35 #include "core/platform/graphics/Path.h" | 35 #include "core/platform/graphics/Path.h" |
| 36 #include "core/platform/graphics/Pattern.h" | 36 #include "core/platform/graphics/Pattern.h" |
| 37 | 37 |
| 38 #include "third_party/skia/include/core/SkColorPriv.h" | 38 #include "third_party/skia/include/core/SkColorPriv.h" |
| 39 #include "third_party/skia/include/core/SkDrawLooper.h" |
| 39 #include "third_party/skia/include/effects/SkDashPathEffect.h" | 40 #include "third_party/skia/include/effects/SkDashPathEffect.h" |
| 40 | 41 |
| 41 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
| 42 | 43 |
| 43 namespace WebCore { | 44 namespace WebCore { |
| 44 | 45 |
| 45 // Encapsulates the state information we store for each pushed graphics state. | 46 // Encapsulates the state information we store for each pushed graphics state. |
| 46 // Only GraphicsContext can use this class. | 47 // Only GraphicsContext can use this class. |
| 47 class GraphicsContextState { | 48 class GraphicsContextState { |
| 48 public: | 49 public: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 63 , m_strokeColorSpace(ColorSpaceDeviceRGB) | 64 , m_strokeColorSpace(ColorSpaceDeviceRGB) |
| 64 , m_dashRatio(3) | 65 , m_dashRatio(3) |
| 65 , m_miterLimit(4) | 66 , m_miterLimit(4) |
| 66 , m_lineCap(SkPaint::kDefault_Cap) | 67 , m_lineCap(SkPaint::kDefault_Cap) |
| 67 , m_lineJoin(SkPaint::kDefault_Join) | 68 , m_lineJoin(SkPaint::kDefault_Join) |
| 68 , m_dash(0) | 69 , m_dash(0) |
| 69 , m_fillColor(Color::black) | 70 , m_fillColor(Color::black) |
| 70 , m_fillColorPacked(0xFF000000) | 71 , m_fillColorPacked(0xFF000000) |
| 71 , m_fillColorSpace(ColorSpaceDeviceRGB) | 72 , m_fillColorSpace(ColorSpaceDeviceRGB) |
| 72 , m_fillRule(RULE_NONZERO) | 73 , m_fillRule(RULE_NONZERO) |
| 73 , m_shadowBlur(0) | 74 , m_looper(0) |
| 74 , m_shadowColorSpace(ColorSpaceDeviceRGB) | |
| 75 , m_textDrawingMode(TextModeFill) | 75 , m_textDrawingMode(TextModeFill) |
| 76 , m_alpha(1) | 76 , m_alpha(1) |
| 77 , m_xferMode(SkXfermode::kSrcOver_Mode) | 77 , m_xferMode(SkXfermode::kSrcOver_Mode) |
| 78 , m_looper(0) | |
| 79 , m_compositeOperator(CompositeSourceOver) | 78 , m_compositeOperator(CompositeSourceOver) |
| 80 , m_blendMode(BlendModeNormal) | 79 , m_blendMode(BlendModeNormal) |
| 81 , m_clip(SkRect::MakeEmpty()) | 80 , m_clip(SkRect::MakeEmpty()) |
| 82 #if USE(LOW_QUALITY_IMAGE_INTERPOLATION) | 81 #if USE(LOW_QUALITY_IMAGE_INTERPOLATION) |
| 83 , m_interpolationQuality(InterpolationLow) | 82 , m_interpolationQuality(InterpolationLow) |
| 84 #else | 83 #else |
| 85 , m_interpolationQuality(InterpolationHigh) | 84 , m_interpolationQuality(InterpolationHigh) |
| 86 #endif | 85 #endif |
| 87 , m_shouldAntialias(true) | 86 , m_shouldAntialias(true) |
| 88 , m_shouldSmoothFonts(true) | 87 , m_shouldSmoothFonts(true) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 102 , m_miterLimit(other.m_miterLimit) | 101 , m_miterLimit(other.m_miterLimit) |
| 103 , m_lineCap(other.m_lineCap) | 102 , m_lineCap(other.m_lineCap) |
| 104 , m_lineJoin(other.m_lineJoin) | 103 , m_lineJoin(other.m_lineJoin) |
| 105 , m_dash(other.m_dash) | 104 , m_dash(other.m_dash) |
| 106 , m_fillColor(other.m_fillColor) | 105 , m_fillColor(other.m_fillColor) |
| 107 , m_fillColorPacked(other.m_fillColorPacked) | 106 , m_fillColorPacked(other.m_fillColorPacked) |
| 108 , m_fillColorSpace(other.m_fillColorSpace) | 107 , m_fillColorSpace(other.m_fillColorSpace) |
| 109 , m_fillRule(other.m_fillRule) | 108 , m_fillRule(other.m_fillRule) |
| 110 , m_fillGradient(other.m_fillGradient) | 109 , m_fillGradient(other.m_fillGradient) |
| 111 , m_fillPattern(other.m_fillPattern) | 110 , m_fillPattern(other.m_fillPattern) |
| 112 , m_shadowBlur(other.m_shadowBlur) | 111 , m_looper(other.m_looper) |
| 113 , m_shadowColor(other.m_shadowColor) | |
| 114 , m_shadowOffset(other.m_shadowOffset) | |
| 115 , m_shadowColorSpace(other.m_shadowColorSpace) | |
| 116 , m_textDrawingMode(other.m_textDrawingMode) | 112 , m_textDrawingMode(other.m_textDrawingMode) |
| 117 , m_alpha(other.m_alpha) | 113 , m_alpha(other.m_alpha) |
| 118 , m_xferMode(other.m_xferMode) | 114 , m_xferMode(other.m_xferMode) |
| 119 , m_looper(other.m_looper) | |
| 120 , m_compositeOperator(other.m_compositeOperator) | 115 , m_compositeOperator(other.m_compositeOperator) |
| 121 , m_blendMode(other.m_blendMode) | 116 , m_blendMode(other.m_blendMode) |
| 122 , m_imageBufferClip(other.m_imageBufferClip) | 117 , m_imageBufferClip(other.m_imageBufferClip) |
| 123 , m_clip(other.m_clip) | 118 , m_clip(other.m_clip) |
| 124 , m_interpolationQuality(other.m_interpolationQuality) | 119 , m_interpolationQuality(other.m_interpolationQuality) |
| 125 , m_shouldAntialias(other.m_shouldAntialias) | 120 , m_shouldAntialias(other.m_shouldAntialias) |
| 126 , m_shouldSmoothFonts(other.m_shouldSmoothFonts) | 121 , m_shouldSmoothFonts(other.m_shouldSmoothFonts) |
| 127 , m_shadowsIgnoreTransforms(other.m_shadowsIgnoreTransforms) | 122 , m_shadowsIgnoreTransforms(other.m_shadowsIgnoreTransforms) |
| 128 { | 123 { |
| 129 // Up the ref count of these. SkSafeRef does nothing if its argument is
0. | 124 // Up the ref count of these. SkSafeRef does nothing if its argument is
0. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 SkDashPathEffect* m_dash; | 165 SkDashPathEffect* m_dash; |
| 171 | 166 |
| 172 // Fill. | 167 // Fill. |
| 173 Color m_fillColor; | 168 Color m_fillColor; |
| 174 SkColor m_fillColorPacked; | 169 SkColor m_fillColorPacked; |
| 175 ColorSpace m_fillColorSpace; | 170 ColorSpace m_fillColorSpace; |
| 176 WindRule m_fillRule; | 171 WindRule m_fillRule; |
| 177 RefPtr<Gradient> m_fillGradient; | 172 RefPtr<Gradient> m_fillGradient; |
| 178 RefPtr<Pattern> m_fillPattern; | 173 RefPtr<Pattern> m_fillPattern; |
| 179 | 174 |
| 180 // Shadow. | 175 // Shadow. (This will need tweaking if we use draw loopers for other things.
) |
| 181 float m_shadowBlur; | 176 SkDrawLooper* m_looper; |
| 182 Color m_shadowColor; | |
| 183 FloatSize m_shadowOffset; | |
| 184 ColorSpace m_shadowColorSpace; | |
| 185 | 177 |
| 186 // Text. (See TextModeFill & friends.) | 178 // Text. (See TextModeFill & friends.) |
| 187 TextDrawingModeFlags m_textDrawingMode; | 179 TextDrawingModeFlags m_textDrawingMode; |
| 188 | 180 |
| 189 // Common shader state. | 181 // Common shader state. |
| 190 float m_alpha; | 182 float m_alpha; |
| 191 SkXfermode::Mode m_xferMode; | 183 SkXfermode::Mode m_xferMode; |
| 192 SkDrawLooper* m_looper; | |
| 193 | 184 |
| 194 // Compositing control, for the CSS and Canvas compositing spec. | 185 // Compositing control, for the CSS and Canvas compositing spec. |
| 195 CompositeOperator m_compositeOperator; | 186 CompositeOperator m_compositeOperator; |
| 196 BlendMode m_blendMode; | 187 BlendMode m_blendMode; |
| 197 | 188 |
| 198 // If non-empty, the current State is clipped to this image. | 189 // If non-empty, the current State is clipped to this image. |
| 199 SkBitmap m_imageBufferClip; | 190 SkBitmap m_imageBufferClip; |
| 200 | 191 |
| 201 // If m_imageBufferClip is non-empty, this is the region the image is clippe
d to. | 192 // If m_imageBufferClip is non-empty, this is the region the image is clippe
d to. |
| 202 SkRect m_clip; | 193 SkRect m_clip; |
| 203 | 194 |
| 204 // Image interpolation control. | 195 // Image interpolation control. |
| 205 InterpolationQuality m_interpolationQuality; | 196 InterpolationQuality m_interpolationQuality; |
| 206 | 197 |
| 207 bool m_shouldAntialias : 1; | 198 bool m_shouldAntialias : 1; |
| 208 bool m_shouldSmoothFonts : 1; | 199 bool m_shouldSmoothFonts : 1; |
| 209 bool m_shadowsIgnoreTransforms : 1; | 200 bool m_shadowsIgnoreTransforms : 1; |
| 210 }; | 201 }; |
| 211 | 202 |
| 212 } // namespace WebCore | 203 } // namespace WebCore |
| 213 | 204 |
| 214 #endif // GraphicsContextState_h | 205 #endif // GraphicsContextState_h |
| 215 | 206 |
| OLD | NEW |