Skip to content

Commit

Permalink
Remove use of SkRect::MakeLargest (flutter#4918)
Browse files Browse the repository at this point in the history
This API is being hidden for safety reasons. Instead, use a locally
defined rect that's slightly smaller (so operations don't overflow).
  • Loading branch information
brianosman authored Apr 2, 2018
1 parent 76f97fe commit c092e14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flow/layers/default_layer_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

namespace flow {

static const SkRect kGiantRect = SkRect::MakeLTRB( -1E9F, -1E9F, 1E9F, 1E9F );

DefaultLayerBuilder::DefaultLayerBuilder() {
cull_rects_.push(SkRect::MakeLargest());
cull_rects_.push(kGiantRect);
}

DefaultLayerBuilder::~DefaultLayerBuilder() = default;
Expand All @@ -38,7 +40,7 @@ void DefaultLayerBuilder::PushTransform(const SkMatrix& sk_matrix) {
if (sk_matrix.invert(&inverse_sk_matrix)) {
inverse_sk_matrix.mapRect(&cullRect, cull_rects_.top());
} else {
cullRect = SkRect::MakeLargest();
cullRect = kGiantRect;
}

auto layer = std::make_unique<flow::TransformLayer>();
Expand Down

0 comments on commit c092e14

Please sign in to comment.