Skip to content

Commit

Permalink
Bug 1209812 (part 3) - Rename SurfaceFormat::R5G6B5 as R5G6B5_UINT16.…
Browse files Browse the repository at this point in the history
… r=Bas.
  • Loading branch information
nnethercote committed Oct 23, 2015
1 parent 5f8fa78 commit 5b8386c
Show file tree
Hide file tree
Showing 29 changed files with 49 additions and 48 deletions.
2 changes: 1 addition & 1 deletion dom/canvas/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4497,7 +4497,7 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& image,
if (ok) {
NativeSurface texSurf;
texSurf.mType = NativeSurfaceType::OPENGL_TEXTURE;
texSurf.mFormat = SurfaceFormat::R5G6B5;
texSurf.mFormat = SurfaceFormat::R5G6B5_UINT16;
texSurf.mSize.width = mCurrentVideoSize.width;
texSurf.mSize.height = mCurrentVideoSize.height;
texSurf.mSurface = (void*)((uintptr_t)mVideoTexture);
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/WebGLContextGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ WebGLContext::SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromE
case SurfaceFormat::A8:
*format = WebGLTexelFormat::A8;
break;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
*format = WebGLTexelFormat::RGB565;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion dom/media/encoder/VP8TrackEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ nsresult VP8TrackEncoder::PrepareRawFrame(VideoChunk &aChunk)
cr, halfWidth,
mFrameWidth, mFrameHeight);
break;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
rv = libyuv::RGB565ToI420(static_cast<uint8*>(map.GetData()),
map.GetStride(),
y, mFrameWidth,
Expand Down
2 changes: 1 addition & 1 deletion gfx/2d/DrawTargetCairo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ GfxFormatForCairoSurface(cairo_surface_t* surface)
// xlib is currently the only Cairo backend that creates 16bpp surfaces
if (type == CAIRO_SURFACE_TYPE_XLIB &&
cairo_xlib_surface_get_depth(surface) == 16) {
return SurfaceFormat::R5G6B5;
return SurfaceFormat::R5G6B5_UINT16;
}
#endif
return CairoContentToGfxFormat(cairo_surface_get_content(surface));
Expand Down
6 changes: 3 additions & 3 deletions gfx/2d/HelpersCairo.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ GfxFormatToCairoFormat(SurfaceFormat format)
return CAIRO_FORMAT_RGB24;
case SurfaceFormat::A8:
return CAIRO_FORMAT_A8;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
return CAIRO_FORMAT_RGB16_565;
default:
gfxCriticalError() << "Unknown image format " << (int)format;
Expand All @@ -169,7 +169,7 @@ GfxFormatToCairoContent(SurfaceFormat format)
case SurfaceFormat::B8G8R8A8:
return CAIRO_CONTENT_COLOR_ALPHA;
case SurfaceFormat::B8G8R8X8:
case SurfaceFormat::R5G6B5: //fall through
case SurfaceFormat::R5G6B5_UINT16: //fall through
return CAIRO_CONTENT_COLOR;
case SurfaceFormat::A8:
return CAIRO_CONTENT_ALPHA;
Expand Down Expand Up @@ -241,7 +241,7 @@ CairoFormatToGfxFormat(cairo_format_t format)
case CAIRO_FORMAT_A8:
return SurfaceFormat::A8;
case CAIRO_FORMAT_RGB16_565:
return SurfaceFormat::R5G6B5;
return SurfaceFormat::R5G6B5_UINT16;
default:
gfxCriticalError() << "Unknown cairo format " << format;
return SurfaceFormat::UNKNOWN;
Expand Down
6 changes: 3 additions & 3 deletions gfx/2d/HelpersSkia.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ GfxFormatToSkiaColorType(SurfaceFormat format)
case SurfaceFormat::B8G8R8X8:
// We probably need to do something here.
return kBGRA_8888_SkColorType;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
return kRGB_565_SkColorType;
case SurfaceFormat::A8:
return kAlpha_8_SkColorType;
Expand All @@ -47,7 +47,7 @@ SkiaColorTypeToGfxFormat(SkColorType type)
case kBGRA_8888_SkColorType:
return SurfaceFormat::B8G8R8A8;
case kRGB_565_SkColorType:
return SurfaceFormat::R5G6B5;
return SurfaceFormat::R5G6B5_UINT16;
case kAlpha_8_SkColorType:
return SurfaceFormat::A8;
default:
Expand All @@ -66,7 +66,7 @@ GfxFormatToGrConfig(SurfaceFormat format)
case SurfaceFormat::B8G8R8X8:
// We probably need to do something here.
return kBGRA_8888_GrPixelConfig;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
return kRGB_565_GrPixelConfig;
case SurfaceFormat::A8:
return kAlpha_8_GrPixelConfig;
Expand Down
4 changes: 2 additions & 2 deletions gfx/2d/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ class Log
case SurfaceFormat::R8G8B8X8:
mMessage << "SurfaceFormat::R8G8B8X8";
break;
case SurfaceFormat::R5G6B5:
mMessage << "SurfaceFormat::R5G6B5";
case SurfaceFormat::R5G6B5_UINT16:
mMessage << "SurfaceFormat::R5G6B5_UINT16";
break;
case SurfaceFormat::A8:
mMessage << "SurfaceFormat::A8";
Expand Down
2 changes: 1 addition & 1 deletion gfx/2d/Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ BytesPerPixel(SurfaceFormat aFormat)
switch (aFormat) {
case SurfaceFormat::A8:
return 1;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
return 2;
default:
return 4;
Expand Down
4 changes: 2 additions & 2 deletions gfx/2d/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum class SurfaceFormat : int8_t {
B8G8R8X8,
R8G8B8A8,
R8G8B8X8,
R5G6B5,
R5G6B5_UINT16,
A8,
YUV,
NV12,
Expand All @@ -46,7 +46,7 @@ inline bool IsOpaque(SurfaceFormat aFormat)
switch (aFormat) {
case SurfaceFormat::B8G8R8X8:
case SurfaceFormat::R8G8B8X8:
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
case SurfaceFormat::YUV:
case SurfaceFormat::NV12:
return true;
Expand Down
8 changes: 4 additions & 4 deletions gfx/gl/GLReadTexImageHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ CopyDataSourceSurface(DataSourceSurface* aSource,
aDest->GetFormat() == SurfaceFormat::R8G8B8X8 ||
aDest->GetFormat() == SurfaceFormat::B8G8R8A8 ||
aDest->GetFormat() == SurfaceFormat::B8G8R8X8 ||
aDest->GetFormat() == SurfaceFormat::R5G6B5);
aDest->GetFormat() == SurfaceFormat::R5G6B5_UINT16);

const bool isSrcBGR = aSource->GetFormat() == SurfaceFormat::B8G8R8A8 ||
aSource->GetFormat() == SurfaceFormat::B8G8R8X8;
Expand All @@ -288,7 +288,7 @@ CopyDataSourceSurface(DataSourceSurface* aSource,
aDest->GetFormat() == SurfaceFormat::B8G8R8A8;
const bool needsAlphaMask = !srcHasAlpha && destHasAlpha;

const bool needsConvertTo16Bits = aDest->GetFormat() == SurfaceFormat::R5G6B5;
const bool needsConvertTo16Bits = aDest->GetFormat() == SurfaceFormat::R5G6B5_UINT16;

DataSourceSurface::MappedSurface srcMap;
DataSourceSurface::MappedSurface destMap;
Expand Down Expand Up @@ -394,7 +394,7 @@ ReadPixelsIntoDataSurface(GLContext* gl, DataSourceSurface* dest)
destFormat = LOCAL_GL_RGBA;
destType = LOCAL_GL_UNSIGNED_BYTE;
break;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
destFormat = LOCAL_GL_RGB;
destType = LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV;
break;
Expand Down Expand Up @@ -438,7 +438,7 @@ ReadPixelsIntoDataSurface(GLContext* gl, DataSourceSurface* dest)
case LOCAL_GL_RGB: {
MOZ_ASSERT(destPixelSize == 2);
MOZ_ASSERT(readType == LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV);
readFormatGFX = SurfaceFormat::R5G6B5;
readFormatGFX = SurfaceFormat::R5G6B5_UINT16;
break;
}
default: {
Expand Down
4 changes: 2 additions & 2 deletions gfx/gl/GLUploadHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ UploadImageDataToTexture(GLContext* gl,
}
internalFormat = LOCAL_GL_RGBA;
break;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
internalFormat = format = LOCAL_GL_RGB;
type = LOCAL_GL_UNSIGNED_SHORT_5_6_5;
surfaceFormat = SurfaceFormat::R5G6B5;
surfaceFormat = SurfaceFormat::R5G6B5_UINT16;
break;
case SurfaceFormat::A8:
internalFormat = format = LOCAL_GL_LUMINANCE;
Expand Down
6 changes: 3 additions & 3 deletions gfx/gl/TextureImageEGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GLFormatForImage(gfx::SurfaceFormat aFormat)
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8:
return LOCAL_GL_RGBA;
case gfx::SurfaceFormat::R5G6B5:
case gfx::SurfaceFormat::R5G6B5_UINT16:
return LOCAL_GL_RGB;
case gfx::SurfaceFormat::A8:
return LOCAL_GL_LUMINANCE;
Expand All @@ -38,7 +38,7 @@ GLTypeForImage(gfx::SurfaceFormat aFormat)
case gfx::SurfaceFormat::B8G8R8X8:
case gfx::SurfaceFormat::A8:
return LOCAL_GL_UNSIGNED_BYTE;
case gfx::SurfaceFormat::R5G6B5:
case gfx::SurfaceFormat::R5G6B5_UINT16:
return LOCAL_GL_UNSIGNED_SHORT_5_6_5;
default:
NS_WARNING("Unknown GL format for Surface format");
Expand Down Expand Up @@ -69,7 +69,7 @@ TextureImageEGL::TextureImageEGL(GLuint aTexture,
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType());
}

if (mUpdateFormat == gfx::SurfaceFormat::R5G6B5) {
if (mUpdateFormat == gfx::SurfaceFormat::R5G6B5_UINT16) {
mTextureFormat = gfx::SurfaceFormat::R8G8B8X8;
} else if (mUpdateFormat == gfx::SurfaceFormat::B8G8R8X8) {
mTextureFormat = gfx::SurfaceFormat::B8G8R8X8;
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/Effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ CreateTexturedEffect(gfx::SurfaceFormat aFormat,
case gfx::SurfaceFormat::B8G8R8A8:
case gfx::SurfaceFormat::B8G8R8X8:
case gfx::SurfaceFormat::R8G8B8X8:
case gfx::SurfaceFormat::R5G6B5:
case gfx::SurfaceFormat::R5G6B5_UINT16:
case gfx::SurfaceFormat::R8G8B8A8:
result = new EffectRGB(aSource, isAlphaPremultiplied, aFilter);
break;
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/GrallocImages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ ConvertOmxYUVFormatToRGB565(android::sp<GraphicBuffer>& aBuffer,
return BAD_VALUE;
}

uint32_t pixelStride = aMappedSurface->mStride/gfx::BytesPerPixel(gfx::SurfaceFormat::R5G6B5);
uint32_t pixelStride = aMappedSurface->mStride/gfx::BytesPerPixel(gfx::SurfaceFormat::R5G6B5_UINT16);
rv = colorConverter.convert(buffer, width, height,
0, 0, width - 1, height - 1 /* source crop */,
aMappedSurface->mData, pixelStride, height,
Expand Down
3 changes: 2 additions & 1 deletion gfx/layers/LayersLogging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ AppendToString(std::stringstream& aStream, mozilla::gfx::SurfaceFormat format,
case SurfaceFormat::B8G8R8X8: aStream << "SurfaceFormat::B8G8R8X8"; break;
case SurfaceFormat::R8G8B8A8: aStream << "SurfaceFormat::R8G8B8A8"; break;
case SurfaceFormat::R8G8B8X8: aStream << "SurfaceFormat::R8G8B8X8"; break;
case SurfaceFormat::R5G6B5: aStream << "SurfaceFormat::R5G6B5"; break;
case SurfaceFormat::R5G6B5_UINT16:
aStream << "SurfaceFormat::R5G6B5_UINT16"; break;
case SurfaceFormat::A8: aStream << "SurfaceFormat::A8"; break;
case SurfaceFormat::YUV: aStream << "SurfaceFormat::YUV"; break;
case SurfaceFormat::NV12: aStream << "SurfaceFormat::NV12"; break;
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/opengl/CompositorOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ CompositorOGL::GetShaderConfigFor(Effect *aEffect,
MOZ_ASSERT_IF(source->GetTextureTarget() == LOCAL_GL_TEXTURE_RECTANGLE_ARB,
source->GetFormat() == gfx::SurfaceFormat::R8G8B8A8 ||
source->GetFormat() == gfx::SurfaceFormat::R8G8B8X8 ||
source->GetFormat() == gfx::SurfaceFormat::R5G6B5);
source->GetFormat() == gfx::SurfaceFormat::R5G6B5_UINT16);
config = ShaderConfigFromTargetAndFormat(source->GetTextureTarget(),
source->GetFormat());
break;
Expand Down
6 changes: 3 additions & 3 deletions gfx/layers/opengl/GrallocTextureClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ SurfaceFormatForPixelFormat(android::PixelFormat aFormat)
case PIXEL_FORMAT_RGBX_8888:
return gfx::SurfaceFormat::R8G8B8X8;
case PIXEL_FORMAT_RGB_565:
return gfx::SurfaceFormat::R5G6B5;
return gfx::SurfaceFormat::R5G6B5_UINT16;
case HAL_PIXEL_FORMAT_YV12:
return gfx::SurfaceFormat::YUV;
default:
Expand Down Expand Up @@ -284,7 +284,7 @@ GrallocTextureClientOGL::AllocateForSurface(gfx::IntSize aSize,
format = android::PIXEL_FORMAT_RGBX_8888;
mFlags |= TextureFlags::RB_SWAPPED;
break;
case gfx::SurfaceFormat::R5G6B5:
case gfx::SurfaceFormat::R5G6B5_UINT16:
format = android::PIXEL_FORMAT_RGB_565;
break;
case gfx::SurfaceFormat::YUV:
Expand Down Expand Up @@ -329,7 +329,7 @@ GrallocTextureClientOGL::AllocateForGLRendering(gfx::IntSize aSize)
// there is no android BGRX format?
format = android::PIXEL_FORMAT_RGBX_8888;
break;
case gfx::SurfaceFormat::R5G6B5:
case gfx::SurfaceFormat::R5G6B5_UINT16:
format = android::PIXEL_FORMAT_RGB_565;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/opengl/GrallocTextureHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat,
case android::PIXEL_FORMAT_RGBX_8888:
return swapRB ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::R8G8B8X8;
case android::PIXEL_FORMAT_RGB_565:
return gfx::SurfaceFormat::R5G6B5;
return gfx::SurfaceFormat::R5G6B5_UINT16;
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
case HAL_PIXEL_FORMAT_YCbCr_422_I:
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/opengl/OGLShaderProgram.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ ShaderConfigFromTargetAndFormat(GLenum aTarget,
aFormat == gfx::SurfaceFormat::B8G8R8X8);
config.SetNoAlpha(aFormat == gfx::SurfaceFormat::B8G8R8X8 ||
aFormat == gfx::SurfaceFormat::R8G8B8X8 ||
aFormat == gfx::SurfaceFormat::R5G6B5);
aFormat == gfx::SurfaceFormat::R5G6B5_UINT16);
return config;
}

Expand Down
6 changes: 3 additions & 3 deletions gfx/thebes/gfx2DGlue.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ inline gfxImageFormat SurfaceFormatToImageFormat(SurfaceFormat aFormat)
return gfxImageFormat::ARGB32;
case SurfaceFormat::B8G8R8X8:
return gfxImageFormat::RGB24;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
return gfxImageFormat::RGB16_565;
case SurfaceFormat::A8:
return gfxImageFormat::A8;
Expand All @@ -105,7 +105,7 @@ inline SurfaceFormat ImageFormatToSurfaceFormat(gfxImageFormat aFormat)
case gfxImageFormat::RGB24:
return SurfaceFormat::B8G8R8X8;
case gfxImageFormat::RGB16_565:
return SurfaceFormat::R5G6B5;
return SurfaceFormat::R5G6B5_UINT16;
case gfxImageFormat::A8:
return SurfaceFormat::A8;
default:
Expand All @@ -117,7 +117,7 @@ inline SurfaceFormat ImageFormatToSurfaceFormat(gfxImageFormat aFormat)
inline gfxContentType ContentForFormat(const SurfaceFormat &aFormat)
{
switch (aFormat) {
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
case SurfaceFormat::B8G8R8X8:
case SurfaceFormat::R8G8B8X8:
return gfxContentType::COLOR;
Expand Down
2 changes: 1 addition & 1 deletion gfx/thebes/gfxPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ gfxPlatform::Optimal2DFormatForContent(gfxContentType aContent)
case gfxImageFormat::RGB24:
return mozilla::gfx::SurfaceFormat::B8G8R8X8;
case gfxImageFormat::RGB16_565:
return mozilla::gfx::SurfaceFormat::R5G6B5;
return mozilla::gfx::SurfaceFormat::R5G6B5_UINT16;
default:
NS_NOTREACHED("unknown gfxImageFormat for gfxContentType::COLOR");
return mozilla::gfx::SurfaceFormat::B8G8R8A8;
Expand Down
2 changes: 1 addition & 1 deletion gfx/thebes/gfxUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void mozilla_dump_image(void* bytes, int width, int height, int bytepp,
// TODO more flexible; parse string?
switch (bytepp) {
case 2:
format = SurfaceFormat::R5G6B5;
format = SurfaceFormat::R5G6B5_UINT16;
break;
case 4:
default:
Expand Down
6 changes: 3 additions & 3 deletions gfx/ycbcr/YCbCrUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ GetYCbCrToRGBDestFormatAndSize(const layers::PlanarYCbCrData& aData,
bool prescale = aSuggestedSize.width > 0 && aSuggestedSize.height > 0 &&
aSuggestedSize != aData.mPicSize;

if (aSuggestedFormat == SurfaceFormat::R5G6B5) {
if (aSuggestedFormat == SurfaceFormat::R5G6B5_UINT16) {
#if defined(HAVE_YCBCR_TO_RGB565)
if (prescale &&
!IsScaleYCbCrToRGB565Fast(aData.mPicX,
Expand Down Expand Up @@ -88,7 +88,7 @@ ConvertYCbCrToRGB(const layers::PlanarYCbCrData& aData,
// Convert from YCbCr to RGB now, scaling the image if needed.
if (aDestSize != aData.mPicSize) {
#if defined(HAVE_YCBCR_TO_RGB565)
if (aDestFormat == SurfaceFormat::R5G6B5) {
if (aDestFormat == SurfaceFormat::R5G6B5_UINT16) {
ScaleYCbCrToRGB565(aData.mYChannel,
aData.mCbChannel,
aData.mCrChannel,
Expand Down Expand Up @@ -122,7 +122,7 @@ ConvertYCbCrToRGB(const layers::PlanarYCbCrData& aData,
FILTER_BILINEAR);
} else { // no prescale
#if defined(HAVE_YCBCR_TO_RGB565)
if (aDestFormat == SurfaceFormat::R5G6B5) {
if (aDestFormat == SurfaceFormat::R5G6B5_UINT16) {
ConvertYCbCrToRGB565(aData.mYChannel,
aData.mCbChannel,
aData.mCrChannel,
Expand Down
2 changes: 1 addition & 1 deletion image/imgFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ imgFrame::Optimize()
->Optimal2DFormatForContent(gfxContentType::COLOR);

if (mFormat != SurfaceFormat::B8G8R8A8 &&
optFormat == SurfaceFormat::R5G6B5) {
optFormat == SurfaceFormat::R5G6B5_UINT16) {
RefPtr<VolatileBuffer> buf =
AllocateBufferForImage(mSize, optFormat);
if (!buf) {
Expand Down
2 changes: 1 addition & 1 deletion media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,7 @@ void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk(
yuv + cr_offset, half_width,
size.width, size.height);
break;
case SurfaceFormat::R5G6B5:
case SurfaceFormat::R5G6B5_UINT16:
rv = libyuv::RGB565ToI420(static_cast<uint8*>(map.GetData()),
map.GetStride(),
yuv, size.width,
Expand Down
4 changes: 2 additions & 2 deletions widget/android/AndroidBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ AndroidBridge::CaptureZoomedView(nsIDOMWindow *window, nsIntRect zoomedViewRect,
presContext->DevPixelsToAppUnits(zoomedViewRect.height / scaleFactor ));

bool is24bit = (GetScreenDepth() == 24);
SurfaceFormat format = is24bit ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::R5G6B5;
SurfaceFormat format = is24bit ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::R5G6B5_UINT16;
gfxImageFormat iFormat = gfx::SurfaceFormatToImageFormat(format);
uint32_t stride = gfxASurface::FormatStrideForWidth(iFormat, zoomedViewRect.width);

Expand Down Expand Up @@ -1980,7 +1980,7 @@ nsresult AndroidBridge::CaptureThumbnail(nsIDOMWindow *window, int32_t bufW, int
IntSize(bufW, bufH),
stride,
is24bit ? SurfaceFormat::B8G8R8X8 :
SurfaceFormat::R5G6B5);
SurfaceFormat::R5G6B5_UINT16);
if (!dt) {
ALOG_BRIDGE("Error creating DrawTarget");
return NS_ERROR_FAILURE;
Expand Down
Loading

0 comments on commit 5b8386c

Please sign in to comment.