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 | 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
9 * rights reserved. | 9 * rights reserved. |
10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> | 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 #include "platform/graphics/paint/SkPictureBuilder.h" | 87 #include "platform/graphics/paint/SkPictureBuilder.h" |
88 #include "platform/graphics/paint/TransformDisplayItem.h" | 88 #include "platform/graphics/paint/TransformDisplayItem.h" |
89 #include "platform/json/JSONValues.h" | 89 #include "platform/json/JSONValues.h" |
90 #include "platform/plugins/PluginData.h" | 90 #include "platform/plugins/PluginData.h" |
91 #include "platform/text/TextStream.h" | 91 #include "platform/text/TextStream.h" |
92 #include "public/platform/InterfaceProvider.h" | 92 #include "public/platform/InterfaceProvider.h" |
93 #include "public/platform/InterfaceRegistry.h" | 93 #include "public/platform/InterfaceRegistry.h" |
94 #include "public/platform/WebScreenInfo.h" | 94 #include "public/platform/WebScreenInfo.h" |
95 #include "public/platform/WebViewScheduler.h" | 95 #include "public/platform/WebViewScheduler.h" |
96 #include "third_party/skia/include/core/SkImage.h" | 96 #include "third_party/skia/include/core/SkImage.h" |
| 97 #include "third_party/skia/include/core/SkSurface.h" |
97 #include "wtf/PtrUtil.h" | 98 #include "wtf/PtrUtil.h" |
98 #include "wtf/StdLibExtras.h" | 99 #include "wtf/StdLibExtras.h" |
99 #include <memory> | 100 #include <memory> |
100 | 101 |
101 namespace blink { | 102 namespace blink { |
102 | 103 |
103 using namespace HTMLNames; | 104 using namespace HTMLNames; |
104 | 105 |
105 namespace { | 106 namespace { |
106 | 107 |
(...skipping 29 matching lines...) Expand all Loading... |
136 | 137 |
137 std::unique_ptr<DragImage> createImage( | 138 std::unique_ptr<DragImage> createImage( |
138 float opacity, | 139 float opacity, |
139 RespectImageOrientationEnum imageOrientation = | 140 RespectImageOrientationEnum imageOrientation = |
140 DoNotRespectImageOrientation) { | 141 DoNotRespectImageOrientation) { |
141 context().getPaintController().endItem<EndTransformDisplayItem>( | 142 context().getPaintController().endItem<EndTransformDisplayItem>( |
142 *m_pictureBuilder); | 143 *m_pictureBuilder); |
143 // TODO(fmalita): endRecording() should return a non-const SKP. | 144 // TODO(fmalita): endRecording() should return a non-const SKP. |
144 sk_sp<SkPicture> recording( | 145 sk_sp<SkPicture> recording( |
145 const_cast<SkPicture*>(m_pictureBuilder->endRecording().release())); | 146 const_cast<SkPicture*>(m_pictureBuilder->endRecording().release())); |
146 sk_sp<SkImage> skImage = SkImage::MakeFromPicture( | 147 |
147 std::move(recording), | 148 // Rasterize upfront, since DragImage::create() is going to do it anyway |
148 SkISize::Make(m_bounds.width(), m_bounds.height()), nullptr, nullptr); | 149 // (SkImage::asLegacyBitmap). |
149 RefPtr<Image> image = StaticBitmapImage::create(std::move(skImage)); | 150 sk_sp<SkSurface> surface = |
| 151 SkSurface::MakeRasterN32Premul(m_bounds.width(), m_bounds.height()); |
| 152 surface->getCanvas()->drawPicture(recording); |
| 153 RefPtr<Image> image = |
| 154 StaticBitmapImage::create(surface->makeImageSnapshot()); |
| 155 |
150 float screenDeviceScaleFactor = | 156 float screenDeviceScaleFactor = |
151 m_localFrame->page()->chromeClient().screenInfo().deviceScaleFactor; | 157 m_localFrame->page()->chromeClient().screenInfo().deviceScaleFactor; |
152 | 158 |
153 return DragImage::create(image.get(), imageOrientation, | 159 return DragImage::create(image.get(), imageOrientation, |
154 screenDeviceScaleFactor, InterpolationHigh, | 160 screenDeviceScaleFactor, InterpolationHigh, |
155 opacity); | 161 opacity); |
156 } | 162 } |
157 | 163 |
158 private: | 164 private: |
159 const Member<const LocalFrame> m_localFrame; | 165 const Member<const LocalFrame> m_localFrame; |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) | 933 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) |
928 m_frame->client()->frameBlameContext()->Enter(); | 934 m_frame->client()->frameBlameContext()->Enter(); |
929 } | 935 } |
930 | 936 |
931 ScopedFrameBlamer::~ScopedFrameBlamer() { | 937 ScopedFrameBlamer::~ScopedFrameBlamer() { |
932 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) | 938 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) |
933 m_frame->client()->frameBlameContext()->Leave(); | 939 m_frame->client()->frameBlameContext()->Leave(); |
934 } | 940 } |
935 | 941 |
936 } // namespace blink | 942 } // namespace blink |
OLD | NEW |