[core] Privatize OpenGL/Context headers

This commit is contained in:
Konstantin Käfer
2017-03-22 14:20:35 +01:00
parent 3f0f4575e7
commit a84aa453a9
17 changed files with 103 additions and 67 deletions

View File

@@ -21,6 +21,38 @@ gl::Context& Backend::getContext() {
return *context;
}
PremultipliedImage Backend::readFramebuffer(const Size& size) const {
assert(context);
return context->readFramebuffer<PremultipliedImage>(size);
}
void Backend::assumeFramebufferBinding(const gl::FramebufferID fbo) {
getContext().bindFramebuffer.setCurrentValue(fbo);
if (fbo != ImplicitFramebufferBinding) {
assert(gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue());
}
}
void Backend::assumeViewportSize(const Size& size) {
getContext().viewport.setCurrentValue({ 0, 0, size });
assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
}
bool Backend::implicitFramebufferBound() {
return getContext().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding;
}
void Backend::setFramebufferBinding(const gl::FramebufferID fbo) {
getContext().bindFramebuffer = fbo;
if (fbo != ImplicitFramebufferBinding) {
assert(gl::value::BindFramebuffer::Get() == getContext().bindFramebuffer.getCurrentValue());
}
}
void Backend::setViewportSize(const Size& size) {
getContext().viewport = { 0, 0, size };
assert(gl::value::Viewport::Get() == getContext().viewport.getCurrentValue());
}
Backend::~Backend() = default;
} // namespace mbgl

View File

@@ -285,6 +285,8 @@ void Map::Impl::render(View& view) {
contextMode,
debugOptions };
backend.updateAssumedState();
painter->render(*style,
frameData,
view,
@@ -323,6 +325,8 @@ void Map::Impl::render(View& view) {
contextMode,
debugOptions };
backend.updateAssumedState();
try {
painter->render(*style,
frameData,