| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 DrawForContainer(builder.Context().Canvas(), flags, container_size, zoom, | 348 DrawForContainer(builder.Context().Canvas(), flags, container_size, zoom, |
| 349 tile, src_rect, url); | 349 tile, src_rect, url); |
| 350 } | 350 } |
| 351 sk_sp<PaintRecord> record = builder.EndRecording(); | 351 sk_sp<PaintRecord> record = builder.EndRecording(); |
| 352 | 352 |
| 353 SkMatrix pattern_transform; | 353 SkMatrix pattern_transform; |
| 354 pattern_transform.setTranslate(phase.X() + spaced_tile.X(), | 354 pattern_transform.setTranslate(phase.X() + spaced_tile.X(), |
| 355 phase.Y() + spaced_tile.Y()); | 355 phase.Y() + spaced_tile.Y()); |
| 356 | 356 |
| 357 PaintFlags flags; | 357 PaintFlags flags; |
| 358 flags.setShader(MakePaintShaderRecord(record, SkShader::kRepeat_TileMode, | 358 flags.setShader(WTF::MakeUnique<PaintShader>( |
| 359 SkShader::kRepeat_TileMode, | 359 record, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, |
| 360 &pattern_transform, nullptr)); | 360 &pattern_transform, nullptr)); |
| 361 // If the shader could not be instantiated (e.g. non-invertible matrix), | 361 // If the shader could not be instantiated (e.g. non-invertible matrix), |
| 362 // draw transparent. | 362 // draw transparent. |
| 363 // Note: we can't simply bail, because of arbitrary blend mode. | 363 // Note: we can't simply bail, because of arbitrary blend mode. |
| 364 if (!flags.getShader()) | 364 if (!flags.HasShader()) |
| 365 flags.setColor(SK_ColorTRANSPARENT); | 365 flags.setColor(SK_ColorTRANSPARENT); |
| 366 | 366 |
| 367 flags.setBlendMode(composite_op); | 367 flags.setBlendMode(composite_op); |
| 368 flags.setColorFilter(sk_ref_sp(context.GetColorFilter())); | 368 flags.setColorFilter(sk_ref_sp(context.GetColorFilter())); |
| 369 context.DrawRect(dst_rect, flags); | 369 context.DrawRect(dst_rect, flags); |
| 370 } | 370 } |
| 371 | 371 |
| 372 sk_sp<SkImage> SVGImage::ImageForCurrentFrameForContainer( | 372 sk_sp<SkImage> SVGImage::ImageForCurrentFrameForContainer( |
| 373 const KURL& url, | 373 const KURL& url, |
| 374 const IntSize& container_size) { | 374 const IntSize& container_size) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 397 bool SVGImage::ApplyShaderInternal(PaintFlags& flags, | 397 bool SVGImage::ApplyShaderInternal(PaintFlags& flags, |
| 398 const SkMatrix& local_matrix, | 398 const SkMatrix& local_matrix, |
| 399 const KURL& url) { | 399 const KURL& url) { |
| 400 const FloatSize size(ContainerSize()); | 400 const FloatSize size(ContainerSize()); |
| 401 if (size.IsEmpty()) | 401 if (size.IsEmpty()) |
| 402 return false; | 402 return false; |
| 403 | 403 |
| 404 FloatRect float_bounds(FloatPoint(), size); | 404 FloatRect float_bounds(FloatPoint(), size); |
| 405 const SkRect bounds(float_bounds); | 405 const SkRect bounds(float_bounds); |
| 406 | 406 |
| 407 flags.setShader(MakePaintShaderRecord( | 407 flags.setShader(WTF::MakeUnique<PaintShader>( |
| 408 PaintRecordForCurrentFrame(float_bounds, url), SkShader::kRepeat_TileMode, | 408 PaintRecordForCurrentFrame(float_bounds, url), SkShader::kRepeat_TileMode, |
| 409 SkShader::kRepeat_TileMode, &local_matrix, &bounds)); | 409 SkShader::kRepeat_TileMode, &local_matrix, &bounds)); |
| 410 | 410 |
| 411 // Animation is normally refreshed in draw() impls, which we don't reach when | 411 // Animation is normally refreshed in draw() impls, which we don't reach when |
| 412 // painting via shaders. | 412 // painting via shaders. |
| 413 StartAnimation(); | 413 StartAnimation(); |
| 414 | 414 |
| 415 return true; | 415 return true; |
| 416 } | 416 } |
| 417 | 417 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 | 784 |
| 785 NOTREACHED(); | 785 NOTREACHED(); |
| 786 return kSizeAvailable; | 786 return kSizeAvailable; |
| 787 } | 787 } |
| 788 | 788 |
| 789 String SVGImage::FilenameExtension() const { | 789 String SVGImage::FilenameExtension() const { |
| 790 return "svg"; | 790 return "svg"; |
| 791 } | 791 } |
| 792 | 792 |
| 793 } // namespace blink | 793 } // namespace blink |
| OLD | NEW |