Rename impeller::TextureIntent to impeller::TextureCoordinateSystem (flutter/engine#44628)
This commit is contained in:
@@ -297,8 +297,14 @@ constexpr const char* TextureUsageToString(TextureUsage usage) {
|
||||
|
||||
std::string TextureUsageMaskToString(TextureUsageMask mask);
|
||||
|
||||
enum class TextureIntent {
|
||||
// Texture coordinate system.
|
||||
enum class TextureCoordinateSystem {
|
||||
// Alternative coordinate system used when uploading texture data from the
|
||||
// host.
|
||||
// (0, 0) is the bottom-left of the image with +Y going up.
|
||||
kUploadFromHost,
|
||||
// Default coordinate system.
|
||||
// (0, 0) is the top-left of the image with +Y going down.
|
||||
kRenderToTexture,
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ bool Texture::SetContents(const uint8_t* contents,
|
||||
if (!OnSetContents(contents, length, slice)) {
|
||||
return false;
|
||||
}
|
||||
intent_ = TextureIntent::kUploadFromHost;
|
||||
coordinate_system_ = TextureCoordinateSystem::kUploadFromHost;
|
||||
is_opaque_ = is_opaque;
|
||||
return true;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ bool Texture::SetContents(std::shared_ptr<const fml::Mapping> mapping,
|
||||
if (!OnSetContents(std::move(mapping), slice)) {
|
||||
return false;
|
||||
}
|
||||
intent_ = TextureIntent::kUploadFromHost;
|
||||
coordinate_system_ = TextureCoordinateSystem::kUploadFromHost;
|
||||
is_opaque_ = is_opaque;
|
||||
return true;
|
||||
}
|
||||
@@ -70,12 +70,12 @@ bool Texture::IsSliceValid(size_t slice) const {
|
||||
FML_UNREACHABLE();
|
||||
}
|
||||
|
||||
void Texture::SetIntent(TextureIntent intent) {
|
||||
intent_ = intent;
|
||||
void Texture::SetCoordinateSystem(TextureCoordinateSystem coordinate_system) {
|
||||
coordinate_system_ = coordinate_system;
|
||||
}
|
||||
|
||||
TextureIntent Texture::GetIntent() const {
|
||||
return intent_;
|
||||
TextureCoordinateSystem Texture::GetCoordinateSystem() const {
|
||||
return coordinate_system_;
|
||||
}
|
||||
|
||||
Scalar Texture::GetYCoordScale() const {
|
||||
|
||||
@@ -39,9 +39,9 @@ class Texture {
|
||||
|
||||
const TextureDescriptor& GetTextureDescriptor() const;
|
||||
|
||||
void SetIntent(TextureIntent intent);
|
||||
void SetCoordinateSystem(TextureCoordinateSystem coordinate_system);
|
||||
|
||||
TextureIntent GetIntent() const;
|
||||
TextureCoordinateSystem GetCoordinateSystem() const;
|
||||
|
||||
virtual Scalar GetYCoordScale() const;
|
||||
|
||||
@@ -61,7 +61,8 @@ class Texture {
|
||||
bool mipmap_generated_ = false;
|
||||
|
||||
private:
|
||||
TextureIntent intent_ = TextureIntent::kRenderToTexture;
|
||||
TextureCoordinateSystem coordinate_system_ =
|
||||
TextureCoordinateSystem::kRenderToTexture;
|
||||
const TextureDescriptor desc_;
|
||||
bool is_opaque_ = false;
|
||||
|
||||
|
||||
@@ -512,10 +512,10 @@ bool TextureGLES::SetAsFramebufferAttachment(GLenum target,
|
||||
|
||||
// |Texture|
|
||||
Scalar TextureGLES::GetYCoordScale() const {
|
||||
switch (GetIntent()) {
|
||||
case TextureIntent::kUploadFromHost:
|
||||
switch (GetCoordinateSystem()) {
|
||||
case TextureCoordinateSystem::kUploadFromHost:
|
||||
return 1.0;
|
||||
case TextureIntent::kRenderToTexture:
|
||||
case TextureCoordinateSystem::kRenderToTexture:
|
||||
return -1.0;
|
||||
}
|
||||
FML_UNREACHABLE();
|
||||
|
||||
@@ -153,7 +153,8 @@ void HardwareBufferExternalTextureImpellerGL::ProcessFrame(
|
||||
auto texture = std::make_shared<impeller::TextureGLES>(
|
||||
impeller_context_->GetReactor(), desc,
|
||||
impeller::TextureGLES::IsWrapped::kWrapped);
|
||||
texture->SetIntent(impeller::TextureIntent::kUploadFromHost);
|
||||
texture->SetCoordinateSystem(
|
||||
impeller::TextureCoordinateSystem::kUploadFromHost);
|
||||
if (!texture->Bind()) {
|
||||
FML_LOG(ERROR) << "Could not bind texture.";
|
||||
NDKHelpers::AHardwareBuffer_release(latest_hardware_buffer);
|
||||
|
||||
@@ -196,7 +196,7 @@ FLUTTER_ASSERT_ARC
|
||||
yDesc.size = {textureSize.width(), textureSize.height()};
|
||||
yDesc.mip_count = 1;
|
||||
auto yTexture = impeller::TextureMTL::Wrapper(yDesc, yTex);
|
||||
yTexture->SetIntent(impeller::TextureIntent::kUploadFromHost);
|
||||
yTexture->SetCoordinateSystem(impeller::TextureCoordinateSystem::kUploadFromHost);
|
||||
|
||||
impeller::TextureDescriptor uvDesc;
|
||||
uvDesc.storage_mode = impeller::StorageMode::kHostVisible;
|
||||
@@ -204,7 +204,7 @@ FLUTTER_ASSERT_ARC
|
||||
uvDesc.size = {textureSize.width() / 2, textureSize.height() / 2};
|
||||
uvDesc.mip_count = 1;
|
||||
auto uvTexture = impeller::TextureMTL::Wrapper(uvDesc, uvTex);
|
||||
uvTexture->SetIntent(impeller::TextureIntent::kUploadFromHost);
|
||||
uvTexture->SetCoordinateSystem(impeller::TextureCoordinateSystem::kUploadFromHost);
|
||||
|
||||
impeller::YUVColorSpace yuvColorSpace =
|
||||
_pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
|
||||
@@ -263,7 +263,7 @@ FLUTTER_ASSERT_ARC
|
||||
desc.size = {textureSize.width(), textureSize.height()};
|
||||
desc.mip_count = 1;
|
||||
auto texture = impeller::TextureMTL::Wrapper(desc, rgbaTex);
|
||||
texture->SetIntent(impeller::TextureIntent::kUploadFromHost);
|
||||
texture->SetCoordinateSystem(impeller::TextureCoordinateSystem::kUploadFromHost);
|
||||
return impeller::DlImageImpeller::Make(texture);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user