From ad2f26e7738ad3971715c1faa3de28d100205fde Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Sat, 6 Aug 2016 01:34:59 -0700 Subject: [PATCH] Bug 1292747 (Part 2) - Remove the 565 optimization from imgFrame. r=edwin --- image/imgFrame.cpp | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/image/imgFrame.cpp b/image/imgFrame.cpp index 8badab13ddb1..aaccea5f4906 100644 --- a/image/imgFrame.cpp +++ b/image/imgFrame.cpp @@ -433,57 +433,11 @@ imgFrame::Optimize() return NS_OK; } -#ifdef ANDROID - SurfaceFormat optFormat = gfxPlatform::GetPlatform() - ->Optimal2DFormatForContent(gfxContentType::COLOR); - - if (mFormat != SurfaceFormat::B8G8R8A8 && - optFormat == SurfaceFormat::R5G6B5_UINT16) { - RefPtr buf = - AllocateBufferForImage(mFrameRect.Size(), optFormat); - if (!buf) { - return NS_OK; - } - - RefPtr surf = - CreateLockedSurface(buf, mFrameRect.Size(), optFormat); - if (!surf) { - return NS_ERROR_OUT_OF_MEMORY; - } - - DataSourceSurface::MappedSurface mapping; - if (!surf->Map(DataSourceSurface::MapType::WRITE, &mapping)) { - gfxCriticalError() << "imgFrame::Optimize failed to map surface"; - return NS_ERROR_FAILURE; - } - - RefPtr target = - Factory::CreateDrawTargetForData(BackendType::CAIRO, - mapping.mData, - mFrameRect.Size(), - mapping.mStride, - optFormat); - - if (!target) { - gfxWarning() << "imgFrame::Optimize failed in CreateDrawTargetForData"; - return NS_ERROR_OUT_OF_MEMORY; - } - Rect rect(0, 0, mFrameRect.width, mFrameRect.height); - target->DrawSurface(mImageSurface, rect, rect); - target->Flush(); - surf->Unmap(); - - mImageSurface = surf; - mVBuf = buf; - mFormat = optFormat; - } -#else mOptSurface = gfxPlatform::GetPlatform() ->ScreenReferenceDrawTarget()->OptimizeSourceSurface(mImageSurface); if (mOptSurface == mImageSurface) { mOptSurface = nullptr; } -#endif if (mOptSurface) { mVBuf = nullptr;