mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
61 lines
2.1 KiB
C++
61 lines
2.1 KiB
C++
// 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_COMPOSITING_SCENEBUILDER_H_
|
|
#define SKY_ENGINE_CORE_COMPOSITING_SCENEBUILDER_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "sky/compositor/layer.h"
|
|
#include "sky/engine/bindings/exception_state.h"
|
|
#include "sky/engine/core/compositing/Scene.h"
|
|
#include "sky/engine/core/painting/CanvasPath.h"
|
|
#include "sky/engine/core/painting/Offset.h"
|
|
#include "sky/engine/core/painting/Paint.h"
|
|
#include "sky/engine/core/painting/Picture.h"
|
|
#include "sky/engine/core/painting/Point.h"
|
|
#include "sky/engine/core/painting/Rect.h"
|
|
#include "sky/engine/core/painting/RRect.h"
|
|
#include "sky/engine/core/painting/Size.h"
|
|
#include "sky/engine/tonic/dart_wrappable.h"
|
|
#include "sky/engine/tonic/float32_list.h"
|
|
#include "sky/engine/wtf/PassRefPtr.h"
|
|
#include "sky/engine/wtf/RefCounted.h"
|
|
|
|
namespace blink {
|
|
|
|
class SceneBuilder : public RefCounted<SceneBuilder>, public DartWrappable {
|
|
DEFINE_WRAPPERTYPEINFO();
|
|
public:
|
|
static PassRefPtr<SceneBuilder> create(const Rect& bounds) {
|
|
return adoptRef(new SceneBuilder(bounds));
|
|
}
|
|
|
|
~SceneBuilder() override;
|
|
|
|
void pushTransform(const Float32List& matrix4, ExceptionState&);
|
|
void pushClipRect(const Rect& rect);
|
|
void pushClipRRect(const RRect* rrect, const Rect& bounds);
|
|
void pushClipPath(const CanvasPath* path, const Rect& bounds);
|
|
void pushOpacity(int alpha, const Rect& bounds);
|
|
void pushColorFilter(SkColor color, SkXfermode::Mode transferMode, const Rect& bounds);
|
|
void pop();
|
|
void addPicture(const Offset& offset, Picture* picture, const Rect& bounds);
|
|
|
|
PassRefPtr<Scene> build();
|
|
|
|
private:
|
|
explicit SceneBuilder(const Rect& bounds);
|
|
|
|
void addLayer(std::unique_ptr<sky::compositor::ContainerLayer> layer);
|
|
|
|
SkRect m_rootPaintBounds;
|
|
std::unique_ptr<sky::compositor::ContainerLayer> m_rootLayer;
|
|
sky::compositor::ContainerLayer* m_currentLayer;
|
|
};
|
|
|
|
} // namespace blink
|
|
|
|
#endif // SKY_ENGINE_CORE_COMPOSITING_SCENEBUILDER_H_
|