-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Implement tile mode for linear gradient and radial gradient #35087
Conversation
bdero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looking good, thanks! Just some comments about where things should live.
impeller/geometry/tile_mode.h
Outdated
|
|
||
| // An enum to define how to repeat, fold, or omit colors outside of the | ||
| // typically defined range of the source of the colors (such as the | ||
| // bounds of an image or the defining geoetry of a gradient). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use /// for docstring comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| const float kTileModeMirror = 2; | ||
| const float kTileModeDecal = 3; | ||
|
|
||
| float GetInterpolantValue(float t, float tile_mode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a docstring that describes the intended domain and range of this function. Looking at it, the domain appears to be any value and the range is [0 to 1].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| @@ -0,0 +1,21 @@ | |||
| // Copyright 2013 The Flutter Authors. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like something that would best be placed in the shader library.
Although it happens to not be being used for a texture in this case. It seems like impeller/compiler/shader_lib/texture.glsl would be an appropriate home for this given its UV mapping behavior. Perhaps call it IPTileTextureCoords?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
impeller/geometry/tile_mode.h
Outdated
| @@ -0,0 +1,31 @@ | |||
| // Copyright 2013 The Flutter Authors. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geometry is primarily used for math utilities. Please place this enum in the entity framework. Perhaps in the Entity declaration next to the BlendMode enum class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| const float kTileModeClamp = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment nearby indicating that these values must correspond to the order of the items in the Entity::TileMode enum class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
bdero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Co-authored-by: Brandon DeRosier <[email protected]>
Co-authored-by: Brandon DeRosier <[email protected]>
fix flutter/flutter#108810
Pre-launch Checklist
writing and running engine tests.
///).