blob: 60821b10ee94ec73fa42f2267eeab5840d203a5d [file] [log] [blame]
Jamie Madill870352a2014-12-01 11:01:17 -05001//
2// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// DisplayImpl.cpp: Implementation methods of egl::Display
8
9#include "libANGLE/renderer/DisplayImpl.h"
10
11#include "libANGLE/Surface.h"
12
13namespace rx
14{
15
Geoff Lang1b765452014-12-11 11:58:39 -050016DisplayImpl::DisplayImpl()
Geoff Lang5c39f682015-01-06 15:19:35 -050017 : mExtensionsInitialized(false),
18 mCapsInitialized(false)
Geoff Lang1b765452014-12-11 11:58:39 -050019{
20}
21
Jamie Madill870352a2014-12-01 11:01:17 -050022DisplayImpl::~DisplayImpl()
23{
24 while (!mSurfaceSet.empty())
25 {
26 destroySurface(*mSurfaceSet.begin());
27 }
28}
29
30void DisplayImpl::destroySurface(egl::Surface *surface)
31{
32 mSurfaceSet.erase(surface);
33 SafeDelete(surface);
34}
35
Geoff Lang1b765452014-12-11 11:58:39 -050036const egl::DisplayExtensions &DisplayImpl::getExtensions() const
37{
38 if (!mExtensionsInitialized)
39 {
40 generateExtensions(&mExtensions);
41 mExtensionsInitialized = true;
42 }
43
44 return mExtensions;
45}
46
Geoff Lang5c39f682015-01-06 15:19:35 -050047const egl::Caps &DisplayImpl::getCaps() const
48{
49 if (!mCapsInitialized)
50 {
51 generateCaps(&mCaps);
52 mCapsInitialized = true;
53 }
54
55 return mCaps;
56}
57
Jamie Madill870352a2014-12-01 11:01:17 -050058}