-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove layer integral offset snapping #17712
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,9 +31,6 @@ void ImageFilterLayer::Preroll(PrerollContext* context, | |
if (!context->has_platform_view && context->raster_cache && | ||
SkRect::Intersects(context->cull_rect, paint_bounds())) { | ||
SkMatrix ctm = matrix; | ||
#ifndef SUPPORT_FRACTIONAL_TRANSLATION | ||
ctm = RasterCache::GetIntegralTransCTM(ctm); | ||
#endif | ||
context->raster_cache->Prepare(context, this, ctm); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For cases like these (and I'm guessing there are a large number of them, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in #17915 |
||
} | ||
} | ||
|
@@ -42,12 +39,6 @@ void ImageFilterLayer::Paint(PaintContext& context) const { | |
TRACE_EVENT0("flutter", "ImageFilterLayer::Paint"); | ||
FML_DCHECK(needs_painting()); | ||
|
||
#ifndef SUPPORT_FRACTIONAL_TRANSLATION | ||
SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); | ||
context.leaf_nodes_canvas->setMatrix(RasterCache::GetIntegralTransCTM( | ||
context.leaf_nodes_canvas->getTotalMatrix())); | ||
#endif | ||
|
||
if (context.raster_cache) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, is this all boilerplate for many layers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in #17791 |
||
const SkMatrix& ctm = context.leaf_nodes_canvas->getTotalMatrix(); | ||
RasterCacheResult layer_cache = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,9 +51,6 @@ void OpacityLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { | |
if (!context->has_platform_view && context->raster_cache && | ||
SkRect::Intersects(context->cull_rect, paint_bounds())) { | ||
SkMatrix ctm = child_matrix; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ctm not needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in #17915 |
||
#ifndef SUPPORT_FRACTIONAL_TRANSLATION | ||
ctm = RasterCache::GetIntegralTransCTM(ctm); | ||
#endif | ||
context->raster_cache->Prepare(context, container, ctm); | ||
} | ||
} | ||
|
@@ -69,11 +66,6 @@ void OpacityLayer::Paint(PaintContext& context) const { | |
SkAutoCanvasRestore save(context.internal_nodes_canvas, true); | ||
context.internal_nodes_canvas->translate(offset_.fX, offset_.fY); | ||
|
||
#ifndef SUPPORT_FRACTIONAL_TRANSLATION | ||
context.internal_nodes_canvas->setMatrix(RasterCache::GetIntegralTransCTM( | ||
context.leaf_nodes_canvas->getTotalMatrix())); | ||
#endif | ||
|
||
if (context.raster_cache) { | ||
ContainerLayer* container = GetChildContainer(); | ||
const SkMatrix& ctm = context.leaf_nodes_canvas->getTotalMatrix(); | ||
|
@@ -87,8 +79,7 @@ void OpacityLayer::Paint(PaintContext& context) const { | |
// Skia may clip the content with saveLayerBounds (although it's not a | ||
// guaranteed clip). So we have to provide a big enough saveLayerBounds. To do | ||
// so, we first remove the offset from paint bounds since it's already in the | ||
// matrix. Then we round out the bounds because of our | ||
// RasterCache::GetIntegralTransCTM optimization. | ||
// matrix. Then we round out the bounds. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we introduced the offset into the CTM prematurely above? If we hadn't already added it, we wouldn't have to adjust for it here...? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (aka line 70 in this method) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need the offset in |
||
// | ||
// Note that the following lines are only accessible when the raster cache is | ||
// not available (e.g., when we're using the software backend in golden | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,6 @@ void PictureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) { | |
|
||
SkMatrix ctm = matrix; | ||
ctm.postTranslate(offset_.x(), offset_.y()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, this is a counter-example for getting rid of the ctm local (that doesn't mean we shouldn't get rid of it in other methods where it really is superficial). Is there something different about the way that picture_layer handles the offset that might benefit the other uses of the raster cache? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference seems to be that |
||
#ifndef SUPPORT_FRACTIONAL_TRANSLATION | ||
ctm = RasterCache::GetIntegralTransCTM(ctm); | ||
#endif | ||
cache->Prepare(context->gr_context, sk_picture, ctm, | ||
context->dst_color_space, is_complex_, will_change_); | ||
} | ||
|
@@ -44,10 +41,6 @@ void PictureLayer::Paint(PaintContext& context) const { | |
|
||
SkAutoCanvasRestore save(context.leaf_nodes_canvas, true); | ||
context.leaf_nodes_canvas->translate(offset_.x(), offset_.y()); | ||
#ifndef SUPPORT_FRACTIONAL_TRANSLATION | ||
context.leaf_nodes_canvas->setMatrix(RasterCache::GetIntegralTransCTM( | ||
context.leaf_nodes_canvas->getTotalMatrix())); | ||
#endif | ||
|
||
if (context.raster_cache) { | ||
const SkMatrix& ctm = context.leaf_nodes_canvas->getTotalMatrix(); | ||
|
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.
How many of these if statements have identical tests? Could this be added as a boilerplate method either in the base
Layer
or in thePrerollContext
?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.