Changeset 69187 in webkit
- Timestamp:
- Oct 6, 2010 5:47:28 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69186 r69187 1 2010-10-06 Dirk Schulze <krit@webkit.org> 2 3 Unreviewed fix of Cairo ports. 4 5 SVGs with filters look grainy when scaled 6 https://bugs.webkit.org/show_bug.cgi?id=5526 7 8 Fixed issues on Cairos shadow implementation after the changes to FilterEffects. 9 Cairo calculates the inflation of the effect rect itself. Respect this for FEGaussianBlur. 10 This is just a temporary solution, since Cairo and Qt will use ContextShadow soon. 11 12 * platform/graphics/GraphicsContext.h: 13 * platform/graphics/cairo/GraphicsContextCairo.cpp: 14 (WebCore::drawBorderlessRectShadow): 15 (WebCore::GraphicsContext::applyPlatformShadow): 16 (WebCore::GraphicsContext::createShadowMask): 17 (WebCore::GraphicsContext::drawTiledShadow): 18 (WebCore::GraphicsContext::fillRoundedRect): 19 * platform/graphics/filters/ImageBufferFilter.cpp: 20 (WebCore::ImageBufferFilter::ImageBufferFilter): 21 (WebCore::ImageBufferFilter::create): 22 * platform/graphics/filters/ImageBufferFilter.h: 23 (WebCore::ImageBufferFilter::filterRegion): 24 (WebCore::ImageBufferFilter::sourceImageRect): 25 1 26 2010-10-06 Nikolas Zimmermann <nzimmermann@rim.com> 2 27 -
trunk/WebCore/platform/graphics/GraphicsContext.h
r68221 r69187 299 299 #if PLATFORM(CAIRO) 300 300 float getAlpha(); 301 void applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, constFloatRect& shadowRect, float radius);302 PlatformRefPtr<cairo_surface_t> createShadowMask(PassOwnPtr<ImageBuffer>, constFloatRect&, float radius);301 void applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, FloatRect& shadowRect, float radius); 302 PlatformRefPtr<cairo_surface_t> createShadowMask(PassOwnPtr<ImageBuffer>, FloatRect&, float radius); 303 303 304 304 static void calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& radius, const FloatRect& sourceRect, const FloatSize& shadowOffset, float shadowBlur); -
trunk/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r69181 r69187 611 611 return; 612 612 613 AffineTransform transform = context->getCTM();614 // drawTiledShadow still does not work with rotations.615 if ((transform.isIdentityOrTranslationOrFlipped())) {616 cairo_t* cr = context->platformContext();617 cairo_save(cr);618 appendWebCorePathToCairoContext(cr, Path::createRectangle(rect));619 FloatSize corner;620 IntRect shadowRect(rect);621 context->drawTiledShadow(shadowRect, corner, corner, corner, corner, DeviceColorSpace);622 cairo_restore(cr);623 624 return;625 }626 627 613 IntSize shadowBufferSize; 628 614 FloatRect shadowRect; … … 921 907 } 922 908 923 void GraphicsContext::applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, constFloatRect& shadowRect, float radius)909 void GraphicsContext::applyPlatformShadow(PassOwnPtr<ImageBuffer> buffer, const Color& shadowColor, FloatRect& shadowRect, float radius) 924 910 { 925 911 #if ENABLE(FILTERS) … … 930 916 } 931 917 932 PlatformRefPtr<cairo_surface_t> GraphicsContext::createShadowMask(PassOwnPtr<ImageBuffer> buffer, constFloatRect& shadowRect, float radius)918 PlatformRefPtr<cairo_surface_t> GraphicsContext::createShadowMask(PassOwnPtr<ImageBuffer> buffer, FloatRect& shadowRect, float radius) 933 919 { 934 920 #if ENABLE(FILTERS) … … 942 928 943 929 // create filter 944 RefPtr<Filter> filter = ImageBufferFilter::create(); 930 IntRect filterRegion = IntRect(IntPoint(), roundedIntSize(shadowRect.size())); 931 RefPtr<Filter> filter = ImageBufferFilter::create(filterRegion); 945 932 filter->setSourceImage(buffer); 946 933 RefPtr<FilterEffect> source = SourceGraphic::create(); 947 source->setAbsolutePaintRect(IntRect(IntPoint(), roundedIntSize(shadowRect.size())));948 934 source->setIsAlphaImage(true); 949 935 RefPtr<FilterEffect> blur = FEGaussianBlur::create(stdDeviation, stdDeviation); 936 blur->setMaxEffectRect(filterRegion); 950 937 FilterEffectVector& inputEffects = blur->inputEffects(); 951 938 inputEffects.append(source.get()); 952 blur->setAbsolutePaintRect(IntRect(IntPoint(), roundedIntSize(shadowRect.size())));953 939 blur->apply(filter.get()); 940 941 // Calculate shadow region for context 942 shadowRect.move(blur->absolutePaintRect().location().x(), blur->absolutePaintRect().location().y()); 943 shadowRect.setSize(blur->absolutePaintRect().size()); 954 944 return blur->resultImage()->m_data.m_surface; 955 945 #endif … … 1281 1271 return; 1282 1272 1283 IntRect smallRect = IntRect(blurRadius, blurRadius, smallBufferSize.width() - radiusTwice, smallBufferSize.height() - radiusTwice);1273 FloatRect smallRect = FloatRect(blurRadius, blurRadius, smallBufferSize.width() - radiusTwice, smallBufferSize.height() - radiusTwice); 1284 1274 1285 1275 // Draw shadow into a new ImageBuffer. … … 1386 1376 appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight)); 1387 1377 setColor(cr, color); 1388 AffineTransform transform = this->getCTM(); 1389 // drawTiledShadow still does not work with rotations. 1390 if (transform.isIdentityOrTranslationOrFlipped()) 1391 drawTiledShadow(r, topLeft, topRight, bottomLeft, bottomRight, colorSpace); 1392 else 1393 drawPathShadow(this, m_common, true, false); 1378 drawPathShadow(this, m_common, true, false); 1394 1379 cairo_fill(cr); 1395 1380 cairo_restore(cr); -
trunk/WebCore/platform/graphics/filters/ImageBufferFilter.cpp
r67929 r69187 28 28 namespace WebCore { 29 29 30 ImageBufferFilter::ImageBufferFilter( )30 ImageBufferFilter::ImageBufferFilter(const FloatRect& sourceImageRect) 31 31 : Filter() 32 , m_sourceImageRect(sourceImageRect) 32 33 { 33 setFilterResolution(FloatSize(1 .f, 1.f));34 setFilterResolution(FloatSize(1, 1)); 34 35 } 35 36 36 PassRefPtr<ImageBufferFilter> ImageBufferFilter::create( )37 PassRefPtr<ImageBufferFilter> ImageBufferFilter::create(const FloatRect& sourceImageRect) 37 38 { 38 return adoptRef(new ImageBufferFilter( ));39 return adoptRef(new ImageBufferFilter(sourceImageRect)); 39 40 } 40 41 -
trunk/WebCore/platform/graphics/filters/ImageBufferFilter.h
r67929 r69187 36 36 class ImageBufferFilter : public Filter { 37 37 public: 38 static PassRefPtr<ImageBufferFilter> create( );38 static PassRefPtr<ImageBufferFilter> create(const FloatRect&); 39 39 40 virtual FloatRect filterRegion() const { return FloatRect(); }41 virtual FloatRect sourceImageRect() const { return FloatRect(); }40 virtual FloatRect filterRegion() const { return m_sourceImageRect; } 41 virtual FloatRect sourceImageRect() const { return m_sourceImageRect; } 42 42 43 43 // SVG specific … … 48 48 49 49 private: 50 ImageBufferFilter(); 50 ImageBufferFilter(const FloatRect&); 51 52 FloatRect m_sourceImageRect; 51 53 }; 52 54
Note: See TracChangeset
for help on using the changeset viewer.