Chromium Code Reviews| Index: cc/output/gl_renderer.cc |
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
| index 6a75674271e6921f2f0658f281f12aa86425776e..d8af04ee1b2d82ab307e695bffc706c015d58ed9 100644 |
| --- a/cc/output/gl_renderer.cc |
| +++ b/cc/output/gl_renderer.cc |
| @@ -141,6 +141,16 @@ BlendMode BlendModeFromSkXfermode(SkXfermode::Mode mode) { |
| } |
| } |
| +void RoundUpToPow2(gfx::RectF* rect) { |
| + int w, h; |
|
danakj
2016/05/04 21:24:58
you're using ints here but it's a RectF.
Stephen White
2016/05/04 21:27:31
Yep. There are implicit casts in the comparisons a
|
| + for (w = 1; w < rect->width(); w *= 2) { |
|
enne (OOO)
2016/05/04 21:32:22
If you're casting to ints here for performance, mi
Stephen White
2016/05/04 21:47:17
Cute! I don't really care about performance here;
|
| + } |
| + for (h = 1; h < rect->height(); h *= 2) { |
| + } |
| + rect->set_width(w); |
| + rect->set_height(h); |
| +} |
| + |
| // Smallest unit that impact anti-aliasing output. We use this to |
| // determine when anti-aliasing is unnecessary. |
| const float kAntiAliasingEpsilon = 1.0f / 1024.0f; |
| @@ -1032,6 +1042,9 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
| if (dst_rect.IsEmpty()) { |
| return; |
| } |
| + // Expand dst_rect size to the nearest power of 2, in order to get |
|
enne (OOO)
2016/05/04 21:32:22
Are there limits on the size that is supported her
Stephen White
2016/05/04 21:47:17
If you mean, will the allocation fail due to an in
|
| + // more cache hits in Skia's texture cache. |
| + RoundUpToPow2(&dst_rect); |
| filter_image = ApplyImageFilter( |
| ScopedUseGrContext::Create(this, frame), resource_provider_, rect, |
| dst_rect, scale, std::move(filter), contents_texture); |