Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/renderer_host/accelerated_surface_container_touch.h" | 5 #include "chrome/browser/renderer_host/accelerated_surface_container_touch.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 #include <X11/extensions/Xcomposite.h> | 8 #include <X11/extensions/Xcomposite.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "third_party/angle/include/EGL/egl.h" | 11 #include "third_party/angle/include/EGL/egl.h" |
| 12 #include "third_party/angle/include/EGL/eglext.h" | 12 #include "third_party/angle/include/EGL/eglext.h" |
| 13 #include "ui/gfx/gl/gl_bindings.h" | 13 #include "ui/gfx/gl/gl_bindings.h" |
| 14 #include "ui/gfx/gl/gl_implementation.h" | 14 #include "ui/gfx/gl/gl_implementation.h" |
| 15 #include "ui/gfx/gl/gl_surface_egl.h" | 15 #include "ui/gfx/gl/gl_surface_egl.h" |
| 16 #include "ui/gfx/gl/gl_surface_glx.h" | 16 #include "ui/gfx/gl/gl_surface_glx.h" |
| 17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 18 #include "ui/gfx/transform.h" | 18 #include "ui/gfx/transform.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class AcceleratedSurfaceContainerTouchEGL | 22 class AcceleratedSurfaceContainerTouchEGL |
| 23 : public AcceleratedSurfaceContainerTouch { | 23 : public AcceleratedSurfaceContainerTouch { |
| 24 public: | 24 public: |
| 25 AcceleratedSurfaceContainerTouchEGL(const gfx::Size& size, | 25 explicit AcceleratedSurfaceContainerTouchEGL(const gfx::Size& size); |
| 26 uint64 surface_handle); | 26 |
| 27 virtual bool Initialize(uint64 *surface_id) OVERRIDE; | |
| 28 | |
| 27 // TextureGL implementation | 29 // TextureGL implementation |
| 28 virtual void Draw(const ui::TextureDrawParams& params, | 30 virtual void Draw(const ui::TextureDrawParams& params, |
| 29 const gfx::Rect& clip_bounds_in_texture) OVERRIDE; | 31 const gfx::Rect& clip_bounds_in_texture) OVERRIDE; |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 ~AcceleratedSurfaceContainerTouchEGL(); | 34 ~AcceleratedSurfaceContainerTouchEGL(); |
| 33 | 35 |
| 34 void* image_; | 36 void* image_; |
| 35 | 37 |
| 36 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerTouchEGL); | 38 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerTouchEGL); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 class AcceleratedSurfaceContainerTouchGLX | 41 class AcceleratedSurfaceContainerTouchGLX |
| 40 : public AcceleratedSurfaceContainerTouch { | 42 : public AcceleratedSurfaceContainerTouch { |
| 41 public: | 43 public: |
| 42 AcceleratedSurfaceContainerTouchGLX(const gfx::Size& size, | 44 explicit AcceleratedSurfaceContainerTouchGLX(const gfx::Size& size); |
| 43 uint64 surface_handle); | 45 |
| 46 virtual bool Initialize(uint64 *surface_id) OVERRIDE; | |
| 47 | |
| 44 // TextureGL implementation | 48 // TextureGL implementation |
| 45 virtual void Draw(const ui::TextureDrawParams& params, | 49 virtual void Draw(const ui::TextureDrawParams& params, |
| 46 const gfx::Rect& clip_bounds_in_texture) OVERRIDE; | 50 const gfx::Rect& clip_bounds_in_texture) OVERRIDE; |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 ~AcceleratedSurfaceContainerTouchGLX(); | 53 ~AcceleratedSurfaceContainerTouchGLX(); |
| 50 | 54 |
| 51 XID pixmap_; | 55 XID pixmap_; |
| 52 XID glx_pixmap_; | 56 XID glx_pixmap_; |
| 53 | 57 |
| 54 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerTouchGLX); | 58 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerTouchGLX); |
| 55 }; | 59 }; |
| 56 | 60 |
| 61 class AcceleratedSurfaceContainerTouchOSMesa | |
| 62 : public AcceleratedSurfaceContainerTouch { | |
| 63 public: | |
| 64 explicit AcceleratedSurfaceContainerTouchOSMesa(const gfx::Size& size); | |
| 65 | |
| 66 virtual bool Initialize(uint64 *surface_id) OVERRIDE; | |
| 67 | |
| 68 // TextureGL implementation | |
| 69 virtual void Draw(const ui::TextureDrawParams& params, | |
| 70 const gfx::Rect& clip_bounds_in_texture) OVERRIDE; | |
| 71 | |
| 72 // Some implementations of this class use shared memory, this the handle | |
| 73 // to the shared buffer, which is part of the surface container. | |
| 74 virtual TransportDIB::Handle handle() const OVERRIDE; | |
| 75 | |
| 76 private: | |
| 77 ~AcceleratedSurfaceContainerTouchOSMesa(); | |
| 78 | |
| 79 scoped_ptr<TransportDIB> shared_mem_; | |
| 80 | |
| 81 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurfaceContainerTouchOSMesa); | |
| 82 }; | |
| 83 | |
| 57 class ScopedPtrXFree { | 84 class ScopedPtrXFree { |
| 58 public: | 85 public: |
| 59 void operator()(void* x) const { | 86 void operator()(void* x) const { |
| 60 ::XFree(x); | 87 ::XFree(x); |
| 61 } | 88 } |
| 62 }; | 89 }; |
| 63 | 90 |
| 64 AcceleratedSurfaceContainerTouchEGL::AcceleratedSurfaceContainerTouchEGL( | 91 AcceleratedSurfaceContainerTouchEGL::AcceleratedSurfaceContainerTouchEGL( |
| 65 const gfx::Size& size, | 92 const gfx::Size& size) |
| 66 uint64 surface_handle) | |
| 67 : AcceleratedSurfaceContainerTouch(size), | 93 : AcceleratedSurfaceContainerTouch(size), |
| 68 image_(NULL) { | 94 image_(NULL) { |
| 95 } | |
| 96 | |
| 97 bool AcceleratedSurfaceContainerTouchEGL::Initialize(uint64 *surface_id) { | |
| 69 ui::SharedResources* instance = ui::SharedResources::GetInstance(); | 98 ui::SharedResources* instance = ui::SharedResources::GetInstance(); |
| 70 DCHECK(instance); | 99 DCHECK(instance); |
| 71 instance->MakeSharedContextCurrent(); | 100 instance->MakeSharedContextCurrent(); |
| 72 | 101 |
| 73 image_ = eglCreateImageKHR( | 102 image_ = eglCreateImageKHR( |
| 74 gfx::GLSurfaceEGL::GetHardwareDisplay(), EGL_NO_CONTEXT, | 103 gfx::GLSurfaceEGL::GetHardwareDisplay(), EGL_NO_CONTEXT, |
| 75 EGL_NATIVE_PIXMAP_KHR, reinterpret_cast<void*>(surface_handle), NULL); | 104 EGL_NATIVE_PIXMAP_KHR, reinterpret_cast<void*>(*surface_id), NULL); |
| 76 | 105 |
| 77 glGenTextures(1, &texture_id_); | 106 glGenTextures(1, &texture_id_); |
| 78 glBindTexture(GL_TEXTURE_2D, texture_id_); | 107 glBindTexture(GL_TEXTURE_2D, texture_id_); |
| 79 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 108 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 80 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 109 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 81 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 110 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 82 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 111 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 83 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image_); | 112 glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image_); |
| 84 glFlush(); | 113 glFlush(); |
| 114 | |
| 115 return true; | |
| 85 } | 116 } |
| 86 | 117 |
| 87 AcceleratedSurfaceContainerTouchEGL::~AcceleratedSurfaceContainerTouchEGL() { | 118 AcceleratedSurfaceContainerTouchEGL::~AcceleratedSurfaceContainerTouchEGL() { |
| 88 ui::SharedResources* instance = ui::SharedResources::GetInstance(); | 119 ui::SharedResources* instance = ui::SharedResources::GetInstance(); |
| 89 DCHECK(instance); | 120 DCHECK(instance); |
| 90 instance->MakeSharedContextCurrent(); | 121 instance->MakeSharedContextCurrent(); |
| 91 | 122 |
| 92 eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), image_); | 123 eglDestroyImageKHR(gfx::GLSurfaceEGL::GetHardwareDisplay(), image_); |
| 93 glFlush(); | 124 glFlush(); |
| 94 } | 125 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 108 flipped.ConcatTransform(params.transform); | 139 flipped.ConcatTransform(params.transform); |
| 109 | 140 |
| 110 modified_params.transform = flipped; | 141 modified_params.transform = flipped; |
| 111 | 142 |
| 112 DrawInternal(*instance->program_no_swizzle(), | 143 DrawInternal(*instance->program_no_swizzle(), |
| 113 modified_params, | 144 modified_params, |
| 114 clip_bounds_in_texture); | 145 clip_bounds_in_texture); |
| 115 } | 146 } |
| 116 | 147 |
| 117 AcceleratedSurfaceContainerTouchGLX::AcceleratedSurfaceContainerTouchGLX( | 148 AcceleratedSurfaceContainerTouchGLX::AcceleratedSurfaceContainerTouchGLX( |
| 118 const gfx::Size& size, | 149 const gfx::Size& size) |
| 119 uint64 surface_handle) | |
| 120 : AcceleratedSurfaceContainerTouch(size), | 150 : AcceleratedSurfaceContainerTouch(size), |
| 121 pixmap_(0), | 151 pixmap_(0), |
| 122 glx_pixmap_(0) { | 152 glx_pixmap_(0) { |
| 153 } | |
| 154 | |
| 155 bool AcceleratedSurfaceContainerTouchGLX::Initialize(uint64 *surface_id) { | |
| 123 ui::SharedResources* instance = ui::SharedResources::GetInstance(); | 156 ui::SharedResources* instance = ui::SharedResources::GetInstance(); |
| 124 DCHECK(instance); | 157 DCHECK(instance); |
| 125 instance->MakeSharedContextCurrent(); | 158 instance->MakeSharedContextCurrent(); |
| 126 | 159 |
| 127 // Create pixmap from window. | 160 // Create pixmap from window. |
| 161 // We receive a window here rather than a pixmap directly because drivers | |
| 162 // require (or required) that the pixmap used to create the GL texture be | |
| 163 // created in the same process as the texture. | |
|
jonathan.backer
2011/09/21 20:27:36
Thanks.
| |
| 128 Display* dpy = gfx::GLSurfaceGLX::GetDisplay(); | 164 Display* dpy = gfx::GLSurfaceGLX::GetDisplay(); |
| 129 int event_base, error_base; | 165 int event_base, error_base; |
| 130 if (XCompositeQueryExtension(dpy, &event_base, &error_base)) { | 166 if (XCompositeQueryExtension(dpy, &event_base, &error_base)) { |
| 131 int major = 0, minor = 2; | 167 int major = 0, minor = 2; |
| 132 XCompositeQueryVersion(dpy, &major, &minor); | 168 XCompositeQueryVersion(dpy, &major, &minor); |
| 133 if (major == 0 && minor < 2) { | 169 if (major == 0 && minor < 2) { |
| 134 LOG(ERROR) << "Pixmap from window not supported."; | 170 LOG(ERROR) << "Pixmap from window not supported."; |
| 135 return; | 171 return false; |
| 136 } | 172 } |
| 137 } | 173 } |
| 138 pixmap_ = XCompositeNameWindowPixmap(dpy, surface_handle); | 174 pixmap_ = XCompositeNameWindowPixmap(dpy, *surface_id); |
| 139 | 175 |
| 140 // Wrap the pixmap in a GLXPixmap | 176 // Wrap the pixmap in a GLXPixmap |
| 141 int screen = DefaultScreen(dpy); | 177 int screen = DefaultScreen(dpy); |
| 142 XWindowAttributes gwa; | 178 XWindowAttributes gwa; |
| 143 XGetWindowAttributes(dpy, RootWindow(dpy, screen), &gwa); | 179 XGetWindowAttributes(dpy, RootWindow(dpy, screen), &gwa); |
| 144 unsigned int visualid = XVisualIDFromVisual(gwa.visual); | 180 unsigned int visualid = XVisualIDFromVisual(gwa.visual); |
| 145 | 181 |
| 146 int nfbconfigs, config; | 182 int nfbconfigs, config; |
| 147 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> fbconfigs( | 183 scoped_ptr_malloc<GLXFBConfig, ScopedPtrXFree> fbconfigs( |
| 148 glXGetFBConfigs(dpy, screen, &nfbconfigs)); | 184 glXGetFBConfigs(dpy, screen, &nfbconfigs)); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 175 if (value == GL_FALSE) | 211 if (value == GL_FALSE) |
| 176 continue; | 212 continue; |
| 177 | 213 |
| 178 break; | 214 break; |
| 179 } | 215 } |
| 180 | 216 |
| 181 if (config == nfbconfigs) { | 217 if (config == nfbconfigs) { |
| 182 LOG(ERROR) | 218 LOG(ERROR) |
| 183 << "Could not find configuration suitable for binding a pixmap " | 219 << "Could not find configuration suitable for binding a pixmap " |
| 184 << "as a texture."; | 220 << "as a texture."; |
| 185 return; | 221 return false; |
| 186 } | 222 } |
| 187 | 223 |
| 188 const int pixmapAttribs[] = { | 224 const int pixmapAttribs[] = { |
| 189 GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, | 225 GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, |
| 190 GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT, | 226 GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT, |
| 191 0 | 227 0 |
| 192 }; | 228 }; |
| 193 | 229 |
| 194 glx_pixmap_ = glXCreatePixmap( | 230 glx_pixmap_ = glXCreatePixmap( |
| 195 dpy, fbconfigs.get()[config], pixmap_, pixmapAttribs); | 231 dpy, fbconfigs.get()[config], pixmap_, pixmapAttribs); |
| 196 | 232 |
| 197 // Create texture. | 233 // Create texture. |
| 198 glGenTextures(1, &texture_id_); | 234 glGenTextures(1, &texture_id_); |
| 199 glBindTexture(GL_TEXTURE_2D, texture_id_); | 235 glBindTexture(GL_TEXTURE_2D, texture_id_); |
| 200 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 236 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
| 201 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | 237 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); |
| 202 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 238 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 203 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 239 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 240 | |
| 241 return true; | |
| 204 } | 242 } |
| 205 | 243 |
| 206 AcceleratedSurfaceContainerTouchGLX::~AcceleratedSurfaceContainerTouchGLX() { | 244 AcceleratedSurfaceContainerTouchGLX::~AcceleratedSurfaceContainerTouchGLX() { |
| 207 ui::SharedResources* instance = ui::SharedResources::GetInstance(); | 245 ui::SharedResources* instance = ui::SharedResources::GetInstance(); |
| 208 DCHECK(instance); | 246 DCHECK(instance); |
| 209 instance->MakeSharedContextCurrent(); | 247 instance->MakeSharedContextCurrent(); |
| 210 | 248 |
| 211 Display* dpy = gfx::GLSurfaceGLX::GetDisplay(); | 249 Display* dpy = gfx::GLSurfaceGLX::GetDisplay(); |
| 212 if (glx_pixmap_) | 250 if (glx_pixmap_) |
| 213 glXDestroyGLXPixmap(dpy, glx_pixmap_); | 251 glXDestroyGLXPixmap(dpy, glx_pixmap_); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 224 Display* dpy = gfx::GLSurfaceGLX::GetDisplay(); | 262 Display* dpy = gfx::GLSurfaceGLX::GetDisplay(); |
| 225 | 263 |
| 226 glBindTexture(GL_TEXTURE_2D, texture_id_); | 264 glBindTexture(GL_TEXTURE_2D, texture_id_); |
| 227 glXBindTexImageEXT(dpy, glx_pixmap_, GLX_FRONT_LEFT_EXT, NULL); | 265 glXBindTexImageEXT(dpy, glx_pixmap_, GLX_FRONT_LEFT_EXT, NULL); |
| 228 DrawInternal(*instance->program_no_swizzle(), | 266 DrawInternal(*instance->program_no_swizzle(), |
| 229 params, | 267 params, |
| 230 clip_bounds_in_texture); | 268 clip_bounds_in_texture); |
| 231 glXReleaseTexImageEXT(dpy, glx_pixmap_, GLX_FRONT_LEFT_EXT); | 269 glXReleaseTexImageEXT(dpy, glx_pixmap_, GLX_FRONT_LEFT_EXT); |
| 232 } | 270 } |
| 233 | 271 |
| 272 AcceleratedSurfaceContainerTouchOSMesa::AcceleratedSurfaceContainerTouchOSMesa( | |
| 273 const gfx::Size& size) | |
| 274 : AcceleratedSurfaceContainerTouch(size), | |
| 275 shared_mem_(0) { | |
| 276 } | |
| 277 | |
| 278 bool AcceleratedSurfaceContainerTouchOSMesa::Initialize(uint64 *surface_id) { | |
| 279 static uint32 next_id = 1; | |
| 280 | |
| 281 ui::SharedResources* instance = ui::SharedResources::GetInstance(); | |
| 282 DCHECK(instance); | |
| 283 instance->MakeSharedContextCurrent(); | |
| 284 | |
| 285 // We expect to make the id here, so don't want the other end giving us one | |
| 286 DCHECK_EQ(*surface_id, static_cast<uint64>(0)); | |
| 287 | |
| 288 // It's possible that this ID gneration could clash with IDs from other | |
| 289 // AcceleratedSurfaceContainerTouch* objects, however we should never have | |
| 290 // ids active from more than one type at the same time, so we have free | |
| 291 // reign of the id namespace. | |
| 292 *surface_id = next_id++; | |
| 293 | |
| 294 shared_mem_.reset( | |
| 295 TransportDIB::Create(size_.GetArea() * 4, // GL_RGBA=4 B/px | |
| 296 *surface_id)); | |
| 297 // Create texture. | |
| 298 glGenTextures(1, &texture_id_); | |
| 299 glBindTexture(GL_TEXTURE_2D, texture_id_); | |
| 300 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | |
| 301 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |
| 302 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | |
| 303 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | |
| 304 | |
| 305 // we generate the ID to be used here. | |
| 306 return true; | |
| 307 } | |
| 308 | |
| 309 AcceleratedSurfaceContainerTouchOSMesa:: | |
| 310 ~AcceleratedSurfaceContainerTouchOSMesa() { | |
| 311 } | |
| 312 | |
| 313 TransportDIB::Handle AcceleratedSurfaceContainerTouchOSMesa::handle() const { | |
| 314 if (shared_mem_.get()) | |
| 315 return shared_mem_->handle(); | |
| 316 else | |
| 317 return TransportDIB::DefaultHandleValue(); | |
| 318 } | |
| 319 | |
| 320 | |
| 321 void AcceleratedSurfaceContainerTouchOSMesa::Draw( | |
| 322 const ui::TextureDrawParams& params, | |
| 323 const gfx::Rect& clip_bounds_in_texture) { | |
| 324 ui::SharedResources* instance = ui::SharedResources::GetInstance(); | |
| 325 DCHECK(instance); | |
| 326 | |
| 327 if (shared_mem_.get()) { | |
| 328 glBindTexture(GL_TEXTURE_2D, texture_id_); | |
| 329 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, | |
| 330 size_.width(), size_.height(), 0, | |
| 331 GL_RGBA, GL_UNSIGNED_BYTE, shared_mem_->memory()); | |
| 332 | |
| 333 DrawInternal(*instance->program_no_swizzle(), | |
| 334 params, | |
| 335 clip_bounds_in_texture); | |
| 336 } | |
| 337 } | |
| 338 | |
| 234 } // namespace | 339 } // namespace |
| 235 | 340 |
| 236 AcceleratedSurfaceContainerTouch::AcceleratedSurfaceContainerTouch( | 341 AcceleratedSurfaceContainerTouch::AcceleratedSurfaceContainerTouch( |
| 237 const gfx::Size& size) : TextureGL(size) { | 342 const gfx::Size& size) : TextureGL(size) { |
| 238 } | 343 } |
| 239 | 344 |
| 345 TransportDIB::Handle AcceleratedSurfaceContainerTouch::handle() const { | |
| 346 return TransportDIB::DefaultHandleValue(); | |
| 347 } | |
| 348 | |
| 240 // static | 349 // static |
| 241 AcceleratedSurfaceContainerTouch* | 350 AcceleratedSurfaceContainerTouch* |
| 242 AcceleratedSurfaceContainerTouch::CreateAcceleratedSurfaceContainer( | 351 AcceleratedSurfaceContainerTouch::CreateAcceleratedSurfaceContainer( |
| 243 const gfx::Size& size, | 352 const gfx::Size& size) { |
| 244 uint64 surface_handle) { | |
| 245 switch (gfx::GetGLImplementation()) { | 353 switch (gfx::GetGLImplementation()) { |
| 246 case gfx::kGLImplementationDesktopGL: | 354 case gfx::kGLImplementationDesktopGL: |
| 247 return new AcceleratedSurfaceContainerTouchGLX(size, | 355 return new AcceleratedSurfaceContainerTouchGLX(size); |
| 248 surface_handle); | |
| 249 case gfx::kGLImplementationEGLGLES2: | 356 case gfx::kGLImplementationEGLGLES2: |
| 250 return new AcceleratedSurfaceContainerTouchEGL(size, | 357 return new AcceleratedSurfaceContainerTouchEGL(size); |
| 251 surface_handle); | 358 case gfx::kGLImplementationOSMesaGL: |
| 359 return new AcceleratedSurfaceContainerTouchOSMesa(size); | |
| 252 default: | 360 default: |
| 253 NOTREACHED(); | 361 NOTREACHED(); |
| 254 return NULL; | 362 return NULL; |
| 255 } | 363 } |
| 256 } | 364 } |
| 257 | 365 |
| 258 void AcceleratedSurfaceContainerTouch::SetCanvas( | 366 void AcceleratedSurfaceContainerTouch::SetCanvas( |
| 259 const SkCanvas& canvas, | 367 const SkCanvas& canvas, |
| 260 const gfx::Point& origin, | 368 const gfx::Point& origin, |
| 261 const gfx::Size& overall_size) { | 369 const gfx::Size& overall_size) { |
| 262 NOTREACHED(); | 370 NOTREACHED(); |
| 263 } | 371 } |
| OLD | NEW |