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

Side by Side Diff: ui/gl/gl_image_io_surface.cc

Issue 1061733002: Remove windows/mac/ios specific code from //ui (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix default try set Created 5 years, 8 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
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 "ui/gl/gl_image_io_surface.h"
6
7 #include "ui/gl/gl_bindings.h"
8 #include "ui/gl/gl_context.h"
9
10 // Note that this must be included after gl_bindings.h to avoid conflicts.
11 #include <OpenGL/CGLIOSurface.h>
12
13 namespace gfx {
14
15 GLImageIOSurface::GLImageIOSurface(const gfx::Size& size) : size_(size) {
16 }
17
18 GLImageIOSurface::~GLImageIOSurface() {
19 DCHECK(!io_surface_);
20 }
21
22 bool GLImageIOSurface::Initialize(IOSurfaceRef io_surface) {
23 DCHECK(!io_surface_);
24 io_surface_.reset(io_surface);
25 return true;
26 }
27
28 void GLImageIOSurface::Destroy(bool have_context) {
29 io_surface_.reset();
30 }
31
32 gfx::Size GLImageIOSurface::GetSize() { return size_; }
33
34 bool GLImageIOSurface::BindTexImage(unsigned target) {
35 if (target != GL_TEXTURE_RECTANGLE_ARB) {
36 // This might be supported in the future. For now, perform strict
37 // validation so we know what's going on.
38 LOG(ERROR) << "IOSurface requires TEXTURE_RECTANGLE_ARB target";
39 return false;
40 }
41
42 CGLContextObj cgl_context =
43 static_cast<CGLContextObj>(GLContext::GetCurrent()->GetHandle());
44
45 DCHECK(io_surface_);
46 CGLError cgl_error = CGLTexImageIOSurface2D(cgl_context,
47 target,
48 GL_RGBA,
49 size_.width(),
50 size_.height(),
51 GL_BGRA,
52 GL_UNSIGNED_INT_8_8_8_8_REV,
53 io_surface_.get(),
54 0);
55 if (cgl_error != kCGLNoError) {
56 LOG(ERROR) << "Error in CGLTexImageIOSurface2D";
57 return false;
58 }
59
60 return true;
61 }
62
63 bool GLImageIOSurface::CopyTexImage(unsigned target) {
64 return false;
65 }
66
67 bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
68 int z_order,
69 OverlayTransform transform,
70 const Rect& bounds_rect,
71 const RectF& crop_rect) {
72 return false;
73 }
74
75 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | ui/gl/gl_image_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698