[Impeller] Don't do texture passthrough when opacity needs to be applied (flutter/engine#36337)

This commit is contained in:
Brandon DeRosier
2022-09-22 01:48:13 -07:00
committed by GitHub
parent d1a17b2804
commit 06213c79f0

View File

@@ -11,6 +11,7 @@
#include "impeller/entity/entity.h"
#include "impeller/entity/texture_fill.frag.h"
#include "impeller/entity/texture_fill.vert.h"
#include "impeller/geometry/constants.h"
#include "impeller/geometry/path_builder.h"
#include "impeller/renderer/formats.h"
#include "impeller/renderer/render_pass.h"
@@ -72,7 +73,8 @@ std::optional<Snapshot> TextureContents::RenderToSnapshot(
// Passthrough textures that have simple rectangle paths and complete source
// rects.
if (is_rect_ && source_rect_ == Rect::MakeSize(texture_->GetSize())) {
if (is_rect_ && source_rect_ == Rect::MakeSize(texture_->GetSize()) &&
opacity_ >= 1 - kEhCloseEnough) {
auto scale = Vector2(bounds->size / Size(texture_->GetSize()));
return Snapshot{.texture = texture_,
.transform = entity.GetTransformation() *