Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 } | 245 } |
| 246 | 246 |
| 247 Canvas2DLayerBridge::ImageInfo Canvas2DLayerBridge::createIOSurfaceBackedTexture () | 247 Canvas2DLayerBridge::ImageInfo Canvas2DLayerBridge::createIOSurfaceBackedTexture () |
| 248 { | 248 { |
| 249 if (!m_imageInfoCache.isEmpty()) { | 249 if (!m_imageInfoCache.isEmpty()) { |
| 250 Canvas2DLayerBridge::ImageInfo info = m_imageInfoCache.last(); | 250 Canvas2DLayerBridge::ImageInfo info = m_imageInfoCache.last(); |
| 251 m_imageInfoCache.removeLast(); | 251 m_imageInfoCache.removeLast(); |
| 252 return info; | 252 return info; |
| 253 } | 253 } |
| 254 | 254 |
| 255 WebGraphicsContext3D* webContext = context(); | 255 WebGraphicsContext3D* webContext = context(); |
|
Dan Beam
2016/03/22 04:31:04
now unused
| |
| 256 gpu::gles2::GLES2Interface* gl = contextGL(); | 256 gpu::gles2::GLES2Interface* gl = contextGL(); |
| 257 GLuint imageId = gl->CreateGpuMemoryBufferImageCHROMIUM(m_size.width(), m_si ze.height(), GL_BGRA_EXT, GC3D_SCANOUT_CHROMIUM); | 257 GLuint imageId = gl->CreateGpuMemoryBufferImageCHROMIUM(m_size.width(), m_si ze.height(), GL_BGRA_EXT, GC3D_SCANOUT_CHROMIUM); |
| 258 if (!imageId) | 258 if (!imageId) |
| 259 return Canvas2DLayerBridge::ImageInfo(); | 259 return Canvas2DLayerBridge::ImageInfo(); |
| 260 | 260 |
| 261 GLuint textureId= webContext->createTexture(); | 261 GLuint textureId; |
| 262 if (!textureId) { | 262 gl->GenTextures(1, &textureId); |
| 263 gl->DestroyImageCHROMIUM(imageId); | |
| 264 return Canvas2DLayerBridge::ImageInfo(); | |
| 265 } | |
| 266 | |
| 267 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; | 263 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; |
| 268 gl->BindTexture(target, textureId); | 264 gl->BindTexture(target, textureId); |
| 269 gl->TexParameteri(target, GL_TEXTURE_MAG_FILTER, getGLFilter()); | 265 gl->TexParameteri(target, GL_TEXTURE_MAG_FILTER, getGLFilter()); |
| 270 gl->TexParameteri(target, GL_TEXTURE_MIN_FILTER, getGLFilter()); | 266 gl->TexParameteri(target, GL_TEXTURE_MIN_FILTER, getGLFilter()); |
| 271 gl->TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 267 gl->TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 272 gl->TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 268 gl->TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 273 gl->BindTexImage2DCHROMIUM(target, imageId); | 269 gl->BindTexImage2DCHROMIUM(target, imageId); |
| 274 | 270 |
| 275 return Canvas2DLayerBridge::ImageInfo(imageId, textureId); | 271 return Canvas2DLayerBridge::ImageInfo(imageId, textureId); |
| 276 } | 272 } |
| 277 | 273 |
| 278 void Canvas2DLayerBridge::deleteCHROMIUMImage(ImageInfo info) | 274 void Canvas2DLayerBridge::deleteCHROMIUMImage(ImageInfo info) |
| 279 { | 275 { |
| 280 WebGraphicsContext3D* webContext = context(); | 276 WebGraphicsContext3D* webContext = context(); |
|
Dan Beam
2016/03/22 04:31:04
now unused
| |
| 281 gpu::gles2::GLES2Interface* gl = contextGL(); | 277 gpu::gles2::GLES2Interface* gl = contextGL(); |
| 282 if (gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) | 278 if (gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) |
| 283 return; | 279 return; |
| 284 | 280 |
| 285 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; | 281 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; |
| 286 gl->BindTexture(target, info.m_textureId); | 282 gl->BindTexture(target, info.m_textureId); |
| 287 gl->ReleaseTexImage2DCHROMIUM(target, info.m_imageId); | 283 gl->ReleaseTexImage2DCHROMIUM(target, info.m_imageId); |
| 288 gl->DestroyImageCHROMIUM(info.m_imageId); | 284 gl->DestroyImageCHROMIUM(info.m_imageId); |
| 289 webContext->deleteTexture(info.m_textureId); | 285 gl->DeleteTextures(1, &info.m_textureId); |
| 290 gl->BindTexture(target, 0); | 286 gl->BindTexture(target, 0); |
| 291 | 287 |
| 292 resetSkiaTextureBinding(); | 288 resetSkiaTextureBinding(); |
| 293 } | 289 } |
| 294 | 290 |
| 295 void Canvas2DLayerBridge::clearCHROMIUMImageCache() | 291 void Canvas2DLayerBridge::clearCHROMIUMImageCache() |
| 296 { | 292 { |
| 297 for (const auto& it : m_imageInfoCache) { | 293 for (const auto& it : m_imageInfoCache) { |
| 298 deleteCHROMIUMImage(it); | 294 deleteCHROMIUMImage(it); |
| 299 } | 295 } |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1007 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 1003 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
| 1008 } | 1004 } |
| 1009 | 1005 |
| 1010 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 1006 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
| 1011 { | 1007 { |
| 1012 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); | 1008 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib ernationEvents", HibernationEventCount)); |
| 1013 hibernationHistogram.count(event); | 1009 hibernationHistogram.count(event); |
| 1014 } | 1010 } |
| 1015 | 1011 |
| 1016 } // namespace blink | 1012 } // namespace blink |
| OLD | NEW |