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

Side by Side Diff: ui/ozone/platform/cast/gl_surface_cast.cc

Issue 2673473002: Rename SwapBuffersWithDamage to SwapBuffersWithBounds (Closed)
Patch Set: Fix Cast compile error + autogen test logic 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/ozone/platform/cast/gl_surface_cast.h" 5 #include "ui/ozone/platform/cast/gl_surface_cast.h"
6 6
7 #include "ui/ozone/common/egl_util.h" 7 #include "ui/ozone/common/egl_util.h"
8 #include "ui/ozone/platform/cast/surface_factory_cast.h" 8 #include "ui/ozone/platform/cast/surface_factory_cast.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 GLSurfaceCast::GLSurfaceCast(gfx::AcceleratedWidget widget, 12 GLSurfaceCast::GLSurfaceCast(gfx::AcceleratedWidget widget,
13 SurfaceFactoryCast* parent) 13 SurfaceFactoryCast* parent)
14 : NativeViewGLSurfaceEGL(parent->GetNativeWindow()), 14 : NativeViewGLSurfaceEGL(parent->GetNativeWindow()),
15 widget_(widget), 15 widget_(widget),
16 parent_(parent) { 16 parent_(parent),
17 supports_swap_buffer_with_bounds_(
18 base::CommandLine::ForCurrentProcess()->HasSwitch(
19 switches::kEnableSwapBuffersWithBounds)) {
17 DCHECK(parent_); 20 DCHECK(parent_);
18 } 21 }
19 22
23 bool GLSurfaceCast::SupportsSwapBuffersWithBounds() {
24 return supports_swap_buffer_with_bounds_;
25 }
26
20 gfx::SwapResult GLSurfaceCast::SwapBuffers() { 27 gfx::SwapResult GLSurfaceCast::SwapBuffers() {
21 gfx::SwapResult result = NativeViewGLSurfaceEGL::SwapBuffers(); 28 gfx::SwapResult result = NativeViewGLSurfaceEGL::SwapBuffers();
22 if (result == gfx::SwapResult::SWAP_ACK) 29 if (result == gfx::SwapResult::SWAP_ACK)
23 parent_->OnSwapBuffers(); 30 parent_->OnSwapBuffers();
24 31
25 return result; 32 return result;
26 } 33 }
27 34
28 gfx::SwapResult GLSurfaceCast::SwapBuffersWithDamage(int x, 35 gfx::SwapResult GLSurfaceCast::SwapBuffersWithBounds(
29 int y, 36 const std::vector<gfx::Rect>& rects) {
30 int width, 37 DCHECK(supports_swap_buffer_with_bounds_);
31 int height) { 38
39 // TODO(halliwell): request new EGL extension so we're not abusing
meacer 2017/02/02 21:42:33 nit: request -> Request
halliwell 2017/02/03 20:17:00 Done.
40 // SwapBuffersWithDamage here.
41 std::vector<int> rects_data(rects.size() * 4);
42 for (size_t i = 0; i != rects.size(); ++i) {
43 rects_data[i * 4 + 0] = rects[i].x();
44 rects_data[i * 4 + 1] = rects[i].y();
45 rects_data[i * 4 + 2] = rects[i].width();
46 rects_data[i * 4 + 3] = rects[i].height();
47 }
32 gfx::SwapResult result = 48 gfx::SwapResult result =
33 NativeViewGLSurfaceEGL::SwapBuffersWithDamage(x, y, width, height); 49 NativeViewGLSurfaceEGL::SwapBuffersWithDamage(rects_data);
34 if (result == gfx::SwapResult::SWAP_ACK) 50 if (result == gfx::SwapResult::SWAP_ACK)
35 parent_->OnSwapBuffers(); 51 parent_->OnSwapBuffers();
36
37 return result; 52 return result;
38 } 53 }
39 54
40 bool GLSurfaceCast::Resize(const gfx::Size& size, 55 bool GLSurfaceCast::Resize(const gfx::Size& size,
41 float scale_factor, 56 float scale_factor,
42 bool has_alpha) { 57 bool has_alpha) {
43 return parent_->ResizeDisplay(size) && 58 return parent_->ResizeDisplay(size) &&
44 NativeViewGLSurfaceEGL::Resize(size, scale_factor, has_alpha); 59 NativeViewGLSurfaceEGL::Resize(size, scale_factor, has_alpha);
45 } 60 }
46 61
(...skipping 27 matching lines...) Expand all
74 } 89 }
75 return config_; 90 return config_;
76 } 91 }
77 92
78 GLSurfaceCast::~GLSurfaceCast() { 93 GLSurfaceCast::~GLSurfaceCast() {
79 Destroy(); 94 Destroy();
80 parent_->ChildDestroyed(); 95 parent_->ChildDestroyed();
81 } 96 }
82 97
83 } // namespace ui 98 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698