| Index: ui/views/view.cc
|
| diff --git a/ui/views/view.cc b/ui/views/view.cc
|
| index 99148d5f45b013f09f60e6eecc50a8e40f5e354f..2c39d25c2a74165342e03b3ba6bd7f4c1cc712cd 100644
|
| --- a/ui/views/view.cc
|
| +++ b/ui/views/view.cc
|
| @@ -17,7 +17,6 @@
|
| #include "base/trace_event/trace_event.h"
|
| #include "cc/resources/display_item_list.h"
|
| #include "cc/resources/drawing_display_item.h"
|
| -#include "third_party/skia/include/core/SkPictureRecorder.h"
|
| #include "third_party/skia/include/core/SkRect.h"
|
| #include "ui/accessibility/ax_enums.h"
|
| #include "ui/base/cursor/cursor.h"
|
| @@ -26,6 +25,7 @@
|
| #include "ui/compositor/dip_util.h"
|
| #include "ui/compositor/layer.h"
|
| #include "ui/compositor/layer_animator.h"
|
| +#include "ui/compositor/paint_recorder.h"
|
| #include "ui/events/event_target_iterator.h"
|
| #include "ui/gfx/canvas.h"
|
| #include "ui/gfx/geometry/point3_f.h"
|
| @@ -1468,29 +1468,22 @@ void View::OnPaintLayerToDisplayList(cc::DisplayItemList* list,
|
| float device_scale_factor) {
|
| TRACE_EVENT1("views", "View::OnPaintToDisplayList", "class", GetClassName());
|
|
|
| + // TODO(danakj): Instead of always recording, cache a picture in each view and
|
| + // reuse it when not invalidated. ie. just AppendItem() and return here.
|
| +
|
| // TODO(danakj): Does this include the bounds of all children?
|
| // TODO(danakj): Should this be the layer's bounds?
|
| + // TODO(danakj): The paint code does transforms on the canvas to position
|
| + // children, but each DisplayItem's recording bounds and origin should be
|
| + // relative to the layer, I think.
|
| gfx::Rect view_bounds = GetLocalBounds();
|
|
|
| - // TODO(danakj): Instead of always recording, cache a picture in each view and
|
| - // reuse it when not invalidated.
|
| - SkPictureRecorder recorder;
|
| - SkRTreeFactory* no_factory = nullptr;
|
| - skia::RefPtr<SkCanvas> skcanvas = skia::SharePtr(recorder.beginRecording(
|
| - view_bounds.width(), view_bounds.height(), no_factory,
|
| - SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag));
|
| - skcanvas->clipRect(gfx::RectToSkRect(view_bounds));
|
| -
|
| - {
|
| - scoped_ptr<gfx::Canvas> canvas(gfx::Canvas::CreateCanvasWithoutScaling(
|
| - skcanvas.get(), device_scale_factor));
|
| - OnPaintLayer(canvas.get());
|
| - }
|
| + ui::PaintRecorder recorder(view_bounds, device_scale_factor);
|
| + OnPaintLayer(recorder.canvas());
|
|
|
| - skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
|
| - scoped_ptr<cc::DrawingDisplayItem> item =
|
| - cc::DrawingDisplayItem::Create(picture);
|
| - list->AppendItem(item.Pass());
|
| + // TODO(danakj): Cache this picture in the View and reuse it.
|
| + scoped_ptr<cc::DrawingDisplayItem> item = recorder.TakeDisplayItem();
|
| + list->AppendItem(item->Clone());
|
| }
|
|
|
| void View::OnPaintLayer(gfx::Canvas* canvas) {
|
|
|