Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Unified Diff: content/common/gpu/media/gl_renderer.cc

Issue 940903002: video_decode_accelerator_unittest: enable test on ozone surfaceless (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use GpuMemoryBufferFactory instead of GpuMemoryBufferFactoryOzoneNativeBuffer Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/media/gl_renderer.h ('k') | content/common/gpu/media/rendering_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/gl_renderer.cc
diff --git a/ui/ozone/demo/gl_renderer.cc b/content/common/gpu/media/gl_renderer.cc
similarity index 54%
copy from ui/ozone/demo/gl_renderer.cc
copy to content/common/gpu/media/gl_renderer.cc
index 8e0fcfe59ee206c0fdc27338bc2813496b550799..bd2e7102155f7242ab8a6544b7511ec7dace997b 100644
--- a/ui/ozone/demo/gl_renderer.cc
+++ b/content/common/gpu/media/gl_renderer.cc
@@ -1,17 +1,17 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 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 "ui/ozone/demo/gl_renderer.h"
+#include "content/common/gpu/media/gl_renderer.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
-namespace ui {
+namespace content {
GlRenderer::GlRenderer(gfx::AcceleratedWidget widget, const gfx::Size& size)
- : RendererBase(widget, size) {
+ : widget_(widget), size_(size) {
}
GlRenderer::~GlRenderer() {
@@ -20,38 +20,46 @@ GlRenderer::~GlRenderer() {
bool GlRenderer::Initialize() {
surface_ = gfx::GLSurface::CreateViewGLSurface(widget_);
if (!surface_.get()) {
- LOG(ERROR) << "Failed to create GL surface";
+ LOG(FATAL) << "Failed to create GL surface";
return false;
}
context_ = gfx::GLContext::CreateGLContext(NULL, surface_.get(),
gfx::PreferIntegratedGpu);
if (!context_.get()) {
- LOG(ERROR) << "Failed to create GL context";
+ LOG(FATAL) << "Failed to create GL context";
return false;
}
surface_->Resize(size_);
if (!context_->MakeCurrent(surface_.get())) {
- LOG(ERROR) << "Failed to make GL context current";
+ LOG(FATAL) << "Failed to make GL context current";
return false;
}
return true;
}
-void GlRenderer::RenderFrame() {
- float fraction = NextFraction();
-
- context_->MakeCurrent(surface_.get());
-
- glViewport(0, 0, size_.width(), size_.height());
- glClearColor(1 - fraction, fraction, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+bool GlRenderer::MakeCurrent() {
+ return context_->MakeCurrent(surface_.get());
+}
+void GlRenderer::SwapBuffers() {
if (!surface_->SwapBuffers())
LOG(FATAL) << "Failed to swap buffers";
}
-} // namespace ui
+bool GlRenderer::IsFlipped() {
+ return false;
+}
+
+void GlRenderer::BindFramebuffer(uint32_t fbo) {
+ glBindFramebufferEXT(GL_FRAMEBUFFER, fbo);
+}
+
+void GlRenderer::UnbindFramebuffer() {
+ glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
+}
+
+} // namespace content
« no previous file with comments | « content/common/gpu/media/gl_renderer.h ('k') | content/common/gpu/media/rendering_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698