Chromium Code Reviews| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 const KURL& url) { | 281 const KURL& url) { |
| 282 // Tile adjusted for scaling/stretch. | 282 // Tile adjusted for scaling/stretch. |
| 283 FloatRect tile(srcRect); | 283 FloatRect tile(srcRect); |
| 284 tile.scale(tileScale.width(), tileScale.height()); | 284 tile.scale(tileScale.width(), tileScale.height()); |
| 285 | 285 |
| 286 // Expand the tile to account for repeat spacing. | 286 // Expand the tile to account for repeat spacing. |
| 287 FloatRect spacedTile(tile); | 287 FloatRect spacedTile(tile); |
| 288 spacedTile.expand(FloatSize(repeatSpacing)); | 288 spacedTile.expand(FloatSize(repeatSpacing)); |
| 289 | 289 |
| 290 SkPictureBuilder patternPicture(spacedTile, nullptr, &context); | 290 SkPictureBuilder patternPicture(spacedTile, nullptr, &context); |
| 291 // SVG images paint into their own property tree set that is distinct | |
| 292 // from the embedding frame tree. | |
| 293 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
| 294 PaintChunk::Id id(patternPicture, DisplayItem::kSVGImage); | |
| 295 PropertyTreeState state( | |
| 296 TransformPaintPropertyNode::root(), ClipPaintPropertyNode::root(), | |
| 297 EffectPaintPropertyNode::root(), ScrollPaintPropertyNode::root()); | |
| 298 m_paintController->updateCurrentPaintChunkProperties(&id, state); | |
| 299 } | |
| 300 | |
| 291 { | 301 { |
| 292 DrawingRecorder patternPictureRecorder( | 302 DrawingRecorder patternPictureRecorder( |
| 293 patternPicture.context(), patternPicture, DisplayItem::Type::kSVGImage, | 303 patternPicture.context(), patternPicture, DisplayItem::Type::kSVGImage, |
| 294 spacedTile); | 304 spacedTile); |
| 295 // When generating an expanded tile, make sure we don't draw into the | 305 // When generating an expanded tile, make sure we don't draw into the |
| 296 // spacing area. | 306 // spacing area. |
| 297 if (tile != spacedTile) | 307 if (tile != spacedTile) |
| 298 patternPicture.context().clip(tile); | 308 patternPicture.context().clip(tile); |
| 299 SkPaint paint; | 309 SkPaint paint; |
| 300 drawForContainer(patternPicture.context().canvas(), paint, containerSize, | 310 drawForContainer(patternPicture.context().canvas(), paint, containerSize, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 view->processUrlFragment(url); | 382 view->processUrlFragment(url); |
| 373 | 383 |
| 374 // If the image was reset, we need to rewind the timeline back to 0. This | 384 // If the image was reset, we need to rewind the timeline back to 0. This |
| 375 // needs to be done before painting, or else we wouldn't get the correct | 385 // needs to be done before painting, or else we wouldn't get the correct |
| 376 // reset semantics (we'd paint the "last" frame rather than the one at | 386 // reset semantics (we'd paint the "last" frame rather than the one at |
| 377 // time=0.) The reason we do this here and not in resetAnimation() is to | 387 // time=0.) The reason we do this here and not in resetAnimation() is to |
| 378 // avoid setting timers from the latter. | 388 // avoid setting timers from the latter. |
| 379 flushPendingTimelineRewind(); | 389 flushPendingTimelineRewind(); |
| 380 SkPictureBuilder imagePicture(dstRect, nullptr, nullptr, | 390 SkPictureBuilder imagePicture(dstRect, nullptr, nullptr, |
| 381 m_paintController.get()); | 391 m_paintController.get()); |
| 392 // SVG images paint into their own property tree set that is distinct | |
|
pdr.
2017/01/17 21:48:00
Could you move this into SkPictureBuilder?
| |
| 393 // from the embedding frame tree. | |
| 394 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
| 395 PaintChunk::Id id(imagePicture, DisplayItem::kSVGImage); | |
| 396 PropertyTreeState state( | |
| 397 TransformPaintPropertyNode::root(), ClipPaintPropertyNode::root(), | |
| 398 EffectPaintPropertyNode::root(), ScrollPaintPropertyNode::root()); | |
| 399 m_paintController->updateCurrentPaintChunkProperties(&id, state); | |
| 400 } | |
| 401 | |
| 382 { | 402 { |
| 383 ClipRecorder clipRecorder(imagePicture.context(), imagePicture, | 403 ClipRecorder clipRecorder(imagePicture.context(), imagePicture, |
| 384 DisplayItem::kClipNodeImage, | 404 DisplayItem::kClipNodeImage, |
| 385 enclosingIntRect(dstRect)); | 405 enclosingIntRect(dstRect)); |
| 386 | 406 |
| 387 // We can only draw the entire frame, clipped to the rect we want. So | 407 // We can only draw the entire frame, clipped to the rect we want. So |
| 388 // compute where the top left of the image would be if we were drawing | 408 // compute where the top left of the image would be if we were drawing |
| 389 // without clipping, and translate accordingly. | 409 // without clipping, and translate accordingly. |
| 390 FloatSize scale(dstRect.width() / srcRect.width(), | 410 FloatSize scale(dstRect.width() / srcRect.width(), |
| 391 dstRect.height() / srcRect.height()); | 411 dstRect.height() / srcRect.height()); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 } | 648 } |
| 629 | 649 |
| 630 return m_page ? SizeAvailable : SizeUnavailable; | 650 return m_page ? SizeAvailable : SizeUnavailable; |
| 631 } | 651 } |
| 632 | 652 |
| 633 String SVGImage::filenameExtension() const { | 653 String SVGImage::filenameExtension() const { |
| 634 return "svg"; | 654 return "svg"; |
| 635 } | 655 } |
| 636 | 656 |
| 637 } // namespace blink | 657 } // namespace blink |
| OLD | NEW |