gl_surface_stub.cc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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
  3. // found in the LICENSE file.
  4. #include "ui/gl/gl_surface_stub.h"
  5. #include <utility>
  6. #include "base/bind.h"
  7. #include "base/threading/thread_task_runner_handle.h"
  8. #include "base/time/time.h"
  9. namespace gl {
  10. void GLSurfaceStub::Destroy() {
  11. }
  12. bool GLSurfaceStub::Resize(const gfx::Size& size,
  13. float scale_factor,
  14. const gfx::ColorSpace& color_space,
  15. bool has_alpha) {
  16. return true;
  17. }
  18. bool GLSurfaceStub::IsOffscreen() {
  19. return false;
  20. }
  21. gfx::SwapResult GLSurfaceStub::SwapBuffers(PresentationCallback callback) {
  22. gfx::PresentationFeedback feedback(base::TimeTicks::Now(), base::TimeDelta(),
  23. 0 /* flags */);
  24. base::ThreadTaskRunnerHandle::Get()->PostTask(
  25. FROM_HERE, base::BindOnce(std::move(callback), std::move(feedback)));
  26. return gfx::SwapResult::SWAP_ACK;
  27. }
  28. gfx::Size GLSurfaceStub::GetSize() {
  29. return size_;
  30. }
  31. void* GLSurfaceStub::GetHandle() {
  32. return NULL;
  33. }
  34. bool GLSurfaceStub::BuffersFlipped() const {
  35. return buffers_flipped_;
  36. }
  37. GLSurfaceFormat GLSurfaceStub::GetFormat() {
  38. return GLSurfaceFormat();
  39. }
  40. bool GLSurfaceStub::SupportsDCLayers() const {
  41. return supports_draw_rectangle_;
  42. }
  43. gfx::Vector2d GLSurfaceStub::GetDrawOffset() const {
  44. return supports_draw_rectangle_ ? gfx::Vector2d(100, 200) : gfx::Vector2d();
  45. }
  46. GLSurfaceStub::~GLSurfaceStub() {}
  47. } // namespace gl