提交 2c8d6ac3 编写于 作者: A Adam Barth

Merge pull request #2197 from abarth/rm_drawable

Remove Drawable interface
......@@ -39,8 +39,6 @@ sky_core_files = [
"painting/CanvasPath.h",
"painting/ColorFilter.cpp",
"painting/ColorFilter.h",
"painting/Drawable.cpp",
"painting/Drawable.h",
"painting/DrawLooper.cpp",
"painting/DrawLooper.h",
"painting/DrawLooperLayerInfo.cpp",
......@@ -238,7 +236,6 @@ sky_core_files = [
core_idl_files = get_path_info([
"painting/Canvas.idl",
"painting/ColorFilter.idl",
"painting/Drawable.idl",
"painting/DrawLooper.idl",
"painting/DrawLooperLayerInfo.idl",
"painting/Gradient.idl",
......
......@@ -227,14 +227,6 @@ void Canvas::drawPicture(Picture* picture)
m_canvas->drawPicture(picture->toSkia());
}
void Canvas::drawDrawable(Drawable* drawable)
{
if (!m_canvas)
return;
ASSERT(drawable);
m_canvas->drawDrawable(drawable->toSkia());
}
void Canvas::drawVertices(SkCanvas::VertexMode vertexMode,
const Vector<Point>& vertices,
const Vector<Point>& textureCoordinates,
......
......@@ -7,7 +7,6 @@
#include "sky/engine/bindings/exception_state.h"
#include "sky/engine/core/painting/CanvasPath.h"
#include "sky/engine/core/painting/Drawable.h"
#include "sky/engine/core/painting/Offset.h"
#include "sky/engine/core/painting/Paint.h"
#include "sky/engine/core/painting/Picture.h"
......@@ -90,7 +89,6 @@ public:
void drawImageRect(const CanvasImage* image, Rect& src, Rect& dst, const Paint& paint);
void drawImageNine(const CanvasImage* image, Rect& center, Rect& dst, const Paint& paint);
void drawPicture(Picture* picture);
void drawDrawable(Drawable* drawable);
void drawVertices(SkCanvas::VertexMode vertexMode,
const Vector<Point>& vertices,
......
......@@ -39,7 +39,6 @@
void drawImageRect(Image image, Rect src, Rect dst, Paint paint);
void drawImageNine(Image image, Rect center, Rect dst, Paint paint);
void drawPicture(Picture picture);
void drawDrawable(Drawable drawable);
[RaisesException] void drawVertices(VertexMode vertexMode, sequence<Point> vertices, sequence<Point> textureCoordinates, sequence<Color> colors, TransferMode transferMode, sequence<long> indicies, Paint paint);
// TODO(eseidel): Paint should be optional, but optional doesn't work.
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/engine/core/painting/Drawable.h"
#include "sky/engine/core/painting/Picture.h"
namespace blink {
PassRefPtr<Drawable> Drawable::create(PassRefPtr<SkDrawable> skDrawable)
{
ASSERT(skDrawable);
return adoptRef(new Drawable(skDrawable));
}
Drawable::Drawable(PassRefPtr<SkDrawable> skDrawable)
: m_drawable(skDrawable)
{
}
PassRefPtr<Picture> Drawable::newPictureSnapshot()
{
if (!m_drawable)
return nullptr;
return Picture::create(
adoptRef(m_drawable->newPictureSnapshot()));
}
Drawable::~Drawable()
{
}
} // namespace blink
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_ENGINE_CORE_PAINTING_DRAWABLE_H_
#define SKY_ENGINE_CORE_PAINTING_DRAWABLE_H_
#include "sky/engine/core/painting/Picture.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/wtf/PassRefPtr.h"
#include "sky/engine/wtf/RefCounted.h"
#include "third_party/skia/include/core/SkDrawable.h"
namespace blink {
class Drawable : public RefCounted<Drawable>, public DartWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
static PassRefPtr<Drawable> create(PassRefPtr<SkDrawable> skDrawable);
~Drawable() override;
PassRefPtr<Picture> newPictureSnapshot();
SkDrawable* toSkia() const { return m_drawable.get(); }
private:
explicit Drawable(PassRefPtr<SkDrawable> skDrawable);
RefPtr<SkDrawable> m_drawable;
};
} // namespace blink
#endif // SKY_ENGINE_CORE_PAINTING_DRAWABLE_H_
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
interface Drawable {
Picture newPictureSnapshot();
};
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "sky/engine/core/painting/Canvas.h"
#include "sky/engine/core/painting/Drawable.h"
#include "sky/engine/core/painting/Picture.h"
#include "sky/engine/core/painting/PictureRecorder.h"
......@@ -40,19 +39,6 @@ PassRefPtr<Picture> PictureRecorder::endRecording()
return picture.release();
}
PassRefPtr<Drawable> PictureRecorder::endRecordingAsDrawable()
{
if (!isRecording())
return nullptr;
RefPtr<Drawable> drawable = Drawable::create(
adoptRef(m_pictureRecorder.endRecordingAsDrawable()));
m_canvas->clearSkCanvas();
m_canvas->ClearDartWrapper();
m_canvas = nullptr;
ClearDartWrapper();
return drawable.release();
}
void PictureRecorder::set_canvas(PassRefPtr<Canvas> canvas)
{
m_canvas = canvas;
......
......@@ -14,7 +14,6 @@
namespace blink {
class Canvas;
class Drawable;
class Picture;
class PictureRecorder : public RefCounted<PictureRecorder>,
......@@ -28,10 +27,8 @@ public:
~PictureRecorder();
// PassRefPtr<Canvas> beginRecording(double width, double height);
SkCanvas* beginRecording(Rect bounds);
PassRefPtr<Picture> endRecording();
PassRefPtr<Drawable> endRecordingAsDrawable();
bool isRecording();
void set_canvas(PassRefPtr<Canvas> canvas);
......
......@@ -5,5 +5,4 @@
Constructor()
] interface PictureRecorder {
Picture endRecording();
Drawable endRecordingAsDrawable();
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册