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

Side by Side Diff: chrome/gpu/gpu_view_x.cc

Issue 2134006: Added EGL based GLContext.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/gpu/gpu_video_layer_glx.cc ('k') | gpu/command_buffer/client/gles2_implementation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/gpu/gpu_view_x.h" 5 #include "chrome/gpu/gpu_view_x.h"
6 6
7 #include "app/gfx/gl/gl_bindings.h"
7 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
8 #include "chrome/common/gpu_messages.h" 9 #include "chrome/common/gpu_messages.h"
9 #include "chrome/gpu/gpu_backing_store_glx.h" 10 #include "chrome/gpu/gpu_backing_store_glx.h"
10 #include "chrome/gpu/gpu_backing_store_glx_context.h" 11 #include "chrome/gpu/gpu_backing_store_glx_context.h"
11 #include "chrome/gpu/gpu_thread.h" 12 #include "chrome/gpu/gpu_thread.h"
12 #include "chrome/gpu/gpu_video_layer_glx.h" 13 #include "chrome/gpu/gpu_video_layer_glx.h"
13 14
14 // X stuff must be last since it does "#define Status int" which messes up some 15 // X stuff must be last since it does "#define Status int" which messes up some
15 // of the header files we indirectly pull in. 16 // of the header files we indirectly pull in.
16 #include <GL/glxew.h>
17 #include <X11/Xutil.h> 17 #include <X11/Xutil.h>
18 18
19 GpuViewX::GpuViewX(GpuThread* gpu_thread, 19 GpuViewX::GpuViewX(GpuThread* gpu_thread,
20 XID parent, 20 XID parent,
21 int32 routing_id) 21 int32 routing_id)
22 : gpu_thread_(gpu_thread), 22 : gpu_thread_(gpu_thread),
23 routing_id_(routing_id), 23 routing_id_(routing_id),
24 window_(parent) { 24 window_(parent) {
25 gpu_thread_->AddRoute(routing_id_, this); 25 gpu_thread_->AddRoute(routing_id_, this);
26 } 26 }
(...skipping 29 matching lines...) Expand all
56 const gfx::Rect& rect) { 56 const gfx::Rect& rect) {
57 } 57 }
58 58
59 void GpuViewX::Repaint() { 59 void GpuViewX::Repaint() {
60 BindContext(); 60 BindContext();
61 61
62 const gfx::Size& size = backing_store_->size(); 62 const gfx::Size& size = backing_store_->size();
63 63
64 glViewport(0, 0, size.width(), size.height()); 64 glViewport(0, 0, size.width(), size.height());
65 65
66 glMatrixMode(GL_MODELVIEW); 66 // TODO(apatrick): These functions are not available in GLES2.
67 glLoadIdentity(); 67 // glMatrixMode(GL_MODELVIEW);
68 // glLoadIdentity();
68 69
69 glEnable(GL_TEXTURE_2D); 70 glEnable(GL_TEXTURE_2D);
70 glBindTexture(GL_TEXTURE_2D, backing_store_->texture_id()); 71 glBindTexture(GL_TEXTURE_2D, backing_store_->texture_id());
71 72
72 // TODO(brettw) use vertex buffers. 73 // TODO(brettw) use vertex buffers.
73 // TODO(brettw) make this so we use the texture size rather than the whole 74 // TODO(brettw) make this so we use the texture size rather than the whole
74 // area size so we don't stretch bitmaps. 75 // area size so we don't stretch bitmaps.
75 glBegin(GL_QUADS); 76 // TODO(apatrick): These functions are not available in GLES2.
76 glTexCoord2f(0.0f, 0.0f); 77 // glBegin(GL_QUADS);
77 glVertex2f(-1.0, 1.0); 78 // glTexCoord2f(0.0f, 0.0f);
79 // glVertex2f(-1.0, 1.0);
78 80
79 glTexCoord2f(0.0f, 1.0f); 81 // glTexCoord2f(0.0f, 1.0f);
80 glVertex2f(-1.0, -1.0); 82 // glVertex2f(-1.0, -1.0);
81 83
82 glTexCoord2f(1.0f, 1.0f); 84 // glTexCoord2f(1.0f, 1.0f);
83 glVertex2f(1.0, -1.0); 85 // glVertex2f(1.0, -1.0);
84 86
85 glTexCoord2f(1.0f, 0.0f); 87 // glTexCoord2f(1.0f, 0.0f);
86 glVertex2f(1.0, 1.0); 88 // glVertex2f(1.0, 1.0);
87 glEnd(); 89 // glEnd();
88 DCHECK(glGetError() == GL_NO_ERROR); 90 DCHECK(glGetError() == GL_NO_ERROR);
89 91
90 if (video_layer_.get()) { 92 if (video_layer_.get()) {
91 video_layer_->Render(backing_store_->size()); 93 video_layer_->Render(backing_store_->size());
92 DCHECK(glGetError() == GL_NO_ERROR); 94 DCHECK(glGetError() == GL_NO_ERROR);
93 } 95 }
94 96
95 // TODO(brettw) when we no longer stretch non-fitting bitmaps, we should 97 // TODO(brettw) when we no longer stretch non-fitting bitmaps, we should
96 // paint white over any unpainted area here. 98 // paint white over any unpainted area here.
97 99
98 glXSwapBuffers(gpu_thread_->display(), window_); 100 glXSwapBuffers(gpu_thread_->display(), window_);
99 } 101 }
100 102
101 void GpuViewX::OnNewBackingStore(int32 routing_id, const gfx::Size& size) { 103 void GpuViewX::OnNewBackingStore(int32 routing_id, const gfx::Size& size) {
102 backing_store_.reset( 104 backing_store_.reset(
103 new GpuBackingStoreGLX(this, gpu_thread_, routing_id, size)); 105 new GpuBackingStoreGLX(this, gpu_thread_, routing_id, size));
104 } 106 }
105 107
106 void GpuViewX::OnNewVideoLayer(int32 routing_id, const gfx::Size& size) { 108 void GpuViewX::OnNewVideoLayer(int32 routing_id, const gfx::Size& size) {
107 video_layer_.reset( 109 video_layer_.reset(
108 new GpuVideoLayerGLX(this, gpu_thread_, routing_id, size)); 110 new GpuVideoLayerGLX(this, gpu_thread_, routing_id, size));
109 } 111 }
110 112
111 void GpuViewX::OnWindowPainted() { 113 void GpuViewX::OnWindowPainted() {
112 Repaint(); 114 Repaint();
113 } 115 }
OLDNEW
« no previous file with comments | « chrome/gpu/gpu_video_layer_glx.cc ('k') | gpu/command_buffer/client/gles2_implementation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698