Changeset 37006 in webkit
- Timestamp:
- Sep 27, 2008 2:06:35 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r37005 r37006 1 2008-09-22 Dirk Schulze <vbs85@gmx.de> 2 3 Reviewed by Eric Seidel. 4 5 Added SVG pattern support to Qt. 6 7 [Qt] SVG patterns are missing 8 https://bugs.webkit.org/show_bug.cgi?id=20973 9 10 * svg/graphics/qt/SVGPaintServerPatternQt.cpp: 11 (WebCore::SVGPaintServerPattern::setup): 12 1 13 2008-09-27 Keishi Hattori <casey.hattori@gmail.com> 2 14 -
trunk/WebCore/svg/graphics/qt/SVGPaintServerPatternQt.cpp
r29663 r37006 1 1 /* 2 2 Copyright (C) 2006 Nikolas Zimmermann <wildfox@kde.org> 3 4 This file is part of the KDE project 3 Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> 5 4 6 5 This library is free software; you can redistribute it and/or … … 25 24 #include "SVGPaintServerPattern.h" 26 25 26 #include "AffineTransform.h" 27 #include "GraphicsContext.h" 28 #include "ImageBuffer.h" 29 #include "Pattern.h" 30 #include "RenderObject.h" 31 #include "SVGPatternElement.h" 32 33 #include <QPainter> 34 #include <QPainterPath> 35 27 36 namespace WebCore { 28 37 29 38 bool SVGPaintServerPattern::setup(GraphicsContext*& context, const RenderObject* object, SVGPaintTargetType type, bool isPaintingText) const 30 39 { 31 // FIXME: Reactivate old pattern code32 33 /*34 40 QPainter* painter(context ? context->platformContext() : 0); 35 41 Q_ASSERT(painter); 36 42 37 QPainterPath* _path = static_cast<QPainterPath*>(qtContext->path());38 Q_ASSERT( _path != 0);43 QPainterPath* path(context ? context->currentPath() : 0); 44 Q_ASSERT(path); 39 45 40 RenderStyle* renderStyle = object->style(); 46 RenderStyle* style = object ? object->style() : 0; 47 const SVGRenderStyle* svgStyle = object ? object->style()->svgStyle() : 0; 48 49 FloatRect targetRect = object->relativeBBox(false); 50 m_ownerElement->buildPattern(targetRect); 51 52 if (!tile()) 53 return false; 54 55 RefPtr<Pattern> pattern = Pattern::create(tile()->image(), true, true); 41 56 42 57 painter->setPen(Qt::NoPen); 43 58 painter->setBrush(Qt::NoBrush); 44 QImage* patternimage = new QImage(tile()->bits(), tile()->width(), tile()->height(), QImage::Format_ARGB32_Premultiplied); 45 patternimage->setAlphaBuffer(true); 46 if (type & APPLY_TO_FILL) { 47 //QColor c = color(); 48 //c.setAlphaF(style->fillPainter()->opacity() * style->opacity() * opacity()); 49 KRenderingFillPainter fillPainter = KSVGPainterFactory::fillPainter(renderStyle, object); 50 QBrush brush(QPixmap::fromImage(*patternimage)); 51 _path->setFillRule(fillPainter.fillRule() == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill); 59 60 AffineTransform affine; 61 affine.translate(patternBoundaries().x(), patternBoundaries().y()); 62 affine.multiply(patternTransform()); 63 64 QBrush brush(pattern->createPlatformPattern(affine)); 65 if ((type & ApplyToFillTargetType) && svgStyle->hasFill()) { 52 66 painter->setBrush(brush); 67 context->setFillRule(svgStyle->fillRule()); 53 68 } 54 if (type & APPLY_TO_STROKE) {55 //QColor c = color();56 //c.setAlphaF(style->strokePainter()->opacity() * style->opacity() * opacity());57 KRenderingStrokePainter strokePainter = KSVGPainterFactory::strokePainter(renderStyle, object);58 69 70 if ((type & ApplyToStrokeTargetType) && svgStyle->hasStroke()) { 59 71 QPen pen; 60 QBrush brush(QPixmap::fromImage(*patternimage));61 62 setPenProperties(strokePainter, pen);63 72 pen.setBrush(brush); 64 73 painter->setPen(pen); 74 applyStrokeStyleToContext(context, style, object); 65 75 } 66 67 painter->drawPath(*_path);68 69 delete patternimage;70 */71 76 72 77 return true;
Note: See TracChangeset
for help on using the changeset viewer.