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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 { | 238 { |
239 // Tile adjusted for scaling/stretch. | 239 // Tile adjusted for scaling/stretch. |
240 FloatRect tile(srcRect); | 240 FloatRect tile(srcRect); |
241 tile.scale(tileScale.width(), tileScale.height()); | 241 tile.scale(tileScale.width(), tileScale.height()); |
242 | 242 |
243 // Expand the tile to account for repeat spacing. | 243 // Expand the tile to account for repeat spacing. |
244 FloatRect spacedTile(tile); | 244 FloatRect spacedTile(tile); |
245 spacedTile.expand(repeatSpacing); | 245 spacedTile.expand(repeatSpacing); |
246 | 246 |
247 SkPictureBuilder patternPicture(spacedTile, nullptr, context); | 247 SkPictureBuilder patternPicture(spacedTile, nullptr, context); |
248 { | 248 if (!DrawingRecorder::useCachedDrawingIfPossible(patternPicture.context(), *
this, DisplayItem::Type::SVGImage)) { |
249 DrawingRecorder patternPictureRecorder(patternPicture.context(), *this,
DisplayItem::Type::SVGImage, spacedTile); | 249 DrawingRecorder patternPictureRecorder(patternPicture.context(), *this,
DisplayItem::Type::SVGImage, spacedTile); |
250 if (!patternPictureRecorder.canUseCachedDrawing()) { | 250 // When generating an expanded tile, make sure we don't draw into the sp
acing area. |
251 // When generating an expanded tile, make sure we don't draw into th
e spacing area. | 251 if (tile != spacedTile) |
252 if (tile != spacedTile) | 252 patternPicture.context().clip(tile); |
253 patternPicture.context().clip(tile); | 253 SkPaint paint; |
254 SkPaint paint; | 254 drawForContainer(patternPicture.context().canvas(), paint, containerSize
, zoom, tile, srcRect); |
255 drawForContainer(patternPicture.context().canvas(), paint, container
Size, zoom, tile, srcRect); | |
256 } | |
257 } | 255 } |
258 RefPtr<const SkPicture> tilePicture = patternPicture.endRecording(); | 256 RefPtr<const SkPicture> tilePicture = patternPicture.endRecording(); |
259 | 257 |
260 SkMatrix patternTransform; | 258 SkMatrix patternTransform; |
261 patternTransform.setTranslate(phase.x() + spacedTile.x(), phase.y() + spaced
Tile.y()); | 259 patternTransform.setTranslate(phase.x() + spacedTile.x(), phase.y() + spaced
Tile.y()); |
262 RefPtr<SkShader> patternShader = adoptRef(SkShader::CreatePictureShader( | 260 RefPtr<SkShader> patternShader = adoptRef(SkShader::CreatePictureShader( |
263 tilePicture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMod
e, | 261 tilePicture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMod
e, |
264 &patternTransform, nullptr)); | 262 &patternTransform, nullptr)); |
265 | 263 |
266 SkPaint paint; | 264 SkPaint paint; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 481 |
484 return m_page; | 482 return m_page; |
485 } | 483 } |
486 | 484 |
487 String SVGImage::filenameExtension() const | 485 String SVGImage::filenameExtension() const |
488 { | 486 { |
489 return "svg"; | 487 return "svg"; |
490 } | 488 } |
491 | 489 |
492 } | 490 } |
OLD | NEW |