提交 5f62ffe1 编写于 作者: A Adam Barth

Swith from skia::RefPtr to RefPtr

Now that we can use WTF everywhere, we don't need to use skia::RefPtr.
上级 2dccf620
......@@ -8,7 +8,9 @@
#include "services/sky/compositor/layer_host.h"
#include "services/sky/compositor/picture_serializer.h"
#include "services/sky/compositor/rasterizer.h"
#include "sky/engine/wtf/RefPtr.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
namespace sky {
......@@ -26,7 +28,7 @@ void Layer::SetSize(const gfx::Size& size) {
void Layer::Display() {
TRACE_EVENT0("sky", "Layer::Display");
DCHECK(rasterizer_);
auto picture = RecordPicture();
RefPtr<SkPicture> picture = RecordPicture();
#if 0
SerializePicture(
......@@ -36,18 +38,18 @@ void Layer::Display() {
texture_ = rasterizer_->Rasterize(picture.get());
}
skia::RefPtr<SkPicture> Layer::RecordPicture() {
PassRefPtr<SkPicture> Layer::RecordPicture() {
TRACE_EVENT0("sky", "Layer::RecordPicture");
SkRTreeFactory factory;
SkPictureRecorder recorder;
auto canvas = skia::SharePtr(recorder.beginRecording(
SkCanvas* canvas = recorder.beginRecording(
size_.width(), size_.height(), &factory,
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag));
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
client_->PaintContents(canvas.get(), gfx::Rect(size_));
return skia::AdoptRef(recorder.endRecordingAsPicture());
client_->PaintContents(canvas, gfx::Rect(size_));
return adoptRef(recorder.endRecordingAsPicture());
}
scoped_ptr<mojo::GLTexture> Layer::GetTexture() {
......
......@@ -9,7 +9,7 @@
#include "mojo/gpu/gl_texture.h"
#include "services/sky/compositor/layer_client.h"
#include "services/sky/compositor/rasterizer.h"
#include "skia/ext/refptr.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "ui/gfx/geometry/rect.h"
......@@ -36,7 +36,7 @@ class Layer : public base::RefCounted<Layer> {
friend class base::RefCounted<Layer>;
~Layer();
skia::RefPtr<SkPicture> RecordPicture();
PassRefPtr<SkPicture> RecordPicture();
LayerClient* client_;
gfx::Size size_;
......
......@@ -195,9 +195,7 @@ void DocumentView::PaintContents(SkCanvas* canvas, const gfx::Rect& clip) {
blink::WebRect rect(clip.x(), clip.y(), clip.width(), clip.height());
if (sky_view_) {
skia::RefPtr<SkPicture> picture = sky_view_->Paint();
canvas->clear(SK_ColorBLACK);
canvas->scale(GetDevicePixelRatio(), GetDevicePixelRatio());
RefPtr<SkPicture> picture = sky_view_->Paint();
if (picture)
canvas->drawPicture(picture.get());
}
......
......@@ -52,10 +52,10 @@ void SkyView::BeginFrame(base::TimeTicks frame_time) {
view_->beginFrame(frame_time);
}
skia::RefPtr<SkPicture> SkyView::Paint() {
PassRefPtr<SkPicture> SkyView::Paint() {
if (Picture* picture = view_->picture())
return skia::SharePtr(picture->toSkia());
return skia::RefPtr<SkPicture>();
return picture->toSkia();
return nullptr;
}
void SkyView::HandleInputEvent(const WebInputEvent& inputEvent) {
......
......@@ -11,7 +11,6 @@
#include "base/time/time.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "mojo/services/network/public/interfaces/url_loader.mojom.h"
#include "skia/ext/refptr.h"
#include "sky/engine/public/platform/WebCommon.h"
#include "sky/engine/public/platform/WebURL.h"
#include "sky/engine/public/platform/sky_display_metrics.h"
......@@ -41,7 +40,7 @@ class SkyView {
void RunFromSnapshot(const WebString& name,
mojo::ScopedDataPipeConsumerHandle snapshot);
skia::RefPtr<SkPicture> Paint();
PassRefPtr<SkPicture> Paint();
void HandleInputEvent(const WebInputEvent& event);
private:
......
......@@ -20,7 +20,7 @@ GaneshSurface::GaneshSurface(intptr_t window_fbo,
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fRenderTargetHandle = window_fbo;
auto target = skia::AdoptRef(
skia::RefPtr<GrRenderTarget> target = skia::AdoptRef(
context->gr()->textureProvider()->wrapBackendRenderTarget(desc));
DCHECK(target);
surface_ = skia::AdoptRef(SkSurface::NewRenderTargetDirect(target.get()));
......
......@@ -6,7 +6,7 @@
#define SKY_SHELL_GPU_GANESH_SURFACE_H_
#include "base/memory/scoped_ptr.h"
#include "skia/ext/refptr.h"
#include "sky/engine/wtf/RefPtr.h"
#include "sky/shell/gpu/ganesh_context.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/geometry/size.h"
......
......@@ -43,7 +43,7 @@ void Rasterizer::OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) {
CHECK(surface_) << "GLSurface required.";
}
void Rasterizer::Draw(skia::RefPtr<SkPicture> picture) {
void Rasterizer::Draw(PassRefPtr<SkPicture> picture) {
TRACE_EVENT0("sky", "Rasterizer::Draw");
if (!surface_)
......
......@@ -34,7 +34,7 @@ class Rasterizer : public GPUDelegate {
void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override;
void OnOutputSurfaceDestroyed() override;
void Draw(skia::RefPtr<SkPicture> picture) override;
void Draw(PassRefPtr<SkPicture> picture) override;
private:
void EnsureGLContext();
......
......@@ -5,7 +5,7 @@
#ifndef SKY_SHELL_GPU_DELEGATE_H_
#define SKY_SHELL_GPU_DELEGATE_H_
#include "skia/ext/refptr.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "ui/gfx/native_widget_types.h"
class SkPicture;
......@@ -17,7 +17,7 @@ class GPUDelegate {
public:
virtual void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) = 0;
virtual void OnOutputSurfaceDestroyed() = 0;
virtual void Draw(skia::RefPtr<SkPicture> picture) = 0;
virtual void Draw(PassRefPtr<SkPicture> picture) = 0;
protected:
virtual ~GPUDelegate();
......
......@@ -72,7 +72,7 @@ void Animator::BeginFrame(int64_t time_stamp) {
base::TimeTicks::FromInternalValue(time_stamp) : base::TimeTicks::Now();
engine_->BeginFrame(frame_time);
skia::RefPtr<SkPicture> picture = engine_->Paint();
RefPtr<SkPicture> picture = engine_->Paint();
config_.gpu_task_runner->PostTaskAndReply(
FROM_HERE,
......
......@@ -103,17 +103,17 @@ void Engine::BeginFrame(base::TimeTicks frame_time) {
sky_view_->BeginFrame(frame_time);
}
skia::RefPtr<SkPicture> Engine::Paint() {
PassRefPtr<SkPicture> Engine::Paint() {
TRACE_EVENT0("sky", "Engine::Paint");
SkRTreeFactory factory;
SkPictureRecorder recorder;
auto canvas = skia::SharePtr(recorder.beginRecording(
SkCanvas* canvas = recorder.beginRecording(
physical_size_.width(), physical_size_.height(), &factory,
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag));
SkPictureRecorder::kComputeSaveLayerInfo_RecordFlag);
if (sky_view_) {
skia::RefPtr<SkPicture> picture = sky_view_->Paint();
RefPtr<SkPicture> picture = sky_view_->Paint();
canvas->clear(SK_ColorBLACK);
canvas->scale(display_metrics_.device_pixel_ratio,
display_metrics_.device_pixel_ratio);
......@@ -121,7 +121,7 @@ skia::RefPtr<SkPicture> Engine::Paint() {
canvas->drawPicture(picture.get());
}
return skia::AdoptRef(recorder.endRecordingAsPicture());
return adoptRef(recorder.endRecordingAsPicture());
}
void Engine::ConnectToEngine(mojo::InterfaceRequest<SkyEngine> request) {
......
......@@ -54,7 +54,7 @@ class Engine : public UIDelegate,
static void Init();
void BeginFrame(base::TimeTicks frame_time);
skia::RefPtr<SkPicture> Paint();
PassRefPtr<SkPicture> Paint();
private:
// UIDelegate implementation:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册