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