Changeset 53318 in webkit
- Timestamp:
- Jan 14, 2010 9:10:59 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r53315 r53318 1 2010-01-14 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 <rdar://problem/6020083> -webkit-gradient slows down scrolling when page has horizontal scrollbar 6 https://bugs.webkit.org/show_bug.cgi?id=19650 7 8 * platform/graphics/GeneratedImage.cpp: 9 (WebCore::GeneratedImage::drawPattern): Added call to adjustParametersForTiledDrawing(), 10 letting the generator substitute the parameters with visually-equivalent values that 11 are more efficient. 12 * platform/graphics/Generator.h: 13 (WebCore::Generator::adjustParametersForTiledDrawing): Added a base class implementation 14 that does nothing. 15 * platform/graphics/Gradient.cpp: 16 (WebCore::Gradient::adjustParametersForTiledDrawing): Added. If the gradient is a horizontal 17 or vertical linear gradient, changes to use a 1-pixel tall (or wide) tile. 18 * platform/graphics/Gradient.h: 19 1 20 2010-01-14 Norbert Leser <norbert.leser@nokia.com> 2 21 -
trunk/WebCore/platform/graphics/GeneratedImage.cpp
r52229 r53318 1 1 /* 2 * Copyright (C) 2008 Apple Computer, Inc.All rights reserved.2 * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 23 * THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 … … 51 51 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect) 52 52 { 53 // Allow the generator to provide visually-equivalent tiling parameters for better performance. 54 IntSize adjustedSize = m_size; 55 FloatRect adjustedSrcRect = srcRect; 56 m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect); 57 53 58 // Create a BitmapImage and call drawPattern on it. 54 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create( m_size);59 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(adjustedSize); 55 60 ASSERT(imageBuffer.get()); 56 61 57 62 // Fill with the gradient. 58 63 GraphicsContext* graphicsContext = imageBuffer->context(); 59 graphicsContext->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get());60 64 graphicsContext->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_generator.get()); 65 61 66 // Grab the final image from the image buffer. 62 67 Image* bitmap = imageBuffer->image(); 63 68 64 69 // Now just call drawTiled on that image. 65 bitmap->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);70 bitmap->drawPattern(context, adjustedSrcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect); 66 71 } 67 72 -
trunk/WebCore/platform/graphics/Generator.h
r35966 r53318 39 39 40 40 virtual void fill(GraphicsContext*, const FloatRect&) = 0; 41 virtual void adjustParametersForTiledDrawing(IntSize& /* size */, FloatRect& /* srcRect */) { } 41 42 }; 42 43 -
trunk/WebCore/platform/graphics/Gradient.cpp
r46017 r53318 1 1 /* 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 4 * … … 29 29 30 30 #include "Color.h" 31 #include "FloatRect.h" 32 #include <wtf/UnusedParam.h> 31 33 32 34 namespace WebCore { … … 61 63 { 62 64 platformDestroy(); 65 } 66 67 void Gradient::adjustParametersForTiledDrawing(IntSize& size, FloatRect& srcRect) 68 { 69 if (m_radial) 70 return; 71 72 if (srcRect.isEmpty()) 73 return; 74 75 if (m_p0.x() == m_p1.x()) { 76 size.setWidth(1); 77 srcRect.setWidth(1); 78 srcRect.setX(0); 79 return; 80 } 81 if (m_p0.y() != m_p1.y()) 82 return; 83 84 size.setHeight(1); 85 srcRect.setHeight(1); 86 srcRect.setY(0); 63 87 } 64 88 -
trunk/WebCore/platform/graphics/Gradient.h
r52791 r53318 106 106 107 107 virtual void fill(GraphicsContext*, const FloatRect&); 108 virtual void adjustParametersForTiledDrawing(IntSize& size, FloatRect& srcRect); 109 108 110 void setPlatformGradientSpaceTransform(const TransformationMatrix& gradientSpaceTransformation); 109 111
Note: See TracChangeset
for help on using the changeset viewer.