diff options
author | Ben Murdoch <benm@google.com> | 2010-10-22 13:02:20 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-10-26 15:21:41 +0100 |
commit | a94275402997c11dd2e778633dacf4b7e630a35d (patch) | |
tree | e66f56c67e3b01f22c9c23cd932271ee9ac558ed /WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp | |
parent | 09e26c78506587b3f5d930d7bc72a23287ffbec0 (diff) | |
download | external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.zip external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.gz external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.bz2 |
Merge WebKit at r70209: Initial merge by Git
Change-Id: Id23a68efa36e9d1126bcce0b137872db00892c8e
Diffstat (limited to 'WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp')
-rw-r--r-- | WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp index 7629735..87a0b69 100644 --- a/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp +++ b/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp @@ -30,6 +30,8 @@ #include "config.h" +#if ENABLE(ACCELERATED_2D_CANVAS) + #include "SharedGraphicsContext3D.h" #include "AffineTransform.h" @@ -47,16 +49,26 @@ namespace WebCore { // static -PassRefPtr<SharedGraphicsContext3D> SharedGraphicsContext3D::create(PassOwnPtr<GraphicsContext3D> context) -{ - return adoptRef(new SharedGraphicsContext3D(context)); -} - -SharedGraphicsContext3D::SharedGraphicsContext3D(PassOwnPtr<GraphicsContext3D> context) +PassRefPtr<SharedGraphicsContext3D> SharedGraphicsContext3D::create(HostWindow* hostWindow) +{ + GraphicsContext3D::Attributes attr; + RefPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, hostWindow); + if (!context) + return 0; + OwnPtr<SolidFillShader> solidFillShader = SolidFillShader::create(context.get()); + if (!solidFillShader) + return 0; + OwnPtr<TexShader> texShader = TexShader::create(context.get()); + if (!texShader) + return 0; + return adoptRef(new SharedGraphicsContext3D(context.release(), solidFillShader.release(), texShader.release())); +} + +SharedGraphicsContext3D::SharedGraphicsContext3D(PassRefPtr<GraphicsContext3D> context, PassOwnPtr<SolidFillShader> solidFillShader, PassOwnPtr<TexShader> texShader) : m_context(context) , m_quadVertices(0) - , m_solidFillShader(SolidFillShader::create(m_context.get())) - , m_texShader(TexShader::create(m_context.get())) + , m_solidFillShader(solidFillShader) + , m_texShader(texShader) { allContexts()->add(this); } @@ -215,8 +227,8 @@ void SharedGraphicsContext3D::removeTexturesFor(NativeImagePtr ptr) // static HashSet<SharedGraphicsContext3D*>* SharedGraphicsContext3D::allContexts() { - static OwnPtr<HashSet<SharedGraphicsContext3D*> > set(new HashSet<SharedGraphicsContext3D*>); - return set.get(); + DEFINE_STATIC_LOCAL(HashSet<SharedGraphicsContext3D*>, allContextsSet, ()); + return &allContextsSet; } @@ -334,3 +346,5 @@ bool SharedGraphicsContext3D::paintsIntoCanvasBuffer() const } } // namespace WebCore + +#endif |