diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
commit | 635860845790a19bf50bbc51ba8fb66a96dde068 (patch) | |
tree | ef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp | |
parent | 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff) | |
download | external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2 |
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp')
-rw-r--r-- | WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp b/WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp deleted file mode 100644 index 86530bc..0000000 --- a/WebCore/svg/graphics/cairo/SVGPaintServerPatternCairo.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2007 Alp Toker <alp@atoker.com> - * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#if ENABLE(SVG) -#include "SVGPaintServerPattern.h" - -#include "GraphicsContext.h" -#include "Image.h" -#include "ImageBuffer.h" -#include "RenderObject.h" -#include "SVGPatternElement.h" - -#include <wtf/OwnArrayPtr.h> - -namespace WebCore { - -bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const -{ - FloatRect targetRect = object->relativeBBox(false); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - RenderStyle* style = object->style(); - - float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(object, svgStyle->strokeWidth(), 1.0f); - - if (targetRect.width() == 0) - targetRect = FloatRect(targetRect.x(), targetRect.y(), strokeWidth, targetRect.height()); - if (targetRect.height() == 0) - targetRect = FloatRect(targetRect.x(), targetRect.y(), targetRect.width(), strokeWidth); - - m_ownerElement->buildPattern(targetRect); - - cairo_surface_t* image = tile()->image()->nativeImageForCurrentFrame(); - if (!image) - return false; - - cairo_t* cr = context->platformContext(); - - cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image); - cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); - - cairo_pattern_set_filter(pattern, CAIRO_FILTER_BEST); - cairo_matrix_t pattern_matrix = patternTransform(); - cairo_matrix_t matrix = {1, 0, 0, 1, patternBoundaries().x(), patternBoundaries().y()}; - cairo_matrix_multiply(&matrix, &matrix, &pattern_matrix); - cairo_matrix_invert(&matrix); - cairo_pattern_set_matrix(pattern, &matrix); - - if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) - context->setFillRule(svgStyle->fillRule()); - - if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) - applyStrokeStyleToContext(context, style, object); - - cairo_set_source(cr, pattern); - cairo_pattern_destroy(pattern); - - return true; -} - -} // namespace WebCore - -#endif |