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

Remove IDL for DrawLooper-related interfaces

上级 2c8d6ac3
......@@ -8,6 +8,8 @@
#include "sky/engine/bindings/dart_runtime_hooks.h"
#include "sky/engine/core/compositing/Scene.h"
#include "sky/engine/core/compositing/SceneBuilder.h"
#include "sky/engine/core/painting/DrawLooperLayerInfo.h"
#include "sky/engine/core/painting/LayerDrawLooperBuilder.h"
#include "sky/engine/core/painting/painting.h"
#include "sky/engine/core/text/Paragraph.h"
#include "sky/engine/core/text/ParagraphBuilder.h"
......@@ -42,6 +44,8 @@ void DartUI::InitForIsolate() {
if (!g_natives) {
g_natives = new DartLibraryNatives();
DartRuntimeHooks::RegisterNatives(g_natives);
DrawLooperLayerInfo::RegisterNatives(g_natives);
LayerDrawLooperBuilder::RegisterNatives(g_natives);
Painting::RegisterNatives(g_natives);
Paragraph::RegisterNatives(g_natives);
ParagraphBuilder::RegisterNatives(g_natives);
......
......@@ -236,12 +236,9 @@ sky_core_files = [
core_idl_files = get_path_info([
"painting/Canvas.idl",
"painting/ColorFilter.idl",
"painting/DrawLooper.idl",
"painting/DrawLooperLayerInfo.idl",
"painting/Gradient.idl",
"painting/Image.idl",
"painting/ImageShader.idl",
"painting/LayerDrawLooperBuilder.idl",
"painting/MaskFilter.idl",
"painting/Path.idl",
"painting/Picture.idl",
......@@ -261,7 +258,6 @@ core_dart_files = get_path_info([
"dart/window.dart",
"painting/Color.dart",
"painting/ColorFilter.dart",
"painting/DrawLooperLayerInfo.dart",
"painting/FilterQuality.dart",
"painting/Gradient.dart",
"painting/ImageShader.dart",
......
......@@ -11,3 +11,42 @@ void decodeImageFromDataPipe(int handle, _ImageDecoderCallback callback)
void decodeImageFromList(Uint8List list, _ImageDecoderCallback callback)
native "decodeImageFromList";
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";
}
......@@ -6,6 +6,8 @@
namespace blink {
IMPLEMENT_WRAPPERTYPEINFO(DrawLooper);
DrawLooper::DrawLooper(PassRefPtr<SkDrawLooper> looper)
: looper_(looper) {
}
......
// 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 DrawLooper {
};
......@@ -3,9 +3,34 @@
// 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(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() {
}
......
// 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.
part of dart_ui;
/// 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;
}
......@@ -13,6 +13,7 @@
#include "third_party/skia/include/effects/SkLayerDrawLooper.h"
namespace blink {
class DartLibraryNatives;
class DrawLooperLayerInfo : public RefCounted<DrawLooperLayerInfo>,
public DartWrappable {
......@@ -25,12 +26,14 @@ class DrawLooperLayerInfo : public RefCounted<DrawLooperLayerInfo>,
~DrawLooperLayerInfo() override;
void setPaintBits(unsigned bits) { layer_info_.fPaintBits = bits; }
void setColorMode(SkXfermode::Mode mode) { layer_info_.fColorMode = mode; }
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();
......
// 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.
[
Constructor(),
] interface DrawLooperLayerInfo {
// Specifies which aspects of the layer's paint should replace the
// corresponding aspects on the draw's paint. Use PaintBits, defined in
// DrawLooperLayerInfo.dart.
void setPaintBits(unsigned long bits);
void setColorMode(TransferMode mode);
void setOffset(Offset offset);
void setPostTranslate(boolean postTranslate);
};
......@@ -7,10 +7,33 @@
#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(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() {
}
......
......@@ -12,7 +12,7 @@
#include "third_party/skia/include/effects/SkLayerDrawLooper.h"
namespace blink {
class DartLibraryNatives;
class DrawLooper;
class DrawLooperLayerInfo;
......@@ -28,6 +28,8 @@ class LayerDrawLooperBuilder : public RefCounted<LayerDrawLooperBuilder>,
PassRefPtr<DrawLooper> build();
void addLayerOnTop(DrawLooperLayerInfo* layer_info, const Paint& paint);
static void RegisterNatives(DartLibraryNatives* natives);
private:
LayerDrawLooperBuilder();
......
// 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.
[
Constructor()
] interface LayerDrawLooperBuilder {
// Returns a DrawLooper based on the construction operations, and resets the
// builder back to a default state.
DrawLooper build();
void addLayerOnTop(DrawLooperLayerInfo info, Paint paint);
};
......@@ -102,9 +102,9 @@ Paint DartConverter<Paint>::FromDart(Dart_Handle dart_paint) {
return result;
}
Paint DartConverter<Paint>::FromArgumentsWithNullCheck(Dart_NativeArguments args,
int index,
Dart_Handle& exception) {
Paint DartConverter<Paint>::FromArguments(Dart_NativeArguments args,
int index,
Dart_Handle& exception) {
Dart_Handle dart_rect = Dart_GetNativeArgument(args, index);
DCHECK(!LogIfError(dart_rect));
return FromDart(dart_rect);
......
......@@ -33,9 +33,14 @@ class Paint {
template <>
struct DartConverter<Paint> {
static Paint FromDart(Dart_Handle handle);
static Paint FromArguments(Dart_NativeArguments args,
int index,
Dart_Handle& exception);
static Paint FromArgumentsWithNullCheck(Dart_NativeArguments args,
int index,
Dart_Handle& exception);
Dart_Handle& exception) {
return FromArguments(args, index, exception);
}
};
class StrokeCap {};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册