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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceFilter.cpp

Issue 150973004: Fixes the rendering of a SVG filter (e.g. feFlood) by testing against total (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added rebaseline test. Created 6 years, 10 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 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur rentValue()->enumValue(), targetBoundingBox)); 102 effect->setEffectBoundaries(SVGLengthContext::resolveRectangle<SVGFilter PrimitiveStandardAttributes>(effectElement, filterElement->primitiveUnits()->cur rentValue()->enumValue(), targetBoundingBox));
103 effect->setOperatingColorSpace( 103 effect->setOperatingColorSpace(
104 effectElement->renderer()->style()->svgStyle()->colorInterpolationFi lters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB); 104 effectElement->renderer()->style()->svgStyle()->colorInterpolationFi lters() == CI_LINEARRGB ? ColorSpaceLinearRGB : ColorSpaceDeviceRGB);
105 builder->add(AtomicString(effectElement->result()->currentValue()->value ()), effect); 105 builder->add(AtomicString(effectElement->result()->currentValue()->value ()), effect);
106 } 106 }
107 return builder.release(); 107 return builder.release();
108 } 108 }
109 109
110 bool RenderSVGResourceFilter::fitsInMaximumImageSize(const FloatSize& size, Floa tSize& scale) 110 bool RenderSVGResourceFilter::fitsInMaximumImageSize(const FloatSize& size, Floa tSize& scale)
111 { 111 {
112 bool matchesFilterSize = true; 112 FloatSize scaledSize(size);
113 if (size.width() * scale.width() > kMaxFilterSize) { 113 scaledSize.scale(scale.width(), scale.height());
114 scale.setWidth(kMaxFilterSize / size.width()); 114 float scaledArea = scaledSize.width() * scaledSize.height();
115 matchesFilterSize = false;
116 }
117 if (size.height() * scale.height() > kMaxFilterSize) {
118 scale.setHeight(kMaxFilterSize / size.height());
119 matchesFilterSize = false;
120 }
121 115
122 return matchesFilterSize; 116 if (scaledArea <= FilterEffect::maxFilterArea())
117 return true;
118
119 // If area of scaled size is bigger than the upper limit, adjust the scale
120 // to fit.
121 scale.scale(sqrt(FilterEffect::maxFilterArea() / scaledArea));
122 return false;
123 } 123 }
124 124
125 static bool createImageBuffer(const Filter* filter, OwnPtr<ImageBuffer>& imageBu ffer, bool accelerated) 125 static bool createImageBuffer(const Filter* filter, OwnPtr<ImageBuffer>& imageBu ffer, bool accelerated)
126 { 126 {
127 IntRect paintRect = filter->sourceImageRect(); 127 IntRect paintRect = filter->sourceImageRect();
128 // Don't create empty ImageBuffers. 128 // Don't create empty ImageBuffers.
129 if (paintRect.isEmpty()) 129 if (paintRect.isEmpty())
130 return false; 130 return false;
131 131
132 OwnPtr<ImageBufferSurface> surface; 132 OwnPtr<ImageBufferSurface> surface;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 markAllClientLayersForInvalidation(); 409 markAllClientLayersForInvalidation();
410 } 410 }
411 411
412 FloatRect RenderSVGResourceFilter::drawingRegion(RenderObject* object) const 412 FloatRect RenderSVGResourceFilter::drawingRegion(RenderObject* object) const
413 { 413 {
414 FilterData* filterData = m_filter.get(object); 414 FilterData* filterData = m_filter.get(object);
415 return filterData ? filterData->drawingRegion : FloatRect(); 415 return filterData ? filterData->drawingRegion : FloatRect();
416 } 416 }
417 417
418 } 418 }
OLDNEW
« no previous file with comments | « Source/core/rendering/FilterEffectRenderer.cpp ('k') | Source/platform/graphics/filters/FilterEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698