| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * |
| 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are |
| 6 * met: |
| 7 * |
| 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. |
| 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ |
| 30 |
| 31 #include "config.h" |
| 32 #include "core/platform/graphics/GraphicsContextState.h" |
| 33 |
| 34 #include "core/platform/graphics/Gradient.h" |
| 35 #include "core/platform/graphics/Pattern.h" |
| 36 |
| 37 namespace WebCore { |
| 38 |
| 39 GraphicsContextState::GraphicsContextState() |
| 40 : m_fillColor(Color::black) |
| 41 , m_fillRule(RULE_NONZERO) |
| 42 , m_looper(0) |
| 43 , m_textDrawingMode(TextModeFill) |
| 44 , m_alpha(1) |
| 45 , m_xferMode(SkXfermode::kSrcOver_Mode) |
| 46 , m_compositeOperator(CompositeSourceOver) |
| 47 , m_blendMode(BlendModeNormal) |
| 48 , m_clip(SkRect::MakeEmpty()) |
| 49 #if USE(LOW_QUALITY_IMAGE_INTERPOLATION) |
| 50 , m_interpolationQuality(InterpolationLow) |
| 51 #else |
| 52 , m_interpolationQuality(InterpolationHigh) |
| 53 #endif |
| 54 , m_shouldAntialias(true) |
| 55 , m_shouldSmoothFonts(true) |
| 56 { |
| 57 } |
| 58 |
| 59 GraphicsContextState::GraphicsContextState(const GraphicsContextState& other) |
| 60 : m_strokeData(other.m_strokeData) |
| 61 , m_fillColor(other.m_fillColor) |
| 62 , m_fillRule(other.m_fillRule) |
| 63 , m_fillGradient(other.m_fillGradient) |
| 64 , m_fillPattern(other.m_fillPattern) |
| 65 , m_looper(other.m_looper) |
| 66 , m_textDrawingMode(other.m_textDrawingMode) |
| 67 , m_alpha(other.m_alpha) |
| 68 , m_xferMode(other.m_xferMode) |
| 69 , m_compositeOperator(other.m_compositeOperator) |
| 70 , m_blendMode(other.m_blendMode) |
| 71 , m_imageBufferClip(other.m_imageBufferClip) |
| 72 , m_clip(other.m_clip) |
| 73 , m_interpolationQuality(other.m_interpolationQuality) |
| 74 , m_shouldAntialias(other.m_shouldAntialias) |
| 75 , m_shouldSmoothFonts(other.m_shouldSmoothFonts) |
| 76 { |
| 77 // Up the ref count of these. SkSafeRef does nothing if its argument is 0. |
| 78 SkSafeRef(m_looper); |
| 79 |
| 80 // The clip image only needs to be applied once. Reset the image so that we |
| 81 // don't attempt to clip multiple times. |
| 82 m_imageBufferClip.reset(); |
| 83 } |
| 84 |
| 85 GraphicsContextState::~GraphicsContextState() |
| 86 { |
| 87 SkSafeUnref(m_looper); |
| 88 } |
| 89 |
| 90 } // namespace WebCore |
| OLD | NEW |