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

MozReview-Commit-ID: 95GY5aGJGK1

--HG--
extra : rebase_source : a6284141f313f62769fdf809f21cb928d7e6df6c
This commit is contained in:
peter chang 2016-03-16 12:09:17 +08:00
Родитель 7cc115e18c
Коммит 2de380f3ba
2 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -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
@ -4474,8 +4475,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) {
@ -5646,7 +5648,7 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasLayer::Data data;
GLuint skiaGLTex = SkiaGLTex();
if (skiaGLTex) {
if (mIsSkiaGL && skiaGLTex) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);
@ -5700,7 +5702,7 @@ CanvasRenderingContext2D::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasRenderingContext2DUserData::PreTransactionCallback, userData);
GLuint skiaGLTex = SkiaGLTex();
if (skiaGLTex) {
if (mIsSkiaGL && skiaGLTex) {
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
MOZ_ASSERT(glue);

Просмотреть файл

@ -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;
}