| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Simon Hausmann <hausmann@kde.org> | 5 * 2000 Simon Hausmann <hausmann@kde.org> |
| 6 * 2000 Stefan Schimanski <1Stein@gmx.de> | 6 * 2000 Stefan Schimanski <1Stein@gmx.de> |
| 7 * 2001 George Staikos <staikos@kde.org> | 7 * 2001 George Staikos <staikos@kde.org> |
| 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
| 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 | 706 |
| 707 LayoutRect topLevelRect; | 707 LayoutRect topLevelRect; |
| 708 IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLev
elRect)); | 708 IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLev
elRect)); |
| 709 | 709 |
| 710 float deviceScaleFactor = 1; | 710 float deviceScaleFactor = 1; |
| 711 if (m_page) | 711 if (m_page) |
| 712 deviceScaleFactor = m_page->deviceScaleFactor(); | 712 deviceScaleFactor = m_page->deviceScaleFactor(); |
| 713 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); | 713 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); |
| 714 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); | 714 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); |
| 715 | 715 |
| 716 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceSc
aleFactor, ColorSpaceDeviceRGB)); | 716 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceSc
aleFactor)); |
| 717 if (!buffer) | 717 if (!buffer) |
| 718 return 0; | 718 return 0; |
| 719 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); | 719 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); |
| 720 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); | 720 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); |
| 721 | 721 |
| 722 m_view->paintContents(buffer->context(), paintingRect); | 722 m_view->paintContents(buffer->context(), paintingRect); |
| 723 | 723 |
| 724 RefPtr<Image> image = buffer->copyImage(); | 724 RefPtr<Image> image = buffer->copyImage(); |
| 725 return createDragImageFromImage(image.get(), renderer->shouldRespectImageOri
entation()); | 725 return createDragImageFromImage(image.get(), renderer->shouldRespectImageOri
entation()); |
| 726 } | 726 } |
| 727 | 727 |
| 728 DragImageRef Frame::dragImageForSelection() | 728 DragImageRef Frame::dragImageForSelection() |
| 729 { | 729 { |
| 730 if (!selection()->isRange()) | 730 if (!selection()->isRange()) |
| 731 return 0; | 731 return 0; |
| 732 | 732 |
| 733 const ScopedFramePaintingState state(this, 0); | 733 const ScopedFramePaintingState state(this, 0); |
| 734 m_view->setPaintBehavior(PaintBehaviorSelectionOnly); | 734 m_view->setPaintBehavior(PaintBehaviorSelectionOnly); |
| 735 m_doc->updateLayout(); | 735 m_doc->updateLayout(); |
| 736 | 736 |
| 737 IntRect paintingRect = enclosingIntRect(selection()->bounds()); | 737 IntRect paintingRect = enclosingIntRect(selection()->bounds()); |
| 738 | 738 |
| 739 float deviceScaleFactor = 1; | 739 float deviceScaleFactor = 1; |
| 740 if (m_page) | 740 if (m_page) |
| 741 deviceScaleFactor = m_page->deviceScaleFactor(); | 741 deviceScaleFactor = m_page->deviceScaleFactor(); |
| 742 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); | 742 paintingRect.setWidth(paintingRect.width() * deviceScaleFactor); |
| 743 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); | 743 paintingRect.setHeight(paintingRect.height() * deviceScaleFactor); |
| 744 | 744 |
| 745 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceSc
aleFactor, ColorSpaceDeviceRGB)); | 745 OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size(), deviceSc
aleFactor)); |
| 746 if (!buffer) | 746 if (!buffer) |
| 747 return 0; | 747 return 0; |
| 748 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); | 748 buffer->context()->translate(-paintingRect.x(), -paintingRect.y()); |
| 749 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); | 749 buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.ma
xY())); |
| 750 | 750 |
| 751 m_view->paintContents(buffer->context(), paintingRect); | 751 m_view->paintContents(buffer->context(), paintingRect); |
| 752 | 752 |
| 753 RefPtr<Image> image = buffer->copyImage(); | 753 RefPtr<Image> image = buffer->copyImage(); |
| 754 return createDragImageFromImage(image.get()); | 754 return createDragImageFromImage(image.get()); |
| 755 } | 755 } |
| 756 | 756 |
| 757 } // namespace WebCore | 757 } // namespace WebCore |
| OLD | NEW |