| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #include "platform/PluginScriptForbiddenScope.h" | 81 #include "platform/PluginScriptForbiddenScope.h" |
| 82 #include "platform/RuntimeEnabledFeatures.h" | 82 #include "platform/RuntimeEnabledFeatures.h" |
| 83 #include "platform/ScriptForbiddenScope.h" | 83 #include "platform/ScriptForbiddenScope.h" |
| 84 #include "platform/WebFrameScheduler.h" | 84 #include "platform/WebFrameScheduler.h" |
| 85 #include "platform/graphics/GraphicsContext.h" | 85 #include "platform/graphics/GraphicsContext.h" |
| 86 #include "platform/graphics/StaticBitmapImage.h" | 86 #include "platform/graphics/StaticBitmapImage.h" |
| 87 #include "platform/graphics/paint/ClipRecorder.h" | 87 #include "platform/graphics/paint/ClipRecorder.h" |
| 88 #include "platform/graphics/paint/PaintCanvas.h" | 88 #include "platform/graphics/paint/PaintCanvas.h" |
| 89 #include "platform/graphics/paint/PaintController.h" | 89 #include "platform/graphics/paint/PaintController.h" |
| 90 #include "platform/graphics/paint/PaintRecordBuilder.h" | 90 #include "platform/graphics/paint/PaintRecordBuilder.h" |
| 91 #include "platform/graphics/paint/PaintSurface.h" |
| 91 #include "platform/graphics/paint/TransformDisplayItem.h" | 92 #include "platform/graphics/paint/TransformDisplayItem.h" |
| 92 #include "platform/json/JSONValues.h" | 93 #include "platform/json/JSONValues.h" |
| 93 #include "platform/loader/fetch/ResourceFetcher.h" | 94 #include "platform/loader/fetch/ResourceFetcher.h" |
| 94 #include "platform/plugins/PluginData.h" | 95 #include "platform/plugins/PluginData.h" |
| 95 #include "platform/text/TextStream.h" | 96 #include "platform/text/TextStream.h" |
| 96 #include "public/platform/InterfaceProvider.h" | 97 #include "public/platform/InterfaceProvider.h" |
| 97 #include "public/platform/InterfaceRegistry.h" | 98 #include "public/platform/InterfaceRegistry.h" |
| 98 #include "public/platform/WebScreenInfo.h" | 99 #include "public/platform/WebScreenInfo.h" |
| 99 #include "public/platform/WebViewScheduler.h" | 100 #include "public/platform/WebViewScheduler.h" |
| 100 #include "third_party/skia/include/core/SkImage.h" | 101 #include "third_party/skia/include/core/SkImage.h" |
| 101 #include "third_party/skia/include/core/SkSurface.h" | |
| 102 #include "wtf/PtrUtil.h" | 102 #include "wtf/PtrUtil.h" |
| 103 #include "wtf/StdLibExtras.h" | 103 #include "wtf/StdLibExtras.h" |
| 104 | 104 |
| 105 namespace blink { | 105 namespace blink { |
| 106 | 106 |
| 107 using namespace HTMLNames; | 107 using namespace HTMLNames; |
| 108 | 108 |
| 109 namespace { | 109 namespace { |
| 110 | 110 |
| 111 // Convenience class for initializing a GraphicsContext to build a DragImage | 111 // Convenience class for initializing a GraphicsContext to build a DragImage |
| (...skipping 25 matching lines...) Expand all Loading... |
| 137 } | 137 } |
| 138 | 138 |
| 139 GraphicsContext& context() { return m_builder->context(); } | 139 GraphicsContext& context() { return m_builder->context(); } |
| 140 | 140 |
| 141 std::unique_ptr<DragImage> createImage( | 141 std::unique_ptr<DragImage> createImage( |
| 142 float opacity, | 142 float opacity, |
| 143 RespectImageOrientationEnum imageOrientation = | 143 RespectImageOrientationEnum imageOrientation = |
| 144 DoNotRespectImageOrientation) { | 144 DoNotRespectImageOrientation) { |
| 145 context().getPaintController().endItem<EndTransformDisplayItem>(*m_builder); | 145 context().getPaintController().endItem<EndTransformDisplayItem>(*m_builder); |
| 146 // TODO(fmalita): endRecording() should return a non-const SKP. | 146 // TODO(fmalita): endRecording() should return a non-const SKP. |
| 147 sk_sp<PaintRecord> recording( | 147 sk_sp<PaintRecord> record( |
| 148 const_cast<PaintRecord*>(m_builder->endRecording().release())); | 148 const_cast<PaintRecord*>(m_builder->endRecording().release())); |
| 149 | 149 |
| 150 // Rasterize upfront, since DragImage::create() is going to do it anyway | 150 // Rasterize upfront, since DragImage::create() is going to do it anyway |
| 151 // (SkImage::asLegacyBitmap). | 151 // (SkImage::asLegacyBitmap). |
| 152 SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry); | 152 SkSurfaceProps surfaceProps(0, kUnknown_SkPixelGeometry); |
| 153 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul( | 153 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul( |
| 154 m_bounds.width(), m_bounds.height(), &surfaceProps); | 154 m_bounds.width(), m_bounds.height(), &surfaceProps); |
| 155 if (!surface) | 155 if (!surface) |
| 156 return nullptr; | 156 return nullptr; |
| 157 | 157 |
| 158 surface->getCanvas()->drawPicture(recording); | 158 record->playback(surface->getCanvas()); |
| 159 RefPtr<Image> image = | 159 RefPtr<Image> image = |
| 160 StaticBitmapImage::create(surface->makeImageSnapshot()); | 160 StaticBitmapImage::create(surface->makeImageSnapshot()); |
| 161 | 161 |
| 162 float screenDeviceScaleFactor = | 162 float screenDeviceScaleFactor = |
| 163 m_localFrame->page()->chromeClient().screenInfo().deviceScaleFactor; | 163 m_localFrame->page()->chromeClient().screenInfo().deviceScaleFactor; |
| 164 | 164 |
| 165 return DragImage::create(image.get(), imageOrientation, | 165 return DragImage::create(image.get(), imageOrientation, |
| 166 screenDeviceScaleFactor, InterpolationHigh, | 166 screenDeviceScaleFactor, InterpolationHigh, |
| 167 opacity); | 167 opacity); |
| 168 } | 168 } |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 918 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) | 918 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) |
| 919 m_frame->client()->frameBlameContext()->Enter(); | 919 m_frame->client()->frameBlameContext()->Enter(); |
| 920 } | 920 } |
| 921 | 921 |
| 922 ScopedFrameBlamer::~ScopedFrameBlamer() { | 922 ScopedFrameBlamer::~ScopedFrameBlamer() { |
| 923 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) | 923 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) |
| 924 m_frame->client()->frameBlameContext()->Leave(); | 924 m_frame->client()->frameBlameContext()->Leave(); |
| 925 } | 925 } |
| 926 | 926 |
| 927 } // namespace blink | 927 } // namespace blink |
| OLD | NEW |