OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 | 170 |
171 bool GLSurface::SupportsSetDrawRectangle() const { | 171 bool GLSurface::SupportsSetDrawRectangle() const { |
172 return false; | 172 return false; |
173 } | 173 } |
174 | 174 |
175 bool GLSurface::SetDrawRectangle(const gfx::Rect& rect) { | 175 bool GLSurface::SetDrawRectangle(const gfx::Rect& rect) { |
176 return false; | 176 return false; |
177 } | 177 } |
178 | 178 |
| 179 gfx::Vector2d GLSurface::GetDrawOffset() const { |
| 180 return gfx::Vector2d(); |
| 181 } |
| 182 |
179 GLSurface* GLSurface::GetCurrent() { | 183 GLSurface* GLSurface::GetCurrent() { |
180 return current_surface_.Pointer()->Get(); | 184 return current_surface_.Pointer()->Get(); |
181 } | 185 } |
182 | 186 |
183 GLSurface::~GLSurface() { | 187 GLSurface::~GLSurface() { |
184 if (GetCurrent() == this) | 188 if (GetCurrent() == this) |
185 SetCurrent(NULL); | 189 SetCurrent(NULL); |
186 } | 190 } |
187 | 191 |
188 void GLSurface::SetCurrent(GLSurface* surface) { | 192 void GLSurface::SetCurrent(GLSurface* surface) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 362 } |
359 | 363 |
360 bool GLSurfaceAdapter::SupportsSetDrawRectangle() const { | 364 bool GLSurfaceAdapter::SupportsSetDrawRectangle() const { |
361 return surface_->SupportsSetDrawRectangle(); | 365 return surface_->SupportsSetDrawRectangle(); |
362 } | 366 } |
363 | 367 |
364 bool GLSurfaceAdapter::SetDrawRectangle(const gfx::Rect& rect) { | 368 bool GLSurfaceAdapter::SetDrawRectangle(const gfx::Rect& rect) { |
365 return surface_->SetDrawRectangle(rect); | 369 return surface_->SetDrawRectangle(rect); |
366 } | 370 } |
367 | 371 |
| 372 gfx::Vector2d GLSurfaceAdapter::GetDrawOffset() const { |
| 373 return surface_->GetDrawOffset(); |
| 374 } |
| 375 |
368 void GLSurfaceAdapter::OnSetSwapInterval(int interval) { | 376 void GLSurfaceAdapter::OnSetSwapInterval(int interval) { |
369 surface_->OnSetSwapInterval(interval); | 377 surface_->OnSetSwapInterval(interval); |
370 } | 378 } |
371 | 379 |
372 GLSurfaceAdapter::~GLSurfaceAdapter() {} | 380 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
373 | 381 |
374 scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( | 382 scoped_refptr<GLSurface> InitializeGLSurfaceWithFormat( |
375 scoped_refptr<GLSurface> surface, GLSurfaceFormat format) { | 383 scoped_refptr<GLSurface> surface, GLSurfaceFormat format) { |
376 if (!surface->Initialize(format)) | 384 if (!surface->Initialize(format)) |
377 return nullptr; | 385 return nullptr; |
378 return surface; | 386 return surface; |
379 } | 387 } |
380 | 388 |
381 scoped_refptr<GLSurface> InitializeGLSurface(scoped_refptr<GLSurface> surface) { | 389 scoped_refptr<GLSurface> InitializeGLSurface(scoped_refptr<GLSurface> surface) { |
382 return InitializeGLSurfaceWithFormat(surface, GLSurfaceFormat()); | 390 return InitializeGLSurfaceWithFormat(surface, GLSurfaceFormat()); |
383 } | 391 } |
384 | 392 |
385 GLSurface::CALayerInUseQuery::CALayerInUseQuery() = default; | 393 GLSurface::CALayerInUseQuery::CALayerInUseQuery() = default; |
386 GLSurface::CALayerInUseQuery::CALayerInUseQuery(const CALayerInUseQuery&) = | 394 GLSurface::CALayerInUseQuery::CALayerInUseQuery(const CALayerInUseQuery&) = |
387 default; | 395 default; |
388 GLSurface::CALayerInUseQuery::~CALayerInUseQuery() = default; | 396 GLSurface::CALayerInUseQuery::~CALayerInUseQuery() = default; |
389 | 397 |
390 } // namespace gl | 398 } // namespace gl |
OLD | NEW |