blob: a92b637cbaa54819cd79eaa3098a5033de3abd0c [file] [log] [blame]
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/gl/gl_image.h"
#include <GL/gl.h>
#include "base/notreached.h"
namespace gl {
// NOTE: It is not possible to use static_cast in the below "safe downcast"
// functions, as the compiler doesn't know that the various GLImage subclasses
// do in fact inherit from GLImage. However, the reinterpret_casts used are
// safe, as |image| actually is an instance of the type in question.
// static
GLImageD3D* GLImage::ToGLImageD3D(GLImage* image) {
if (!image || image->GetType() != Type::D3D)
return nullptr;
return reinterpret_cast<GLImageD3D*>(image);
}
// static
// static
media::GLImageEGLStream* GLImage::ToGLImageEGLStream(GLImage* image) {
if (!image || image->GetType() != Type::EGL_STREAM) {
return nullptr;
}
return reinterpret_cast<media::GLImageEGLStream*>(image);
}
// static
media::GLImagePbuffer* GLImage::ToGLImagePbuffer(GLImage* image) {
if (!image || image->GetType() != Type::PBUFFER)
return nullptr;
return reinterpret_cast<media::GLImagePbuffer*>(image);
}
gfx::Size GLImage::GetSize() {
NOTREACHED();
return gfx::Size();
}
bool GLImage::BindTexImage(unsigned target) {
NOTREACHED();
return false;
}
void GLImage::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
uint64_t process_tracing_id,
const std::string& dump_name) {
NOTREACHED();
}
GLImage::Type GLImage::GetType() const {
return Type::NONE;
}
void* GLImage::GetEGLImage() const {
return nullptr;
}
} // namespace gl