Skip to content

Commit

Permalink
Revert "Wire up Opacity on Fuchsia, round 2 (#14024)" (#14543)
Browse files Browse the repository at this point in the history
This reverts commit d117ac9.
  • Loading branch information
iskakaushik authored Dec 18, 2019
1 parent fa1adf4 commit 6ea69a0
Show file tree
Hide file tree
Showing 44 changed files with 487 additions and 668 deletions.
4 changes: 0 additions & 4 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ FILE: ../../../flutter/flow/layers/color_filter_layer_unittests.cc
FILE: ../../../flutter/flow/layers/container_layer.cc
FILE: ../../../flutter/flow/layers/container_layer.h
FILE: ../../../flutter/flow/layers/container_layer_unittests.cc
FILE: ../../../flutter/flow/layers/elevated_container_layer.cc
FILE: ../../../flutter/flow/layers/elevated_container_layer.h
FILE: ../../../flutter/flow/layers/fuchsia_system_composited_layer.cc
FILE: ../../../flutter/flow/layers/fuchsia_system_composited_layer.h
FILE: ../../../flutter/flow/layers/layer.cc
FILE: ../../../flutter/flow/layers/layer.h
FILE: ../../../flutter/flow/layers/layer_tree.cc
Expand Down
4 changes: 0 additions & 4 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ source_set("flow") {
"layers/color_filter_layer.h",
"layers/container_layer.cc",
"layers/container_layer.h",
"layers/elevated_container_layer.cc",
"layers/elevated_container_layer.h",
"layers/layer.cc",
"layers/layer.h",
"layers/layer_tree.cc",
Expand Down Expand Up @@ -78,8 +76,6 @@ source_set("flow") {
sources += [
"layers/child_scene_layer.cc",
"layers/child_scene_layer.h",
"layers/fuchsia_system_composited_layer.cc",
"layers/fuchsia_system_composited_layer.h",
"scene_update_context.cc",
"scene_update_context.h",
"view_holder.cc",
Expand Down
17 changes: 1 addition & 16 deletions flow/layers/child_scene_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,10 @@ ChildSceneLayer::ChildSceneLayer(zx_koid_t layer_id,
void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
TRACE_EVENT0("flutter", "ChildSceneLayer::Preroll");
set_needs_system_composite(true);

// An alpha "hole punch" is required if the frame behind us is not opaque.
if (!context->is_opaque) {
set_paint_bounds(
SkRect::MakeXYWH(offset_.fX, offset_.fY, size_.fWidth, size_.fHeight));
}
}

void ChildSceneLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ChildSceneLayer::Paint");
FML_DCHECK(needs_painting());

// If we are being rendered into our own frame using the system compositor,
// then it is neccesary to "punch a hole" in the canvas/frame behind us so
// that group opacity looks correct.
SkPaint paint;
paint.setColor(SK_ColorTRANSPARENT);
paint.setBlendMode(SkBlendMode::kSrc);
context.leaf_nodes_canvas->drawRect(paint_bounds(), paint);
FML_NOTREACHED() << "This layer never needs painting.";
}

void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) {
Expand Down
3 changes: 2 additions & 1 deletion flow/layers/container_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace flutter {
ContainerLayer::ContainerLayer() {}

void ContainerLayer::Add(std::shared_ptr<Layer> layer) {
layers_.emplace_back(std::move(layer));
layer->set_parent(this);
layers_.push_back(std::move(layer));
}

void ContainerLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/container_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ContainerLayer : public Layer {
public:
ContainerLayer();

virtual void Add(std::shared_ptr<Layer> layer);
void Add(std::shared_ptr<Layer> layer);

void Preroll(PrerollContext* context, const SkMatrix& matrix) override;
void Paint(PaintContext& context) const override;
Expand Down
49 changes: 0 additions & 49 deletions flow/layers/elevated_container_layer.cc

This file was deleted.

34 changes: 0 additions & 34 deletions flow/layers/elevated_container_layer.h

This file was deleted.

55 changes: 0 additions & 55 deletions flow/layers/fuchsia_system_composited_layer.cc

This file was deleted.

37 changes: 0 additions & 37 deletions flow/layers/fuchsia_system_composited_layer.h

This file was deleted.

7 changes: 4 additions & 3 deletions flow/layers/layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
namespace flutter {

Layer::Layer()
: paint_bounds_(SkRect::MakeEmpty()),
unique_id_(NextUniqueID()),
needs_system_composite_(false) {}
: parent_(nullptr),
needs_system_composite_(false),
paint_bounds_(SkRect::MakeEmpty()),
unique_id_(NextUniqueID()) {}

Layer::~Layer() = default;

Expand Down
23 changes: 9 additions & 14 deletions flow/layers/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ static constexpr SkRect kGiantRect = SkRect::MakeLTRB(-1E9F, -1E9F, 1E9F, 1E9F);
// This should be an exact copy of the Clip enum in painting.dart.
enum Clip { none, hardEdge, antiAlias, antiAliasWithSaveLayer };

class ContainerLayer;

struct PrerollContext {
RasterCache* raster_cache;
GrContext* gr_context;
Expand All @@ -51,21 +53,13 @@ struct PrerollContext {
SkRect cull_rect;
bool surface_needs_readback;

// These allow us to paint in the end of subtree Preroll.
// The following allows us to paint in the end of subtree preroll
const Stopwatch& raster_time;
const Stopwatch& ui_time;
TextureRegistry& texture_registry;
const bool checkerboard_offscreen_layers;

// These allow us to make use of the scene metrics during Preroll.
float frame_physical_depth;
float frame_device_pixel_ratio;

// These allow us to track properties like elevation, opacity, and the
// prescence of a platform view during Preroll.
float total_elevation = 0.0f;
bool has_platform_view = false;
bool is_opaque = true;
};

// Represents a single composited layer. Created on the UI thread but then
Expand Down Expand Up @@ -123,10 +117,6 @@ class Layer {
TextureRegistry& texture_registry;
const RasterCache* raster_cache;
const bool checkerboard_offscreen_layers;

// These allow us to make use of the scene metrics during Paint.
float frame_physical_depth;
float frame_device_pixel_ratio;
};

// Calls SkCanvas::saveLayer and restores the layer upon destruction. Also
Expand Down Expand Up @@ -163,6 +153,10 @@ class Layer {
virtual void UpdateScene(SceneUpdateContext& context);
#endif

ContainerLayer* parent() const { return parent_; }

void set_parent(ContainerLayer* parent) { parent_ = parent; }

bool needs_system_composite() const { return needs_system_composite_; }
void set_needs_system_composite(bool value) {
needs_system_composite_ = value;
Expand All @@ -181,9 +175,10 @@ class Layer {
uint64_t unique_id() const { return unique_id_; }

private:
ContainerLayer* parent_;
bool needs_system_composite_;
SkRect paint_bounds_;
uint64_t unique_id_;
bool needs_system_composite_;

static uint64_t NextUniqueID();

Expand Down
Loading

0 comments on commit 6ea69a0

Please sign in to comment.