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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 scaledSrc.scale(1 / zoom); | 201 scaledSrc.scale(1 / zoom); |
202 | 202 |
203 // Compensate for the container size rounding by adjusting the source rect. | 203 // Compensate for the container size rounding by adjusting the source rect. |
204 FloatSize adjustedSrcSize = scaledSrc.size(); | 204 FloatSize adjustedSrcSize = scaledSrc.size(); |
205 adjustedSrcSize.scale(roundedContainerSize.width() / containerSize.width(),
roundedContainerSize.height() / containerSize.height()); | 205 adjustedSrcSize.scale(roundedContainerSize.width() / containerSize.width(),
roundedContainerSize.height() / containerSize.height()); |
206 scaledSrc.setSize(adjustedSrcSize); | 206 scaledSrc.setSize(adjustedSrcSize); |
207 | 207 |
208 draw(context, dstRect, scaledSrc, compositeOp, DoNotRespectImageOrientation)
; | 208 draw(context, dstRect, scaledSrc, compositeOp, DoNotRespectImageOrientation)
; |
209 } | 209 } |
210 | 210 |
211 PassRefPtr<NativeImageSkia> SVGImage::nativeImageForCurrentFrame() | 211 SkBitmap SVGImage::bitmapForCurrentFrame() |
212 { | 212 { |
213 if (!m_page) | 213 if (!m_page) |
214 return nullptr; | 214 return SkBitmap(); |
215 | 215 |
216 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size()); | 216 OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size()); |
217 if (!buffer) | 217 if (!buffer) |
218 return nullptr; | 218 return SkBitmap(); |
219 | 219 |
220 drawForContainer(buffer->context(), size(), 1, rect(), rect(), SkXfermode::k
SrcOver_Mode); | 220 drawForContainer(buffer->context(), size(), 1, rect(), rect(), SkXfermode::k
SrcOver_Mode); |
221 | 221 |
222 return NativeImageSkia::create(buffer->bitmap()); | 222 return buffer->bitmap(); |
223 } | 223 } |
224 | 224 |
225 void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
containerSize, | 225 void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
containerSize, |
226 float zoom, const FloatRect& srcRect, const FloatSize& tileScale, const Floa
tPoint& phase, | 226 float zoom, const FloatRect& srcRect, const FloatSize& tileScale, const Floa
tPoint& phase, |
227 SkXfermode::Mode compositeOp, const FloatRect& dstRect, | 227 SkXfermode::Mode compositeOp, const FloatRect& dstRect, |
228 const IntSize& repeatSpacing) | 228 const IntSize& repeatSpacing) |
229 { | 229 { |
230 // Tile adjusted for scaling/stretch. | 230 // Tile adjusted for scaling/stretch. |
231 FloatRect tile(srcRect); | 231 FloatRect tile(srcRect); |
232 tile.scale(tileScale.width(), tileScale.height()); | 232 tile.scale(tileScale.width(), tileScale.height()); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 460 |
461 return m_page; | 461 return m_page; |
462 } | 462 } |
463 | 463 |
464 String SVGImage::filenameExtension() const | 464 String SVGImage::filenameExtension() const |
465 { | 465 { |
466 return "svg"; | 466 return "svg"; |
467 } | 467 } |
468 | 468 |
469 } | 469 } |
OLD | NEW |