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

Side by Side Diff: remoting/capturer/mac/scoped_pixel_buffer_object.cc

Issue 12047101: Move screen capturers from remoting/capturer to media/video/capturer/screen (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/capturer/mac/scoped_pixel_buffer_object.h"
6
7 namespace remoting {
8
9 ScopedPixelBufferObject::ScopedPixelBufferObject()
10 : cgl_context_(NULL),
11 pixel_buffer_object_(0) {
12 }
13
14 ScopedPixelBufferObject::~ScopedPixelBufferObject() {
15 Release();
16 }
17
18 bool ScopedPixelBufferObject::Init(CGLContextObj cgl_context,
19 int size_in_bytes) {
20 cgl_context_ = cgl_context;
21 CGLContextObj CGL_MACRO_CONTEXT = cgl_context_;
22 glGenBuffersARB(1, &pixel_buffer_object_);
23 if (glGetError() == GL_NO_ERROR) {
24 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pixel_buffer_object_);
25 glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, size_in_bytes, NULL,
26 GL_STREAM_READ_ARB);
27 glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
28 if (glGetError() != GL_NO_ERROR) {
29 Release();
30 }
31 } else {
32 cgl_context_ = NULL;
33 pixel_buffer_object_ = 0;
34 }
35 return pixel_buffer_object_ != 0;
36 }
37
38 void ScopedPixelBufferObject::Release() {
39 if (pixel_buffer_object_) {
40 CGLContextObj CGL_MACRO_CONTEXT = cgl_context_;
41 glDeleteBuffersARB(1, &pixel_buffer_object_);
42 cgl_context_ = NULL;
43 pixel_buffer_object_ = 0;
44 }
45 }
46
47 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/capturer/mac/scoped_pixel_buffer_object.h ('k') | remoting/capturer/mouse_cursor_shape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698