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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 1508903002: Use GrGLTextureInfo for Skia texture handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ignore_gl_target
Patch Set: Address dcastagna's comments Created 5 years 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
OLDNEW
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 25 matching lines...) Expand all
36 #include "public/platform/Platform.h" 36 #include "public/platform/Platform.h"
37 #include "public/platform/WebCompositorSupport.h" 37 #include "public/platform/WebCompositorSupport.h"
38 #include "public/platform/WebGraphicsContext3D.h" 38 #include "public/platform/WebGraphicsContext3D.h"
39 #include "public/platform/WebGraphicsContext3DProvider.h" 39 #include "public/platform/WebGraphicsContext3DProvider.h"
40 #include "public/platform/WebScheduler.h" 40 #include "public/platform/WebScheduler.h"
41 #include "public/platform/WebTraceLocation.h" 41 #include "public/platform/WebTraceLocation.h"
42 #include "third_party/skia/include/core/SkData.h" 42 #include "third_party/skia/include/core/SkData.h"
43 #include "third_party/skia/include/core/SkPictureRecorder.h" 43 #include "third_party/skia/include/core/SkPictureRecorder.h"
44 #include "third_party/skia/include/core/SkSurface.h" 44 #include "third_party/skia/include/core/SkSurface.h"
45 #include "third_party/skia/include/gpu/GrContext.h" 45 #include "third_party/skia/include/gpu/GrContext.h"
46 #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
46 #include "wtf/RefCountedLeakCounter.h" 47 #include "wtf/RefCountedLeakCounter.h"
47 48
48 namespace { 49 namespace {
49 enum { 50 enum {
50 InvalidMailboxIndex = -1, 51 InvalidMailboxIndex = -1,
51 MaxCanvasAnimationBacklog = 2, // Make sure the the GPU is never more than t wo animation frames behind. 52 MaxCanvasAnimationBacklog = 2, // Make sure the the GPU is never more than t wo animation frames behind.
52 }; 53 };
53 54
54 #ifndef NDEBUG 55 #ifndef NDEBUG
55 WTF::RefCountedLeakCounter& canvas2DLayerBridgeInstanceCounter() 56 WTF::RefCountedLeakCounter& canvas2DLayerBridgeInstanceCounter()
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 // Need to flush skia's internal queue because texture is about to be access ed directly 596 // Need to flush skia's internal queue because texture is about to be access ed directly
596 grContext->flush(); 597 grContext->flush();
597 598
598 ASSERT(image->getTexture()); 599 ASSERT(image->getTexture());
599 600
600 // Because of texture sharing with the compositor, we must invalidate 601 // Because of texture sharing with the compositor, we must invalidate
601 // the state cached in skia so that the deferred copy on write 602 // the state cached in skia so that the deferred copy on write
602 // in SkSurface_Gpu does not make any false assumptions. 603 // in SkSurface_Gpu does not make any false assumptions.
603 mailboxInfo.m_image->getTexture()->textureParamsModified(); 604 mailboxInfo.m_image->getTexture()->textureParamsModified();
604 605
605 webContext->bindTexture(GL_TEXTURE_2D, mailboxInfo.m_image->getTexture()->ge tTextureHandle()); 606 GLuint textureID = reinterpret_cast<const GrGLTextureInfo*>(mailboxInfo.m_im age->getTexture()->getTextureHandle())->fID;
Daniele Castagna 2015/12/16 19:30:18 nit: this line seems to long.
607 webContext->bindTexture(GL_TEXTURE_2D, textureID);
606 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); 608 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
607 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); 609 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
608 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); 610 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
609 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); 611 webContext->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
610 612
611 // Re-use the texture's existing mailbox, if there is one. 613 // Re-use the texture's existing mailbox, if there is one.
612 if (image->getTexture()->getCustomData()) { 614 if (image->getTexture()->getCustomData()) {
613 ASSERT(image->getTexture()->getCustomData()->size() == sizeof(mailboxInf o.m_mailbox.name)); 615 ASSERT(image->getTexture()->getCustomData()->size() == sizeof(mailboxInf o.m_mailbox.name));
614 memcpy(&mailboxInfo.m_mailbox.name[0], image->getTexture()->getCustomDat a()->data(), sizeof(mailboxInfo.m_mailbox.name)); 616 memcpy(&mailboxInfo.m_mailbox.name[0], image->getTexture()->getCustomDat a()->data(), sizeof(mailboxInfo.m_mailbox.name));
615 } else { 617 } else {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 m_image = other.m_image; 787 m_image = other.m_image;
786 m_parentLayerBridge = other.m_parentLayerBridge; 788 m_parentLayerBridge = other.m_parentLayerBridge;
787 } 789 }
788 790
789 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event) 791 void Canvas2DLayerBridge::Logger::reportHibernationEvent(HibernationEvent event)
790 { 792 {
791 blink::Platform::current()->histogramEnumeration("Canvas.HibernationEvents", event, HibernationEventCount); 793 blink::Platform::current()->histogramEnumeration("Canvas.HibernationEvents", event, HibernationEventCount);
792 } 794 }
793 795
794 } // namespace blink 796 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698