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

Unified Diff: ui/ozone/platform/cast/gl_surface_cast.cc

Issue 2673473002: Rename SwapBuffersWithDamage to SwapBuffersWithBounds (Closed)
Patch Set: fix windows compile warning Created 3 years, 10 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 | « ui/ozone/platform/cast/gl_surface_cast.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/cast/gl_surface_cast.cc
diff --git a/ui/ozone/platform/cast/gl_surface_cast.cc b/ui/ozone/platform/cast/gl_surface_cast.cc
index 05b337735b2cbfb15b99be6de4c3dd36fd59ae2a..180ac593ce9e579c311be5c18bf4c5bf2c6e4600 100644
--- a/ui/ozone/platform/cast/gl_surface_cast.cc
+++ b/ui/ozone/platform/cast/gl_surface_cast.cc
@@ -13,10 +13,17 @@ GLSurfaceCast::GLSurfaceCast(gfx::AcceleratedWidget widget,
SurfaceFactoryCast* parent)
: NativeViewGLSurfaceEGL(parent->GetNativeWindow()),
widget_(widget),
- parent_(parent) {
+ parent_(parent),
+ supports_swap_buffer_with_bounds_(
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableSwapBuffersWithBounds)) {
DCHECK(parent_);
}
+bool GLSurfaceCast::SupportsSwapBuffersWithBounds() {
+ return supports_swap_buffer_with_bounds_;
+}
+
gfx::SwapResult GLSurfaceCast::SwapBuffers() {
gfx::SwapResult result = NativeViewGLSurfaceEGL::SwapBuffers();
if (result == gfx::SwapResult::SWAP_ACK)
@@ -25,15 +32,23 @@ gfx::SwapResult GLSurfaceCast::SwapBuffers() {
return result;
}
-gfx::SwapResult GLSurfaceCast::SwapBuffersWithDamage(int x,
- int y,
- int width,
- int height) {
+gfx::SwapResult GLSurfaceCast::SwapBuffersWithBounds(
+ const std::vector<gfx::Rect>& rects) {
+ DCHECK(supports_swap_buffer_with_bounds_);
+
+ // TODO(halliwell): Request new EGL extension so we're not abusing
+ // SwapBuffersWithDamage here.
+ std::vector<int> rects_data(rects.size() * 4);
+ for (size_t i = 0; i != rects.size(); ++i) {
+ rects_data[i * 4 + 0] = rects[i].x();
+ rects_data[i * 4 + 1] = rects[i].y();
+ rects_data[i * 4 + 2] = rects[i].width();
+ rects_data[i * 4 + 3] = rects[i].height();
+ }
gfx::SwapResult result =
- NativeViewGLSurfaceEGL::SwapBuffersWithDamage(x, y, width, height);
+ NativeViewGLSurfaceEGL::SwapBuffersWithDamage(rects_data);
if (result == gfx::SwapResult::SWAP_ACK)
parent_->OnSwapBuffers();
-
return result;
}
« no previous file with comments | « ui/ozone/platform/cast/gl_surface_cast.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698