summaryrefslogtreecommitdiffstats
path: root/content/common/gpu/image_transport_surface_linux.cc
blob: db36efea1354052ee54e603626f6e31484aea11b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/common/gpu/image_transport_surface.h"

namespace content {

// static
scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(
    GpuChannelManager* manager,
    GpuCommandBufferStub* stub,
    const gfx::GLSurfaceHandle& handle) {
  DCHECK(handle.handle);
  DCHECK(handle.transport_type == gfx::NATIVE_DIRECT);
  scoped_refptr<gfx::GLSurface> surface;
#if defined(USE_OZONE)
  surface = gfx::GLSurface::CreateSurfacelessViewGLSurface(handle.handle);
#endif
  if (!surface)
    surface = gfx::GLSurface::CreateViewGLSurface(handle.handle);
  if (!surface)
    return surface;
  return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface(
      manager, stub, surface.get()));
}

}  // namespace content