| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/gfx/compositor/render/render_frame.h" | 5 #include "services/gfx/compositor/render/render_frame.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "services/gfx/compositor/render/render_layer.h" | |
| 9 #include "skia/ext/refptr.h" | 8 #include "skia/ext/refptr.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 11 #include "third_party/skia/include/core/SkPicture.h" | 10 #include "third_party/skia/include/core/SkPicture.h" |
| 12 #include "third_party/skia/include/core/SkPoint.h" | |
| 13 | 11 |
| 14 namespace compositor { | 12 namespace compositor { |
| 15 | 13 |
| 16 RenderFrame::RenderFrame(const std::shared_ptr<RenderLayer>& root_layer, | 14 RenderFrame::RenderFrame(const skia::RefPtr<SkPicture>& picture, |
| 17 const SkRect& viewport, | 15 const SkRect& viewport, |
| 18 const mojo::gfx::composition::FrameInfo& frame_info) | 16 const mojo::gfx::composition::FrameInfo& frame_info) |
| 19 : root_layer_(root_layer), viewport_(viewport), frame_info_(frame_info) { | 17 : picture_(picture), viewport_(viewport), frame_info_(frame_info) { |
| 20 DCHECK(root_layer_); | 18 DCHECK(picture_); |
| 21 } | 19 } |
| 22 | 20 |
| 23 RenderFrame::~RenderFrame() {} | 21 RenderFrame::~RenderFrame() {} |
| 24 | 22 |
| 25 void RenderFrame::Paint(SkCanvas* canvas) const { | 23 void RenderFrame::Paint(SkCanvas* canvas) const { |
| 24 DCHECK(canvas); |
| 25 |
| 26 // TODO: Consider using GrDrawContext instead of SkCanvas. | 26 // TODO: Consider using GrDrawContext instead of SkCanvas. |
| 27 canvas->clear(SK_ColorBLACK); | 27 canvas->clear(SK_ColorBLACK); |
| 28 canvas->drawPicture(root_layer_->picture().get()); | 28 canvas->drawPicture(picture_.get()); |
| 29 canvas->flush(); | |
| 30 } | |
| 31 | |
| 32 mojo::gfx::composition::HitTestResultPtr RenderFrame::HitTest( | |
| 33 const SkPoint& point) const { | |
| 34 // TODO: implement me | |
| 35 auto result = mojo::gfx::composition::HitTestResult::New(); | |
| 36 result->hits.resize(0u); | |
| 37 return result.Pass(); | |
| 38 } | 29 } |
| 39 | 30 |
| 40 } // namespace compositor | 31 } // namespace compositor |
| OLD | NEW |