diff options
| author | fmalita <fmalita@chromium.org> | 2016-03-22 06:32:10 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 13:33:15 +0000 |
| commit | 2d743288889c7804e6431bf389cdc6084aaa49ef (patch) | |
| tree | 95409a0d222e17f9e678b97040c0567ede58c4bc /third_party | |
| parent | c2db76301d3eb61575d807d2897da86d637cbd34 (diff) | |
| download | chromium_src-2d743288889c7804e6431bf389cdc6084aaa49ef.zip chromium_src-2d743288889c7804e6431bf389cdc6084aaa49ef.tar.gz chromium_src-2d743288889c7804e6431bf389cdc6084aaa49ef.tar.bz2 | |
Use sk_sp-based picture recording APIs
1) use SkPictureRecorder::finishRecordingAsPicture() over
endRecordingAsPicture()
2) convert to sk_sp<SkPicture> fields/params where feasible
BUG=skia:5077
R=reed@google.com,danakj@chromium.org,enne@chromium.org
TBR=pdr@chromium.org,alekseys@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1819683002
Cr-Commit-Position: refs/heads/master@{#382563}
Diffstat (limited to 'third_party')
9 files changed, 14 insertions, 14 deletions
diff --git a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp index da8a4ae..5c21c9c 100644 --- a/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp +++ b/third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp @@ -57,8 +57,8 @@ static void paintArtifactToWebDisplayItemList(WebDisplayItemList* list, const Pa // separate layers and send those to the compositor, instead of sending // one big flat SkPicture. SkRect skBounds = SkRect::MakeXYWH(bounds.x(), bounds.y(), bounds.width(), bounds.height()); - RefPtr<SkPicture> picture = paintArtifactToSkPicture(artifact, skBounds); - list->appendDrawingItem(WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()), picture.get()); + list->appendDrawingItem(WebRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()), + paintArtifactToSkPicture(artifact, skBounds)); return; } artifact.appendToWebDisplayItemList(list); diff --git a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp index ca7d534..a1a5329 100644 --- a/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp +++ b/third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.cpp @@ -84,7 +84,7 @@ static void appendDisplayItemToCcDisplayItemList(const DisplayItem& displayItem, if (!picture) return; gfx::Rect bounds = gfx::SkIRectToRect(picture->cullRect().roundOut()); - list->CreateAndAppendItem<cc::DrawingDisplayItem>(bounds, skia::SharePtr(picture)); + list->CreateAndAppendItem<cc::DrawingDisplayItem>(bounds, sk_ref_sp(picture)); } } diff --git a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp index b630917..c291fda 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/DrawingDisplayItem.cpp @@ -25,7 +25,7 @@ void DrawingDisplayItem::replay(GraphicsContext& context) const void DrawingDisplayItem::appendToWebDisplayItemList(const IntRect& visualRect, WebDisplayItemList* list) const { if (m_picture) - list->appendDrawingItem(visualRect, m_picture.get()); + list->appendDrawingItem(visualRect, toSkSp(m_picture)); } bool DrawingDisplayItem::drawsContent() const diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.cpp index e95d832..1bd718d 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.cpp +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.cpp @@ -136,12 +136,12 @@ void paintArtifactToSkCanvas(const PaintArtifact& artifact, SkCanvas* canvas) } } -PassRefPtr<SkPicture> paintArtifactToSkPicture(const PaintArtifact& artifact, const SkRect& bounds) +sk_sp<const SkPicture> paintArtifactToSkPicture(const PaintArtifact& artifact, const SkRect& bounds) { SkPictureRecorder recorder; SkCanvas* canvas = recorder.beginRecording(bounds); paintArtifactToSkCanvas(artifact, canvas); - return adoptRef(recorder.endRecordingAsPicture()); + return recorder.finishRecordingAsPicture(); } } // namespace blink diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.h b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.h index 6550497..7a2db65 100644 --- a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.h +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifactToSkCanvas.h @@ -6,7 +6,7 @@ #define PaintArtifactToSkCanvas_h #include "platform/PlatformExport.h" -#include "wtf/PassRefPtr.h" +#include "third_party/skia/include/core/SkRefCnt.h" class SkCanvas; class SkPicture; @@ -26,7 +26,7 @@ class PaintArtifact; PLATFORM_EXPORT void paintArtifactToSkCanvas(const PaintArtifact&, SkCanvas*); // Using the previous, converts the paint artifact to an SkPicture. -PLATFORM_EXPORT PassRefPtr<SkPicture> paintArtifactToSkPicture( +PLATFORM_EXPORT sk_sp<const SkPicture> paintArtifactToSkPicture( const PaintArtifact&, const SkRect& bounds); } // namespace blink diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp index edb360a..7d8e6e6 100644 --- a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp +++ b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp @@ -273,8 +273,8 @@ void LinkHighlightImpl::paintContents(WebDisplayItemList* webDisplayItemList, We paint.setColor(m_node->layoutObject()->style()->tapHighlightColor().rgb()); canvas->drawPath(m_path.getSkPath(), paint); - RefPtr<const SkPicture> picture = adoptRef(recorder.endRecording()); - webDisplayItemList->appendDrawingItem(WebRect(visualRect.x(), visualRect.y(), visualRect.width(), visualRect.height()), picture.get()); + webDisplayItemList->appendDrawingItem(WebRect(visualRect.x(), visualRect.y(), + visualRect.width(), visualRect.height()), recorder.finishRecordingAsPicture()); } void LinkHighlightImpl::startHighlightAnimationIfNeeded() diff --git a/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.cpp b/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.cpp index 20225a1..52abc19 100644 --- a/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.cpp +++ b/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.cpp @@ -16,7 +16,7 @@ SimDisplayItemList::SimDisplayItemList() { } -void SimDisplayItemList::appendDrawingItem(const WebRect&, const SkPicture* picture) +void SimDisplayItemList::appendDrawingItem(const WebRect&, sk_sp<const SkPicture> picture) { m_containsText |= picture->hasText(); diff --git a/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h b/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h index 4a7f1b93..d8136c9 100644 --- a/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h +++ b/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h @@ -15,7 +15,7 @@ class SimDisplayItemList final : public WebDisplayItemList { public: SimDisplayItemList(); - void appendDrawingItem(const WebRect&, const SkPicture*) override; + void appendDrawingItem(const WebRect&, sk_sp<const SkPicture>) override; int drawCount() const { return m_commands.size(); } diff --git a/third_party/WebKit/public/platform/WebDisplayItemList.h b/third_party/WebKit/public/platform/WebDisplayItemList.h index e9dd954..b71d422 100644 --- a/third_party/WebKit/public/platform/WebDisplayItemList.h +++ b/third_party/WebKit/public/platform/WebDisplayItemList.h @@ -14,6 +14,7 @@ #include "third_party/skia/include/core/SkColorFilter.h" #include "third_party/skia/include/core/SkRRect.h" +#include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkRegion.h" #include "third_party/skia/include/core/SkXfermode.h" #include "third_party/skia/include/utils/SkMatrix44.h" @@ -36,8 +37,7 @@ class WebDisplayItemList { public: virtual ~WebDisplayItemList() { } - // This grabs a ref on the passed-in SkPicture. - virtual void appendDrawingItem(const WebRect& visualRect, const SkPicture*) { } + virtual void appendDrawingItem(const WebRect& visualRect, sk_sp<const SkPicture>) { } virtual void appendClipItem(const WebRect& visualRect, const WebRect& clipRect, const WebVector<SkRRect>& roundedClipRects) { } virtual void appendEndClipItem(const WebRect& visualRect) { } |
