зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1546505 - Remove ImageBitmapUtils and ImageBitmapColorUtils as it is dead code. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D28986
This commit is contained in:
Родитель
6fa7b44385
Коммит
b99b7a1925
|
@ -20,8 +20,6 @@
|
|||
#include "mozilla/ScopeExit.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "ImageBitmapColorUtils.h"
|
||||
#include "ImageBitmapUtils.h"
|
||||
#include "ImageUtils.h"
|
||||
#include "imgLoader.h"
|
||||
#include "imgTools.h"
|
||||
|
@ -481,68 +479,6 @@ void ImageBitmap::SetPictureRect(const IntRect& aRect, ErrorResult& aRv) {
|
|||
mPictureRect = FixUpNegativeDimension(aRect, aRv);
|
||||
}
|
||||
|
||||
static already_AddRefed<SourceSurface> ConvertColorFormatIfNeeded(
|
||||
RefPtr<SourceSurface> aSurface) {
|
||||
const SurfaceFormat srcFormat = aSurface->GetFormat();
|
||||
if (srcFormat == SurfaceFormat::R8G8B8A8 ||
|
||||
srcFormat == SurfaceFormat::B8G8R8A8 ||
|
||||
srcFormat == SurfaceFormat::R8G8B8X8 ||
|
||||
srcFormat == SurfaceFormat::B8G8R8X8 ||
|
||||
srcFormat == SurfaceFormat::A8R8G8B8 ||
|
||||
srcFormat == SurfaceFormat::X8R8G8B8) {
|
||||
return aSurface.forget();
|
||||
}
|
||||
|
||||
if (srcFormat == SurfaceFormat::A8 || srcFormat == SurfaceFormat::Depth) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const int bytesPerPixel = BytesPerPixel(SurfaceFormat::B8G8R8A8);
|
||||
const IntSize dstSize = aSurface->GetSize();
|
||||
const uint32_t dstStride = dstSize.width * bytesPerPixel;
|
||||
|
||||
RefPtr<DataSourceSurface> dstDataSurface =
|
||||
Factory::CreateDataSourceSurfaceWithStride(
|
||||
dstSize, SurfaceFormat::B8G8R8A8, dstStride);
|
||||
if (NS_WARN_IF(!dstDataSurface)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DataSourceSurface> srcDataSurface = aSurface->GetDataSurface();
|
||||
if (NS_WARN_IF(!srcDataSurface)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DataSourceSurface::ScopedMap srcMap(srcDataSurface, DataSourceSurface::READ);
|
||||
DataSourceSurface::ScopedMap dstMap(dstDataSurface, DataSourceSurface::WRITE);
|
||||
if (NS_WARN_IF(!srcMap.IsMapped()) || NS_WARN_IF(!dstMap.IsMapped())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int rv = 0;
|
||||
if (srcFormat == SurfaceFormat::R8G8B8) {
|
||||
rv = RGB24ToBGRA32(srcMap.GetData(), srcMap.GetStride(), dstMap.GetData(),
|
||||
dstMap.GetStride(), dstSize.width, dstSize.height);
|
||||
} else if (srcFormat == SurfaceFormat::B8G8R8) {
|
||||
rv = BGR24ToBGRA32(srcMap.GetData(), srcMap.GetStride(), dstMap.GetData(),
|
||||
dstMap.GetStride(), dstSize.width, dstSize.height);
|
||||
} else if (srcFormat == SurfaceFormat::HSV) {
|
||||
rv = HSVToBGRA32((const float*)srcMap.GetData(), srcMap.GetStride(),
|
||||
dstMap.GetData(), dstMap.GetStride(), dstSize.width,
|
||||
dstSize.height);
|
||||
} else if (srcFormat == SurfaceFormat::Lab) {
|
||||
rv = LabToBGRA32((const float*)srcMap.GetData(), srcMap.GetStride(),
|
||||
dstMap.GetData(), dstMap.GetStride(), dstSize.width,
|
||||
dstSize.height);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(rv != 0)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return dstDataSurface.forget();
|
||||
}
|
||||
|
||||
/*
|
||||
* The functionality of PrepareForDrawTarget method:
|
||||
* (1) Get a SourceSurface from the mData (which is a layers::Image).
|
||||
|
@ -569,14 +505,6 @@ already_AddRefed<SourceSurface> ImageBitmap::PrepareForDrawTarget(
|
|||
}
|
||||
}
|
||||
|
||||
// Check if we need to convert the format.
|
||||
// Convert R8G8B8/B8G8R8/HSV/Lab to B8G8R8A8.
|
||||
// Return null if the original format is A8 or Depth.
|
||||
mSurface = ConvertColorFormatIfNeeded(mSurface);
|
||||
if (NS_WARN_IF(!mSurface)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> target = aTarget;
|
||||
IntRect surfRect(0, 0, mSurface->GetSize().width, mSurface->GetSize().height);
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,337 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_ImageBitmapColorUtils_h
|
||||
#define mozilla_dom_ImageBitmapColorUtils_h
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/*
|
||||
* RGB family -> RGBA family.
|
||||
*/
|
||||
int RGB24ToRGBA32(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToRGBA32(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
int RGB24ToBGRA32(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToBGRA32(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
/*
|
||||
* RGBA family -> RGB family.
|
||||
*/
|
||||
int RGBA32ToRGB24(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGRA32ToRGB24(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
int RGBA32ToBGR24(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGRA32ToBGR24(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
/*
|
||||
* Among RGB family.
|
||||
*/
|
||||
int RGB24ToBGR24(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
#define BGR24ToRGB24 RGB24ToBGR24
|
||||
|
||||
/*
|
||||
* YUV family -> RGB family.
|
||||
*/
|
||||
int YUV444PToRGB24(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV422PToRGB24(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV420PToRGB24(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int NV12ToRGB24(const uint8_t* aYBuffer, int aYStride, const uint8_t* aUVBuffer,
|
||||
int aUVStride, uint8_t* aDstBuffer, int aDstStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int NV21ToRGB24(const uint8_t* aYBuffer, int aYStride, const uint8_t* aVUBuffer,
|
||||
int aVUStride, uint8_t* aDstBuffer, int aDstStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int YUV444PToBGR24(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV422PToBGR24(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV420PToBGR24(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int NV12ToBGR24(const uint8_t* aYBuffer, int aYStride, const uint8_t* aUVBuffer,
|
||||
int aUVStride, uint8_t* aDstBuffer, int aDstStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int NV21ToBGR24(const uint8_t* aYBuffer, int aYStride, const uint8_t* aVUBuffer,
|
||||
int aVUStride, uint8_t* aDstBuffer, int aDstStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
/*
|
||||
* YUV family -> RGBA family.
|
||||
*/
|
||||
int YUV444PToRGBA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV422PToRGBA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV420PToRGBA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int NV12ToRGBA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUVBuffer, int aUVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int NV21ToRGBA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aVUBuffer, int aVUStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV444PToBGRA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV422PToBGRA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV420PToBGRA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int NV12ToBGRA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUVBuffer, int aUVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int NV21ToBGRA32(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aVUBuffer, int aVUStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
/*
|
||||
* RGB family -> YUV family.
|
||||
*/
|
||||
int RGB24ToYUV444P(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUBuffer, int aUStride,
|
||||
uint8_t* aVBuffer, int aVStride, int aWidth, int aHeight);
|
||||
|
||||
int RGB24ToYUV422P(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUBuffer, int aUStride,
|
||||
uint8_t* aVBuffer, int aVStride, int aWidth, int aHeight);
|
||||
|
||||
int RGB24ToYUV420P(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUBuffer, int aUStride,
|
||||
uint8_t* aVBuffer, int aVStride, int aWidth, int aHeight);
|
||||
int RGB24ToNV12(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUVBuffer, int aUVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int RGB24ToNV21(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aVUBuffer, int aVUStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int BGR24ToYUV444P(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUBuffer, int aUStride,
|
||||
uint8_t* aVBuffer, int aVStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToYUV422P(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUBuffer, int aUStride,
|
||||
uint8_t* aVBuffer, int aVStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToYUV420P(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUBuffer, int aUStride,
|
||||
uint8_t* aVBuffer, int aVStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToNV12(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUVBuffer, int aUVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int BGR24ToNV21(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUVBuffer, int aUVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
/*
|
||||
* RGBA family -> YUV family.
|
||||
*/
|
||||
int RGBA32ToYUV444P(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aYBuffer, int aYStride, uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aVBuffer, int aVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int RGBA32ToYUV422P(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aYBuffer, int aYStride, uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aVBuffer, int aVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int RGBA32ToYUV420P(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aYBuffer, int aYStride, uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aVBuffer, int aVStride, int aWidth,
|
||||
int aHeight);
|
||||
int RGBA32ToNV12(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUVBuffer, int aUVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int RGBA32ToNV21(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aVUBuffer, int aVUStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int BGRA32ToYUV444P(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aYBuffer, int aYStride, uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aVBuffer, int aVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int BGRA32ToYUV422P(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aYBuffer, int aYStride, uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aVBuffer, int aVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int BGRA32ToYUV420P(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aYBuffer, int aYStride, uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aVBuffer, int aVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int BGRA32ToNV12(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUVBuffer, int aUVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int BGRA32ToNV21(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aYBuffer,
|
||||
int aYStride, uint8_t* aUVBuffer, int aUVStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
/*
|
||||
* RGBA/RGB family <-> HSV family.
|
||||
*/
|
||||
int RGBA32ToHSV(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGRA32ToHSV(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int RGB24ToHSV(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToHSV(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int HSVToRGBA32(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int HSVToBGRA32(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int HSVToRGB24(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int HSVToBGR24(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
/*
|
||||
* RGBA/RGB family <-> Lab family.
|
||||
*/
|
||||
int RGBA32ToLab(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGRA32ToLab(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int RGB24ToLab(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToLab(const uint8_t* aSrcBuffer, int aSrcStride, float* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int LabToRGBA32(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int LabToBGRA32(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int LabToRGB24(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int LabToBGR24(const float* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
/*
|
||||
* RGBA/RGB family -> Gray8.
|
||||
*/
|
||||
int RGB24ToGray8(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGR24ToGray8(const uint8_t* aSrcBuffer, int aSrcStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int RGBA32ToGray8(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int BGRA32ToGray8(const uint8_t* aSrcBuffer, int aSrcStride,
|
||||
uint8_t* aDstBuffer, int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
/*
|
||||
* YUV family -> Gray8.
|
||||
*/
|
||||
int YUV444PToGray8(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV422PToGray8(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int YUV420PToGray8(const uint8_t* aYBuffer, int aYStride,
|
||||
const uint8_t* aUBuffer, int aUStride,
|
||||
const uint8_t* aVBuffer, int aVStride, uint8_t* aDstBuffer,
|
||||
int aDstStride, int aWidth, int aHeight);
|
||||
|
||||
int NV12ToGray8(const uint8_t* aYBuffer, int aYStride, const uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aDstBuffer, int aDstStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
int NV21ToGray8(const uint8_t* aYBuffer, int aYStride, const uint8_t* aUBuffer,
|
||||
int aUStride, uint8_t* aDstBuffer, int aDstStride, int aWidth,
|
||||
int aHeight);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
#endif // mozilla_dom_ImageBitmapColorUtils_h
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,89 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_ImageBitmapUtils_h
|
||||
#define mozilla_dom_ImageBitmapUtils_h
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace layers {
|
||||
class Image;
|
||||
struct PlanarYCbCrData;
|
||||
} // namespace layers
|
||||
|
||||
namespace dom {
|
||||
|
||||
struct ChannelPixelLayout;
|
||||
template <typename>
|
||||
class Sequence;
|
||||
|
||||
typedef nsTArray<ChannelPixelLayout> ImagePixelLayout;
|
||||
|
||||
/*
|
||||
* This function creates an ImagePixelLayout object which describes the
|
||||
* default layout of the given ImageBitmapFormat with the given width, height
|
||||
* and stride.
|
||||
*/
|
||||
UniquePtr<ImagePixelLayout> CreateDefaultPixelLayout(ImageBitmapFormat aFormat,
|
||||
uint32_t aWidth,
|
||||
uint32_t aHeight,
|
||||
uint32_t aStride);
|
||||
|
||||
/*
|
||||
* This function extracts information from the aImage parameter to customize
|
||||
* the ImagePixelLayout object, that is, this function creates a customized
|
||||
* ImagePixelLayout object which exactly describes the pixel layout of the
|
||||
* given aImage.
|
||||
*/
|
||||
UniquePtr<ImagePixelLayout> CreatePixelLayoutFromPlanarYCbCrData(
|
||||
const layers::PlanarYCbCrData* aData);
|
||||
|
||||
/*
|
||||
* Get the number of channels of the given ImageBitmapFormat.
|
||||
*/
|
||||
uint8_t GetChannelCountOfImageFormat(ImageBitmapFormat aFormat);
|
||||
|
||||
/*
|
||||
* This function always copies the image data in _aSrcBuffer_ into _aDstBuffer_
|
||||
* and it also performs color conversion if the _aSrcFormat_ and the
|
||||
* _aDstFormat_ are different.
|
||||
*
|
||||
* The source image is stored in the _aSrcBuffer_ and the corresponding pixel
|
||||
* layout is described by the _aSrcLayout_.
|
||||
*
|
||||
* The copied and converted image will be stored in the _aDstBuffer_, which
|
||||
* should be allocated with enough size before invoking this function and the
|
||||
* needed size could be found by the CalculateImageBufferSize() method.
|
||||
*
|
||||
* The returned ImagePixelLayout object describes the pixel layout of the result
|
||||
* image and will be null if on failure.
|
||||
*/
|
||||
UniquePtr<ImagePixelLayout> CopyAndConvertImageData(
|
||||
ImageBitmapFormat aSrcFormat, const uint8_t* aSrcBuffer,
|
||||
const ImagePixelLayout* aSrcLayout, ImageBitmapFormat aDstFormat,
|
||||
uint8_t* aDstBuffer);
|
||||
|
||||
/*
|
||||
* This function tries to find the best ImageBitmapFormat, from the aCandiates,
|
||||
* which can be converted from the aSrcFormat. The algorithm now merely returns
|
||||
* the FIRST one, from the aCandidates, which can be converted from the
|
||||
* aSrcFormat.
|
||||
*
|
||||
* TODO: The algorithm should be updated after we implement optimizations for
|
||||
* different platforms (different kinds of layers::Image), considering
|
||||
* that some conversion might be cheaper through hardware.
|
||||
*/
|
||||
ImageBitmapFormat FindBestMatchingFromat(
|
||||
ImageBitmapFormat aSrcFormat,
|
||||
const Sequence<ImageBitmapFormat>& aCandidates);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_ImageBitmapUtils_h
|
|
@ -5,7 +5,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ImageUtils.h"
|
||||
#include "ImageBitmapUtils.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/dom/ImageBitmapBinding.h"
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,19 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
with Files('**'):
|
||||
BUG_COMPONENT = ('Core', 'Canvas: 2D')
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'TestImageBitmapColorUtils.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/canvas',
|
||||
'/media/libyuv/libyuv/include'
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul-gtest'
|
|
@ -28,10 +28,6 @@ with Files('test/chrome/*webgl*'):
|
|||
with Files('test/crossorigin/*webgl*'):
|
||||
BUG_COMPONENT = ('Core', 'Canvas: WebGL')
|
||||
|
||||
TEST_DIRS += [
|
||||
'gtest'
|
||||
]
|
||||
|
||||
# Change the following line(s) to avoid bug 1081323 (clobber after changing a manifest):
|
||||
# * Adjust failure errata for webgl-conf.
|
||||
|
||||
|
@ -74,9 +70,7 @@ UNIFIED_SOURCES += [
|
|||
'CanvasRenderingContextHelper.cpp',
|
||||
'CanvasUtils.cpp',
|
||||
'ImageBitmap.cpp',
|
||||
'ImageBitmapColorUtils.cpp',
|
||||
'ImageBitmapRenderingContext.cpp',
|
||||
'ImageBitmapUtils.cpp',
|
||||
'ImageData.cpp',
|
||||
'OffscreenCanvas.cpp',
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче