OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 scaledSrc.setSize(adjustedSrcSize); | 137 scaledSrc.setSize(adjustedSrcSize); |
138 | 138 |
139 draw(context, dstRect, scaledSrc, colorSpace, compositeOp, blendMode); | 139 draw(context, dstRect, scaledSrc, colorSpace, compositeOp, blendMode); |
140 | 140 |
141 setImageObserver(observer); | 141 setImageObserver(observer); |
142 } | 142 } |
143 | 143 |
144 void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
containerSize, float pageScale, float zoom, const FloatRect& srcRect, | 144 void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
containerSize, float pageScale, float zoom, const FloatRect& srcRect, |
145 const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace
colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect) | 145 const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace
colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect) |
146 { | 146 { |
147 FloatSize zoomedContainerSize(containerSize); | 147 ASSERT(pageScale); |
148 zoomedContainerSize.scale(zoom); | |
149 FloatRect zoomedContainerRect = FloatRect(FloatPoint(), zoomedContainerSize)
; | |
150 | 148 |
151 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(expandedIntSize(zoomedConta
inerSize), pageScale); | 149 FloatRect zoomedContainerRect = FloatRect(FloatPoint(), containerSize); |
152 drawForContainer(buffer->context(), containerSize, zoom, zoomedContainerRect
, zoomedContainerRect, ColorSpaceDeviceRGB, CompositeSourceOver, BlendModeNormal
); | 150 zoomedContainerRect.scale(zoom); |
| 151 FloatRect zoomedAndScaledContainerRect = zoomedContainerRect; |
| 152 zoomedAndScaledContainerRect.scale(pageScale); |
153 | 153 |
154 RefPtr<Image> image = buffer->copyImage(CopyBackingStore); | 154 // FIXME(WK110065): This should take advantage of the ImageBuffer resolution
instead of scaling the buffer manually. |
155 image->drawPattern(context, srcRect, patternTransform, phase, colorSpace, co
mpositeOp, dstRect); | 155 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(expandedIntSize(zoomedAndSc
aledContainerRect.size()), 1); |
| 156 drawForContainer(buffer->context(), containerSize, zoom, zoomedAndScaledCont
ainerRect, zoomedContainerRect, ColorSpaceDeviceRGB, CompositeSourceOver, BlendM
odeNormal); |
| 157 RefPtr<Image> image = buffer->copyImage(CopyBackingStore, Unscaled); |
| 158 |
| 159 // Adjust the source rect and transform for image buffer scale due to pageSc
ale. |
| 160 FloatRect scaledSrcRect = srcRect; |
| 161 scaledSrcRect.scale(pageScale); |
| 162 AffineTransform unscaledPatternTransform(patternTransform); |
| 163 unscaledPatternTransform.scale(1 / pageScale); |
| 164 |
| 165 image->drawPattern(context, scaledSrcRect, unscaledPatternTransform, phase,
colorSpace, compositeOp, dstRect); |
156 } | 166 } |
157 | 167 |
158 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
oatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode) | 168 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const Fl
oatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode) |
159 { | 169 { |
160 if (!m_page) | 170 if (!m_page) |
161 return; | 171 return; |
162 | 172 |
163 FrameView* view = frameView(); | 173 FrameView* view = frameView(); |
164 | 174 |
165 GraphicsContextStateSaver stateSaver(*context); | 175 GraphicsContextStateSaver stateSaver(*context); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 { | 346 { |
337 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou
rceImage); | 347 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResou
rceImage); |
338 Image::reportMemoryUsage(memoryObjectInfo); | 348 Image::reportMemoryUsage(memoryObjectInfo); |
339 info.addMember(m_chromeClient, "chromeClient"); | 349 info.addMember(m_chromeClient, "chromeClient"); |
340 info.addMember(m_page, "page"); | 350 info.addMember(m_page, "page"); |
341 } | 351 } |
342 | 352 |
343 } | 353 } |
344 | 354 |
345 #endif // ENABLE(SVG) | 355 #endif // ENABLE(SVG) |
OLD | NEW |