Commit a1b8aad4 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Remove PaintArtifact::Replay()

Change-Id: I55e77f96e7be7c554cd00e6e07c9720763e83f17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2496288Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820628}
parent c35b5c00
...@@ -117,9 +117,9 @@ TEST_P(FrameOverlayTest, AcceleratedCompositing) { ...@@ -117,9 +117,9 @@ TEST_P(FrameOverlayTest, AcceleratedCompositing) {
graphics_layer->PaintRecursively(builder.Context(), pre_composited_layers); graphics_layer->PaintRecursively(builder.Context(), pre_composited_layers);
ASSERT_EQ(1u, pre_composited_layers.size()); ASSERT_EQ(1u, pre_composited_layers.size());
graphics_layer->GetPaintController().FinishCycle(); graphics_layer->GetPaintController().FinishCycle();
SkiaPaintCanvas paint_canvas(&canvas); SkiaPaintCanvas(&canvas).drawPicture(
graphics_layer->GetPaintController().GetPaintArtifact().Replay( graphics_layer->GetPaintController().GetPaintArtifact().GetPaintRecord(
paint_canvas, PropertyTreeState::Root()); PropertyTreeState::Root()));
} }
} }
......
...@@ -4,13 +4,8 @@ ...@@ -4,13 +4,8 @@
#include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_artifact.h"
#include "cc/paint/display_item_list.h"
#include "third_party/blink/renderer/platform/geometry/int_rect.h"
#include "third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.h" #include "third_party/blink/renderer/platform/graphics/compositing/paint_chunks_to_cc_layer.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_display_item.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_chunk_subset.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
namespace blink { namespace blink {
...@@ -25,25 +20,10 @@ size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const { ...@@ -25,25 +20,10 @@ size_t PaintArtifact::ApproximateUnsharedMemoryUsage() const {
return total_size; return total_size;
} }
void PaintArtifact::Replay(GraphicsContext& graphics_context,
const PropertyTreeState& replay_state,
const IntPoint& offset) const {
Replay(*graphics_context.Canvas(), replay_state, offset);
}
void PaintArtifact::Replay(cc::PaintCanvas& canvas,
const PropertyTreeState& replay_state,
const IntPoint& offset) const {
TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay");
canvas.drawPicture(GetPaintRecord(replay_state, offset));
}
sk_sp<PaintRecord> PaintArtifact::GetPaintRecord( sk_sp<PaintRecord> PaintArtifact::GetPaintRecord(
const PropertyTreeState& replay_state, const PropertyTreeState& replay_state) const {
const IntPoint& offset) const {
return PaintChunksToCcLayer::Convert( return PaintChunksToCcLayer::Convert(
PaintChunkSubset(this), replay_state, PaintChunkSubset(this), replay_state, gfx::Vector2dF(),
gfx::Vector2dF(offset.X(), offset.Y()),
cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer) cc::DisplayItemList::kToBeReleasedAsPaintOpBuffer)
->ReleaseAsRecord(); ->ReleaseAsRecord();
} }
......
...@@ -10,16 +10,9 @@ ...@@ -10,16 +10,9 @@
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/skia/include/core/SkColor.h"
namespace cc {
class PaintCanvas;
}
namespace blink { namespace blink {
class GraphicsContext;
// A PaintArtifact represents the output of painting, consisting of paint chunks // A PaintArtifact represents the output of painting, consisting of paint chunks
// and display items (in DisplayItemList). // and display items (in DisplayItemList).
// //
...@@ -63,20 +56,8 @@ class PLATFORM_EXPORT PaintArtifact final : public RefCounted<PaintArtifact> { ...@@ -63,20 +56,8 @@ class PLATFORM_EXPORT PaintArtifact final : public RefCounted<PaintArtifact> {
// shared with the embedder after copying to cc::DisplayItemList. // shared with the embedder after copying to cc::DisplayItemList.
size_t ApproximateUnsharedMemoryUsage() const; size_t ApproximateUnsharedMemoryUsage() const;
// Draws the paint artifact to a GraphicsContext, into the ancestor state sk_sp<PaintRecord> GetPaintRecord(
// given by |replay_state|. const PropertyTreeState& replay_state) const;
void Replay(GraphicsContext&,
const PropertyTreeState& replay_state,
const IntPoint& offset = IntPoint()) const;
// Draws the paint artifact to a PaintCanvas, into the ancestor state given
// by |replay_state|.
void Replay(cc::PaintCanvas&,
const PropertyTreeState& replay_state,
const IntPoint& offset = IntPoint()) const;
sk_sp<PaintRecord> GetPaintRecord(const PropertyTreeState& replay_state,
const IntPoint& offset = IntPoint()) const;
private: private:
DisplayItemList display_item_list_; DisplayItemList display_item_list_;
......
...@@ -48,9 +48,7 @@ sk_sp<PaintRecord> PaintRecordBuilder::EndRecording( ...@@ -48,9 +48,7 @@ sk_sp<PaintRecord> PaintRecordBuilder::EndRecording(
void PaintRecordBuilder::EndRecording(cc::PaintCanvas& canvas, void PaintRecordBuilder::EndRecording(cc::PaintCanvas& canvas,
const PropertyTreeState& replay_state) { const PropertyTreeState& replay_state) {
paint_controller_->CommitNewDisplayItems(); canvas.drawPicture(EndRecording(replay_state));
paint_controller_->FinishCycle();
paint_controller_->GetPaintArtifact().Replay(canvas, replay_state);
} }
} // namespace blink } // namespace blink
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <memory> #include <memory>
#include "base/macros.h"
#include "third_party/blink/renderer/platform/geometry/float_rect.h"
#include "third_party/blink/renderer/platform/graphics/paint/display_item_client.h" #include "third_party/blink/renderer/platform/graphics/paint/display_item_client.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h"
#include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h" #include "third_party/blink/renderer/platform/graphics/paint/property_tree_state.h"
...@@ -20,6 +18,7 @@ class PaintCanvas; ...@@ -20,6 +18,7 @@ class PaintCanvas;
} }
namespace blink { namespace blink {
class GraphicsContext; class GraphicsContext;
class PaintController; class PaintController;
...@@ -63,8 +62,6 @@ class PLATFORM_EXPORT PaintRecordBuilder final : public DisplayItemClient { ...@@ -63,8 +62,6 @@ class PLATFORM_EXPORT PaintRecordBuilder final : public DisplayItemClient {
PaintController* paint_controller_; PaintController* paint_controller_;
std::unique_ptr<PaintController> own_paint_controller_; std::unique_ptr<PaintController> own_paint_controller_;
std::unique_ptr<GraphicsContext> context_; std::unique_ptr<GraphicsContext> context_;
DISALLOW_COPY_AND_ASSIGN(PaintRecordBuilder);
}; };
} // namespace blink } // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment