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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 webContext->texParameteri(target, GL_TEXTURE_MIN_FILTER, getGLFilter()); | 267 webContext->texParameteri(target, GL_TEXTURE_MIN_FILTER, getGLFilter()); |
268 webContext->texParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 268 webContext->texParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
269 webContext->texParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 269 webContext->texParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
270 webContext->bindTexImage2DCHROMIUM(target, imageId); | 270 webContext->bindTexImage2DCHROMIUM(target, imageId); |
271 | 271 |
272 return Canvas2DLayerBridge::ImageInfo(imageId, textureId); | 272 return Canvas2DLayerBridge::ImageInfo(imageId, textureId); |
273 } | 273 } |
274 | 274 |
275 void Canvas2DLayerBridge::deleteCHROMIUMImage(ImageInfo info) | 275 void Canvas2DLayerBridge::deleteCHROMIUMImage(ImageInfo info) |
276 { | 276 { |
277 WebGraphicsContext3D* webContext = context(); | 277 if (m_contextProvider->contextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERR
OR) |
278 if (webContext->isContextLost()) | |
279 return; | 278 return; |
280 | 279 |
281 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; | 280 GLenum target = GC3D_TEXTURE_RECTANGLE_ARB; |
| 281 WebGraphicsContext3D* webContext = context(); |
282 webContext->bindTexture(target, info.m_textureId); | 282 webContext->bindTexture(target, info.m_textureId); |
283 webContext->releaseTexImage2DCHROMIUM(target, info.m_imageId); | 283 webContext->releaseTexImage2DCHROMIUM(target, info.m_imageId); |
284 webContext->destroyImageCHROMIUM(info.m_imageId); | 284 webContext->destroyImageCHROMIUM(info.m_imageId); |
285 webContext->deleteTexture(info.m_textureId); | 285 webContext->deleteTexture(info.m_textureId); |
286 webContext->bindTexture(target, 0); | 286 webContext->bindTexture(target, 0); |
287 | 287 |
288 resetSkiaTextureBinding(); | 288 resetSkiaTextureBinding(); |
289 } | 289 } |
290 | 290 |
291 void Canvas2DLayerBridge::clearCHROMIUMImageCache() | 291 void Canvas2DLayerBridge::clearCHROMIUMImageCache() |
(...skipping 10 matching lines...) Expand all Loading... |
302 MailboxInfo tmp; | 302 MailboxInfo tmp; |
303 tmp.m_parentLayerBridge = this; | 303 tmp.m_parentLayerBridge = this; |
304 m_mailboxes.prepend(tmp); | 304 m_mailboxes.prepend(tmp); |
305 } | 305 } |
306 | 306 |
307 bool Canvas2DLayerBridge::prepareMailboxFromImage(PassRefPtr<SkImage> image, Web
ExternalTextureMailbox* outMailbox) | 307 bool Canvas2DLayerBridge::prepareMailboxFromImage(PassRefPtr<SkImage> image, Web
ExternalTextureMailbox* outMailbox) |
308 { | 308 { |
309 createMailboxInfo(); | 309 createMailboxInfo(); |
310 MailboxInfo& mailboxInfo = m_mailboxes.first(); | 310 MailboxInfo& mailboxInfo = m_mailboxes.first(); |
311 mailboxInfo.m_mailbox.nearestNeighbor = getGLFilter() == GL_NEAREST; | 311 mailboxInfo.m_mailbox.nearestNeighbor = getGLFilter() == GL_NEAREST; |
| 312 mailboxInfo.m_mailbox.textureSize = WebSize(m_size.width(), m_size.height())
; |
312 | 313 |
313 GrContext* grContext = m_contextProvider->grContext(); | 314 GrContext* grContext = m_contextProvider->grContext(); |
314 if (!grContext) { | 315 if (!grContext) { |
315 mailboxInfo.m_image = image; | 316 mailboxInfo.m_image = image; |
316 return true; // for testing: skip gl stuff when using a mock graphics co
ntext. | 317 return true; // for testing: skip gl stuff when using a mock graphics co
ntext. |
317 } | 318 } |
318 | 319 |
319 #if USE_IOSURFACE_FOR_2D_CANVAS | 320 #if USE_IOSURFACE_FOR_2D_CANVAS |
320 if (RuntimeEnabledFeatures::canvas2dImageChromiumEnabled()) { | 321 if (RuntimeEnabledFeatures::canvas2dImageChromiumEnabled()) { |
321 if (prepareIOSurfaceMailboxFromImage(image.get(), outMailbox)) | 322 if (prepareIOSurfaceMailboxFromImage(image.get(), outMailbox)) |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 #endif // USE_IOSURFACE_FOR_2D_CANVAS | 991 #endif // USE_IOSURFACE_FOR_2D_CANVAS |
991 } | 992 } |
992 | 993 |
993 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) | 994 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) |
994 { | 995 { |
995 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); | 996 DEFINE_STATIC_LOCAL(EnumerationHistogram, hibernationHistogram, ("Canvas.Hib
ernationEvents", HibernationEventCount)); |
996 hibernationHistogram.count(event); | 997 hibernationHistogram.count(event); |
997 } | 998 } |
998 | 999 |
999 } // namespace blink | 1000 } // namespace blink |
OLD | NEW |