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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 paint.setColorFilter(context.colorFilter()); | 286 paint.setColorFilter(context.colorFilter()); |
287 context.drawRect(dstRect, paint); | 287 context.drawRect(dstRect, paint); |
288 } | 288 } |
289 | 289 |
290 PassRefPtr<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url) | 290 PassRefPtr<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url) |
291 { | 291 { |
292 if (!m_page) | 292 if (!m_page) |
293 return nullptr; | 293 return nullptr; |
294 | 294 |
295 SkPictureRecorder recorder; | 295 SkPictureRecorder recorder; |
296 SkCanvas* canvas = recorder.beginRecording(width(), height()); | 296 SkCanvas* canvas = recorder.beginRecording(defaultConcreteObjectSizeWidth(),
defaultConcreteObjectSizeHeight()); |
297 drawForContainer(canvas, SkPaint(), FloatSize(size()), 1, rect(), rect(), ur
l); | 297 drawForContainer(canvas, SkPaint(), FloatSize(defaultConcreteObjectSize()),
1, defaultConcreteObjectSizeRect(), defaultConcreteObjectSizeRect(), url); |
298 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); | 298 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
299 | 299 |
300 return adoptRef( | 300 return adoptRef( |
301 SkImage::NewFromPicture(picture.get(), SkISize::Make(width(), height()),
nullptr, nullptr)); | 301 SkImage::NewFromPicture(picture.get(), SkISize::Make(defaultConcreteObje
ctSizeWidth(), defaultConcreteObjectSizeHeight()), nullptr, nullptr)); |
302 } | 302 } |
303 | 303 |
304 static bool drawNeedsLayer(const SkPaint& paint) | 304 static bool drawNeedsLayer(const SkPaint& paint) |
305 { | 305 { |
306 if (SkColorGetA(paint.getColor()) < 255) | 306 if (SkColorGetA(paint.getColor()) < 255) |
307 return true; | 307 return true; |
308 | 308 |
309 SkXfermode::Mode xfermode; | 309 SkXfermode::Mode xfermode; |
310 if (SkXfermode::AsMode(paint.getXfermode(), &xfermode)) { | 310 if (SkXfermode::AsMode(paint.getXfermode(), &xfermode)) { |
311 if (xfermode != SkXfermode::kSrcOver_Mode) | 311 if (xfermode != SkXfermode::kSrcOver_Mode) |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), Atomi
cString("image/svg+xml", AtomicString::ConstructFromLiteral), | 534 loader.load(FrameLoadRequest(0, blankURL(), SubstituteData(data(), Atomi
cString("image/svg+xml", AtomicString::ConstructFromLiteral), |
535 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(), F
orceSynchronousLoad))); | 535 AtomicString("UTF-8", AtomicString::ConstructFromLiteral), KURL(), F
orceSynchronousLoad))); |
536 | 536 |
537 // Set the concrete object size before a container size is available. | 537 // Set the concrete object size before a container size is available. |
538 m_concreteObjectSize = roundedIntSize(calculateConcreteObjectSize(FloatS
ize(300, 150))); | 538 m_concreteObjectSize = roundedIntSize(calculateConcreteObjectSize(FloatS
ize(300, 150))); |
539 } | 539 } |
540 | 540 |
541 return m_page; | 541 return m_page; |
542 } | 542 } |
543 | 543 |
| 544 IntSize SVGImage::concreteObjectSize(const FloatSize& defaultObjectSize) const |
| 545 { |
| 546 return roundedIntSize(calculateConcreteObjectSize(defaultObjectSize)); |
| 547 } |
| 548 |
544 String SVGImage::filenameExtension() const | 549 String SVGImage::filenameExtension() const |
545 { | 550 { |
546 return "svg"; | 551 return "svg"; |
547 } | 552 } |
548 | 553 |
549 } // namespace blink | 554 } // namespace blink |
OLD | NEW |