Skip to content

Add backend texture support (eg video, camera) - #12525

Merged
mravn-google merged 8 commits into
masterfrom
video
Nov 2, 2017
Merged

mravn-google merged 8 commits into
masterfrom
video

Conversation

@mravn-google

@mravn-google mravn-google commented Oct 13, 2017 •

Copy link
Copy Markdown
Contributor

Adds support for mapping a backend texture to a rectangular widget. This enables the creation of plugins for inline video, camera, OpenGL, etc.

Corresponding flutter/engine PR: flutter-team-archive/engine/pull/4159.

An end-to-end test is wip.

final Rect rect;

/// Identity of the backend texture.
final int textureId;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the namespace of the textureIds? If a developer starts passing random values here, or walks up all the values possible, what are the implications?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


/// A composited layer that maps a backend texture to a rectangle.
///
/// Texture layers are always leaves in the layer tree.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should discuss where you get a "backend texture" and what it means.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

/// Bounding rectangle of this layer.
final Rect rect;

/// Identity of the backend texture.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should document where you get this number.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (in the class-level documentation on all three classes).

@@ -0,0 +1,66 @@
// Copyright 2015 The Chromium Authors. All rights reserved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2017?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

int _textureId;

/// Sets the identity of the backend texture to map.
set textureId(int value) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this value be null?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like yes; please document that it can be null and define what this means

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A null texture ID is now considered an error.

Done.

}

/// The identity of the backend texture.
int get textureId => _textureId;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please order these as follows:

/// documentation
getter;
final _field;
/// documentation (if it is meaningfully different than the getter's)
setter;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(without blank lines)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

void paint(PaintingContext context, Offset offset) {
if (_textureId == null) {
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no braces

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

void updateRenderObject(BuildContext context, TextureBox renderObject) {
renderObject.textureId = textureId;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(remember to propagate documentation updates to this class too)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Hixie

Hixie commented Oct 18, 2017

Copy link
Copy Markdown
Contributor

tests?

@Hixie

Hixie commented Oct 18, 2017

Copy link
Copy Markdown
Contributor

LGTM

@sroddy

sroddy commented Oct 23, 2017

Copy link
Copy Markdown
Contributor

Sorry to bother,
is there an ETA for this, and the corresponding engine counterpart?
It's quite a road blocker for our adoption of the Flutter platform...

Thank you a lot.

@mravn-google

Copy link
Copy Markdown
Contributor Author

@sroddy Thanks for your interest. We're actively working on it; hoping to land within a week or so.

@MichaelSowah

MichaelSowah commented Oct 24, 2017 •

Copy link
Copy Markdown

that would be a lifesaver because its a big road blocker in mine and quite a number of other apps on my table (which I will use flutter at all cost) too so I have been waiting like forever...if this is done does that help with maps too? @mravn-google

@mravn-google mravn-google left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. PTAL.

@@ -0,0 +1,66 @@
// Copyright 2015 The Chromium Authors. All rights reserved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

}

/// The identity of the backend texture.
int get textureId => _textureId;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

int _textureId;

/// Sets the identity of the backend texture to map.
set textureId(int value) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A null texture ID is now considered an error.

Done.


/// A composited layer that maps a backend texture to a rectangle.
///
/// Texture layers are always leaves in the layer tree.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

void paint(PaintingContext context, Offset offset) {
if (_textureId == null) {
return;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

void updateRenderObject(BuildContext context, TextureBox renderObject) {
renderObject.textureId = textureId;
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

/// Bounding rectangle of this layer.
final Rect rect;

/// Identity of the backend texture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (in the class-level documentation on all three classes).

final Rect rect;

/// Identity of the backend texture.
final int textureId;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@mravn-google

Copy link
Copy Markdown
Contributor Author

@MichaelSowah I do not yet know what it would take to have native map components render into a provided texture. On top of that, we'd have to relay gestures to the native component, probably allowing Flutter to filter those gestures (in case Flutter has added overlays). Experiments will begin once this PR lands.

@MichaelSowah

Copy link
Copy Markdown

Thanks, For starters videos and camera, as you are trying to do here will be a great start for me to be able to lunch the apps for my clients...I hope and pray it lands soon like within the week as you or so as you said , just keeping my fingers crossed for this week and next week @mravn-google

@Hixie
Hixie deleted the video branch November 24, 2017 23:30
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants