Skip to content

Simplifications around image loading, and C++ generated code cleanup. - #360

Merged
simeoncran merged 4 commits into
masterfrom
ImageLoadingSimplification
Oct 1, 2020
Merged

simeoncran merged 4 commits into
masterfrom
ImageLoadingSimplification

Conversation

@simeoncran

Copy link
Copy Markdown
Contributor

No description provided.

@simeoncran
simeoncran requested a review from a team as a code owner October 1, 2020 00:56
case ImageAsset.ImageAssetType.Embedded:
var embeddedImageAsset = (EmbeddedImageAsset)imageAsset;
surface = LoadedImageSurface.StartLoadFromStream(embeddedImageAsset.Bytes);
surface.SetName(imageAsset.Id);

@simeoncran simeoncran Oct 1, 2020 •

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.

Set a description here as well so that comments will be generated explaining what the big generated array is for. #Closed

/// This affects the names used to reference files generated by cppwinrt.exe.
///
public string RootNamespace { get; set; }
public string RootNamespace { get; set; } = string.Empty;

@eliezerpMS eliezerpMS Oct 1, 2020 •

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.

= string.Empty; [](start = 49, length = 16)

Stupid question: Why is it necessary to initialize it to Empty? Shouldn't users assume that a string can be null or Empty? #WontFix

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.

It just saves the user from having to differentiate those cases. I hit a codepath that wasn't checking for null, so rather than making the code more complex there I just set it here.
A null namespace doesn't make sense. Ideally this would be a non-nullable string. Let me see if I can get that enabled (we couldn't use nullable reference types previously because we didn't have the latest version of C#, but it might work now).


In reply to: 498460566 [](ancestors = 498460566)

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.

Will enable nullable reference types in a separate PR... doing it now but it changes too much stuff to be part of this PR.


In reply to: 498475365 [](ancestors = 498475365,498460566)

/// A used to create the code.
/// The name of the field to be written.
/// The bytes in the array.
protected abstract void WriteByteArrayField(CodeBuilder builder, string fieldName, byte[] bytes);

@eliezerpMS eliezerpMS Oct 1, 2020 •

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.

CodeBuilder builder, string fieldName, byte[] bytes [](start = 52, length = 51)

nit: separate lines for params #WontFix

@eliezerpMS eliezerpMS left a comment

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.

:shipit:

@simeoncran
simeoncran merged commit ba7ffed into master Oct 1, 2020
@delete-merged-branch
delete-merged-branch Bot deleted the ImageLoadingSimplification branch October 1, 2020 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants