提交 c266534d 编写于 作者: A Adam Barth

Remove DrawLooper

We used to use DrawLooper for drawing shadows, but we don't use it anymore.
上级 dc5ed099
......@@ -13,9 +13,7 @@
#include "sky/engine/core/painting/CanvasImage.h"
#include "sky/engine/core/painting/CanvasPath.h"
#include "sky/engine/core/painting/ColorFilter.h"
#include "sky/engine/core/painting/DrawLooperLayerInfo.h"
#include "sky/engine/core/painting/ImageShader.h"
#include "sky/engine/core/painting/LayerDrawLooperBuilder.h"
#include "sky/engine/core/painting/MaskFilter.h"
#include "sky/engine/core/painting/painting.h"
#include "sky/engine/core/painting/Picture.h"
......@@ -52,9 +50,7 @@ void DartUI::InitForGlobal() {
CanvasPath::RegisterNatives(g_natives);
ColorFilter::RegisterNatives(g_natives);
DartRuntimeHooks::RegisterNatives(g_natives);
DrawLooperLayerInfo::RegisterNatives(g_natives);
ImageShader::RegisterNatives(g_natives);
LayerDrawLooperBuilder::RegisterNatives(g_natives);
MaskFilter::RegisterNatives(g_natives);
MojoServices::RegisterNatives(g_natives);
Painting::RegisterNatives(g_natives);
......
......@@ -19,11 +19,8 @@ dart:ui,::,takeServicesProvidedByEmbedder
dart:ui,::,takeServicesProvidedToEmbedder
dart:ui,::,takeShellProxyHandle
dart:ui,Canvas,Canvas.
dart:ui,DrawLooper,DrawLooper.
dart:ui,DrawLooperLayerInfo,DrawLooperLayerInfo.
dart:ui,Image,Image.
dart:ui,ImageShader,ImageShader.
dart:ui,LayerDrawLooperBuilder,LayerDrawLooperBuilder.
dart:ui,Paragraph,Paragraph.
dart:ui,ParagraphBuilder,ParagraphBuilder.
dart:ui,Path,Path.
......
......@@ -28,15 +28,9 @@ sky_core_files = [
"painting/CanvasPath.h",
"painting/ColorFilter.cpp",
"painting/ColorFilter.h",
"painting/DrawLooper.cpp",
"painting/DrawLooper.h",
"painting/DrawLooperLayerInfo.cpp",
"painting/DrawLooperLayerInfo.h",
"painting/FilterQuality.h",
"painting/ImageShader.cpp",
"painting/ImageShader.h",
"painting/LayerDrawLooperBuilder.cpp",
"painting/LayerDrawLooperBuilder.h",
"painting/MaskFilter.cpp",
"painting/MaskFilter.h",
"painting/Matrix.cpp",
......
......@@ -45,45 +45,6 @@ class Path extends NativeFieldWrapperClass2 {
Path shift(Offset offset) native "Path_shift";
}
abstract class DrawLooper extends NativeFieldWrapperClass2 {
}
/// Paint masks for DrawLooperLayerInfo.setPaintBits. These specify which
/// aspects of the layer's paint should replace the corresponding aspects on
/// the draw's paint.
///
/// PaintBits.all means use the layer's paint completely.
/// 0 means ignore the layer's paint... except for colorMode, which is
/// always applied.
class PaintBits {
static const int style = 0x1;
static const int testSkewx = 0x2;
static const int pathEffect = 0x4;
static const int maskFilter = 0x8;
static const int shader = 0x10;
static const int colorFilter = 0x20;
static const int xfermode = 0x40;
static const int all = 0xFFFFFFFF;
}
class DrawLooperLayerInfo extends NativeFieldWrapperClass2 {
void _constructor() native "DrawLooperLayerInfo_constructor";
DrawLooperLayerInfo() { _constructor(); }
void setPaintBits(int bits) native "DrawLooperLayerInfo_setPaintBits";
void setColorMode(TransferMode mode) native "DrawLooperLayerInfo_setColorMode";
void setOffset(Offset offset) native "DrawLooperLayerInfo_setOffset";
void setPostTranslate(bool postTranslate) native "DrawLooperLayerInfo_setPostTranslate";
}
class LayerDrawLooperBuilder extends NativeFieldWrapperClass2 {
void _constructor() native "LayerDrawLooperBuilder_constructor";
LayerDrawLooperBuilder() { _constructor(); }
DrawLooper build() native "LayerDrawLooperBuilder_build";
void addLayerOnTop(DrawLooperLayerInfo info, Paint paint) native "LayerDrawLooperBuilder_addLayerOnTop";
}
/// Blur styles. These mirror SkBlurStyle and must be kept in sync.
enum BlurStyle {
/// Fuzzy inside and outside.
......
// 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/DrawLooper.h"
namespace blink {
IMPLEMENT_WRAPPERTYPEINFO(ui, DrawLooper);
DrawLooper::DrawLooper(PassRefPtr<SkDrawLooper> looper)
: looper_(looper) {
}
DrawLooper::~DrawLooper() {
}
} // 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_DRAWLOOPER_H_
#define SKY_ENGINE_CORE_PAINTING_DRAWLOOPER_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/SkDrawLooper.h"
namespace blink {
class DrawLooper : public RefCounted<DrawLooper>, public DartWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
~DrawLooper() override;
static PassRefPtr<DrawLooper> create(PassRefPtr<SkDrawLooper> looper) {
return adoptRef(new DrawLooper(looper));
}
SkDrawLooper* looper() { return looper_.get(); }
private:
DrawLooper(PassRefPtr<SkDrawLooper> looper);
RefPtr<SkDrawLooper> looper_;
};
} // namespace blink
#endif // SKY_ENGINE_CORE_PAINTING_DRAWLOOPER_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.
#include "sky/engine/core/painting/DrawLooperLayerInfo.h"
#include "sky/engine/tonic/dart_args.h"
#include "sky/engine/tonic/dart_binding_macros.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_library_natives.h"
namespace blink {
static void DrawLooperLayerInfo_constructor(Dart_NativeArguments args) {
DartCallConstructor(&DrawLooperLayerInfo::create, args);
}
IMPLEMENT_WRAPPERTYPEINFO(ui, DrawLooperLayerInfo);
#define FOR_EACH_BINDING(V) \
V(DrawLooperLayerInfo, setPaintBits) \
V(DrawLooperLayerInfo, setColorMode) \
V(DrawLooperLayerInfo, setOffset) \
V(DrawLooperLayerInfo, setPostTranslate)
FOR_EACH_BINDING(DART_NATIVE_CALLBACK)
void DrawLooperLayerInfo::RegisterNatives(DartLibraryNatives* natives) {
natives->Register({
{ "DrawLooperLayerInfo_constructor", DrawLooperLayerInfo_constructor, 1, true },
FOR_EACH_BINDING(DART_REGISTER_NATIVE)
});
}
DrawLooperLayerInfo::DrawLooperLayerInfo() {
}
DrawLooperLayerInfo::~DrawLooperLayerInfo() {
}
} // 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_DRAWLOOPERLAYERINFO_H_
#define SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_H_
#include "dart/runtime/include/dart_api.h"
#include "sky/engine/core/painting/Offset.h"
#include "sky/engine/core/painting/TransferMode.h"
#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/wtf/RefCounted.h"
#include "third_party/skia/include/core/SkPoint.h"
#include "third_party/skia/include/effects/SkLayerDrawLooper.h"
namespace blink {
class DartLibraryNatives;
class DrawLooperLayerInfo : public RefCounted<DrawLooperLayerInfo>,
public DartWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
static PassRefPtr<DrawLooperLayerInfo> create()
{
return adoptRef(new DrawLooperLayerInfo);
}
~DrawLooperLayerInfo() override;
void setPaintBits(unsigned bits) { layer_info_.fPaintBits = bits; }
void setColorMode(TransferMode mode) { layer_info_.fColorMode = mode; }
void setOffset(Offset offset) { layer_info_.fOffset = SkPoint::Make(offset.sk_size.width(), offset.sk_size.height()); }
void setPostTranslate(bool val) { layer_info_.fPostTranslate = val; }
const SkLayerDrawLooper::LayerInfo& layer_info() const { return layer_info_; }
static void RegisterNatives(DartLibraryNatives* natives);
private:
DrawLooperLayerInfo();
SkLayerDrawLooper::LayerInfo layer_info_;
};
} // namespace blink
#endif // SKY_ENGINE_CORE_PAINTING_DRAWLOOPERLAYERINFO_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.
#include "sky/engine/core/painting/LayerDrawLooperBuilder.h"
#include "sky/engine/core/painting/DrawLooper.h"
#include "sky/engine/core/painting/DrawLooperLayerInfo.h"
#include "sky/engine/core/painting/Paint.h"
#include "sky/engine/tonic/dart_args.h"
#include "sky/engine/tonic/dart_binding_macros.h"
#include "sky/engine/tonic/dart_converter.h"
#include "sky/engine/tonic/dart_library_natives.h"
#include "third_party/skia/include/core/SkColorFilter.h"
namespace blink {
static void LayerDrawLooperBuilder_constructor(Dart_NativeArguments args) {
DartCallConstructor(&LayerDrawLooperBuilder::create, args);
}
IMPLEMENT_WRAPPERTYPEINFO(ui, LayerDrawLooperBuilder);
#define FOR_EACH_BINDING(V) \
V(LayerDrawLooperBuilder, build) \
V(LayerDrawLooperBuilder, addLayerOnTop)
FOR_EACH_BINDING(DART_NATIVE_CALLBACK)
void LayerDrawLooperBuilder::RegisterNatives(DartLibraryNatives* natives) {
natives->Register({
{ "LayerDrawLooperBuilder_constructor", LayerDrawLooperBuilder_constructor, 1, true },
FOR_EACH_BINDING(DART_REGISTER_NATIVE)
});
}
LayerDrawLooperBuilder::LayerDrawLooperBuilder() {
}
LayerDrawLooperBuilder::~LayerDrawLooperBuilder() {
}
PassRefPtr<DrawLooper> LayerDrawLooperBuilder::build() {
return DrawLooper::create(adoptRef(draw_looper_builder_.detachLooper()));
}
void LayerDrawLooperBuilder::addLayerOnTop(
DrawLooperLayerInfo* layer_info, const Paint& paint) {
SkPaint* sk_paint =
draw_looper_builder_.addLayerOnTop(layer_info->layer_info());
if (!paint.is_null)
*sk_paint = paint.sk_paint;
}
} // 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_LAYERDRAWLOOPERBUILDER_H_
#define SKY_ENGINE_CORE_PAINTING_LAYERDRAWLOOPERBUILDER_H_
#include "sky/engine/core/painting/Paint.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/effects/SkLayerDrawLooper.h"
namespace blink {
class DartLibraryNatives;
class DrawLooper;
class DrawLooperLayerInfo;
class LayerDrawLooperBuilder : public RefCounted<LayerDrawLooperBuilder>,
public DartWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
~LayerDrawLooperBuilder() override;
static PassRefPtr<LayerDrawLooperBuilder> create() {
return adoptRef(new LayerDrawLooperBuilder);
}
PassRefPtr<DrawLooper> build();
void addLayerOnTop(DrawLooperLayerInfo* layer_info, const Paint& paint);
static void RegisterNatives(DartLibraryNatives* natives);
private:
LayerDrawLooperBuilder();
SkLayerDrawLooper::Builder draw_looper_builder_;
};
} // namespace blink
#endif // SKY_ENGINE_CORE_PAINTING_LAYERDRAWLOOPERBUILDER_H_
......@@ -6,7 +6,6 @@
#include "sky/engine/core/painting/CanvasColor.h"
#include "sky/engine/core/painting/ColorFilter.h"
#include "sky/engine/core/painting/DrawLooper.h"
#include "sky/engine/core/painting/FilterQuality.h"
#include "sky/engine/core/painting/MaskFilter.h"
#include "sky/engine/core/painting/PaintingStyle.h"
......@@ -28,7 +27,6 @@ enum PaintFields {
kIsAntiAlias,
kColor,
kColorFilter,
kDrawLooper,
kFilterQuality,
kMaskFilter,
kShader,
......@@ -83,8 +81,6 @@ Paint DartConverter<Paint>::FromDart(Dart_Handle dart_paint) {
paint.setColor(DartConverter<CanvasColor>::FromDart(values[kColor]));
if (!Dart_IsNull(values[kColorFilter]))
paint.setColorFilter(DartConverter<ColorFilter*>::FromDart(values[kColorFilter])->filter());
if (!Dart_IsNull(values[kDrawLooper]))
paint.setLooper(DartConverter<DrawLooper*>::FromDart(values[kDrawLooper])->looper());
if (!Dart_IsNull(values[kFilterQuality]))
paint.setFilterQuality(DartConverter<FilterQuality>::FromDart(values[kFilterQuality]));
if (!Dart_IsNull(values[kMaskFilter]))
......
......@@ -20,7 +20,6 @@ class Paint {
bool isAntiAlias = true;
Color color = const Color(0xFF000000);
ColorFilter colorFilter;
DrawLooper drawLooper;
FilterQuality filterQuality;
MaskFilter maskFilter;
Shader shader;
......@@ -37,7 +36,6 @@ class Paint {
strokeWidth == null &&
isAntiAlias &&
colorFilter == null &&
drawLooper == null &&
filterQuality == null &&
maskFilter == null &&
shader == null &&
......@@ -52,7 +50,6 @@ class Paint {
isAntiAlias,
color,
colorFilter,
drawLooper,
filterQuality,
maskFilter,
shader,
......@@ -70,9 +67,6 @@ class Paint {
result += ', colorFilter: $colorFilter';
if (maskFilter != null)
result += ', maskFilter: $maskFilter';
// TODO(mpcomplete): Figure out how to show a drawLooper.
if (drawLooper != null)
result += ', drawLooper:true';
result += ')';
return result;
}
......
......@@ -17,7 +17,6 @@
namespace blink {
class DrawLooper;
class ColorFilter;
class MaskFilter;
class Shader;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册