Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3365)

Unified Diff: cc/output/gl_renderer.cc

Issue 1884553003: cc: optimize texture allocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win fix: futz with the fuzz Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/test/data/rotated_drop_shadow_filter_gl.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 6a75674271e6921f2f0658f281f12aa86425776e..5b1463351437bf71f87ab0cf517654bbf1ecd379 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) {
+ float w, h;
+ for (w = 1.f; w < rect->width(); w *= 2.f) {
+ }
+ for (h = 1.f; h < rect->height(); h *= 2.f) {
+ }
+ 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
+ // 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);
« no previous file with comments | « no previous file | cc/test/data/rotated_drop_shadow_filter_gl.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698