Bug 1254447 - Don't always check UseAcceleratedCanvas when calling GetSkiaGLGlue, r=jrmuizel a=ritu

MozReview-Commit-ID: 95GY5aGJGK1
This commit is contained in:
peter chang 2016-03-16 12:09:17 +08:00
parent 2a31ffdf54
commit cef4713bd6
2 changed files with 12 additions and 7 deletions

View File

@ -996,9 +996,10 @@ CanvasRenderingContext2D::~CanvasRenderingContext2D()
}
#ifdef USE_SKIA_GPU
if (mVideoTexture) {
MOZ_ASSERT(gfxPlatform::GetPlatform()->GetSkiaGLGlue(), "null SkiaGLGlue");
gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext()->MakeCurrent();
gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext()->fDeleteTextures(1, &mVideoTexture);
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);
glue->GetGLContext()->MakeCurrent();
glue->GetGLContext()->fDeleteTextures(1, &mVideoTexture);
}
#endif
@ -4481,8 +4482,9 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
mIsSkiaGL &&
!srcSurf &&
aImage.IsHTMLVideoElement() &&
gfxPlatform::GetPlatform()->GetSkiaGLGlue()) {
gfxPlatform::GetPlatform()->UseAcceleratedCanvas()) {
mozilla::gl::GLContext* gl = gfxPlatform::GetPlatform()->GetSkiaGLGlue()->GetGLContext();
MOZ_ASSERT(gl);
HTMLVideoElement* video = &aImage.GetAsHTMLVideoElement();
if (!video) {
@ -5653,7 +5655,7 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasLayer::Data data;
GLuint skiaGLTex = SkiaGLTex();
if (skiaGLTex) {
if (mIsSkiaGL && skiaGLTex) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);
@ -5707,7 +5709,7 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
GLuint skiaGLTex = SkiaGLTex();
if (skiaGLTex) {
if (mIsSkiaGL && skiaGLTex) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);

View File

@ -1239,7 +1239,10 @@ SkiaGLGlue*
gfxPlatform::GetSkiaGLGlue()
{
#ifdef USE_SKIA_GPU
if (!UseAcceleratedCanvas()) {
// Check the accelerated Canvas is enabled for the first time,
// because the callers should check it before using.
if (!mSkiaGlue &&
!UseAcceleratedCanvas()) {
gfxCriticalNote << "Accelerated Skia canvas is disabled";
return nullptr;
}