Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Side by Side Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 #include "platform/graphics/paint/SkPictureBuilder.h" 85 #include "platform/graphics/paint/SkPictureBuilder.h"
86 #include "platform/graphics/paint/TransformDisplayItem.h" 86 #include "platform/graphics/paint/TransformDisplayItem.h"
87 #include "platform/json/JSONValues.h" 87 #include "platform/json/JSONValues.h"
88 #include "platform/plugins/PluginData.h" 88 #include "platform/plugins/PluginData.h"
89 #include "platform/text/TextStream.h" 89 #include "platform/text/TextStream.h"
90 #include "public/platform/InterfaceProvider.h" 90 #include "public/platform/InterfaceProvider.h"
91 #include "public/platform/InterfaceRegistry.h" 91 #include "public/platform/InterfaceRegistry.h"
92 #include "public/platform/WebFrameScheduler.h" 92 #include "public/platform/WebFrameScheduler.h"
93 #include "public/platform/WebScreenInfo.h" 93 #include "public/platform/WebScreenInfo.h"
94 #include "public/platform/WebViewScheduler.h" 94 #include "public/platform/WebViewScheduler.h"
95 #include "skia/ext/cdl_canvas.h"
95 #include "third_party/skia/include/core/SkImage.h" 96 #include "third_party/skia/include/core/SkImage.h"
97 #include "third_party/skia/include/core/SkPictureRecorder.h"
96 #include "wtf/PtrUtil.h" 98 #include "wtf/PtrUtil.h"
97 #include "wtf/StdLibExtras.h" 99 #include "wtf/StdLibExtras.h"
98 #include <memory> 100 #include <memory>
99 101
100 namespace blink { 102 namespace blink {
101 103
102 using namespace HTMLNames; 104 using namespace HTMLNames;
103 105
104 namespace { 106 namespace {
105 107
(...skipping 27 matching lines...) Expand all
133 135
134 GraphicsContext& context() { return m_pictureBuilder->context(); } 136 GraphicsContext& context() { return m_pictureBuilder->context(); }
135 137
136 std::unique_ptr<DragImage> createImage( 138 std::unique_ptr<DragImage> createImage(
137 float opacity, 139 float opacity,
138 RespectImageOrientationEnum imageOrientation = 140 RespectImageOrientationEnum imageOrientation =
139 DoNotRespectImageOrientation) { 141 DoNotRespectImageOrientation) {
140 context().getPaintController().endItem<EndTransformDisplayItem>( 142 context().getPaintController().endItem<EndTransformDisplayItem>(
141 *m_pictureBuilder); 143 *m_pictureBuilder);
142 // TODO(fmalita): endRecording() should return a non-const SKP. 144 // TODO(fmalita): endRecording() should return a non-const SKP.
143 sk_sp<SkPicture> recording( 145 sk_sp<CdlPicture> recording(
144 const_cast<SkPicture*>(m_pictureBuilder->endRecording().release())); 146 const_cast<CdlPicture*>(m_pictureBuilder->endRecording().release()));
147
148 SkPictureRecorder recorder;
149 SkCanvas* sk_canvas = recorder.beginRecording(m_bounds);
150 CdlPassThroughCanvas canvas(sk_canvas);
151 canvas.drawPicture(recording);
152
145 sk_sp<SkImage> skImage = SkImage::MakeFromPicture( 153 sk_sp<SkImage> skImage = SkImage::MakeFromPicture(
146 std::move(recording), 154 recorder.finishRecordingAsPicture(),
147 SkISize::Make(m_bounds.width(), m_bounds.height()), nullptr, nullptr); 155 SkISize::Make(m_bounds.width(), m_bounds.height()), nullptr, nullptr);
148 RefPtr<Image> image = StaticBitmapImage::create(std::move(skImage)); 156 RefPtr<Image> image = StaticBitmapImage::create(std::move(skImage));
149 float screenDeviceScaleFactor = 157 float screenDeviceScaleFactor =
150 m_localFrame->page()->chromeClient().screenInfo().deviceScaleFactor; 158 m_localFrame->page()->chromeClient().screenInfo().deviceScaleFactor;
151 159
152 return DragImage::create(image.get(), imageOrientation, 160 return DragImage::create(image.get(), imageOrientation,
153 screenDeviceScaleFactor, InterpolationHigh, 161 screenDeviceScaleFactor, InterpolationHigh,
154 opacity); 162 opacity);
155 } 163 }
156 164
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 937 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
930 m_frame->client()->frameBlameContext()->Enter(); 938 m_frame->client()->frameBlameContext()->Enter();
931 } 939 }
932 940
933 ScopedFrameBlamer::~ScopedFrameBlamer() { 941 ScopedFrameBlamer::~ScopedFrameBlamer() {
934 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 942 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
935 m_frame->client()->frameBlameContext()->Leave(); 943 m_frame->client()->frameBlameContext()->Leave();
936 } 944 }
937 945
938 } // namespace blink 946 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/ImageBitmap.cpp ('k') | third_party/WebKit/Source/core/html/HTMLCanvasElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698