mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1020497 - collapse exposureCompensation to single attribute, r=bz
This commit is contained in:
parent
d4b57b936a
commit
5b795002d5
@ -505,17 +505,10 @@ nsDOMCameraControl::GetFocusDistanceFar(ErrorResult& aRv)
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMCameraControl::SetExposureCompensation(const Optional<double>& aCompensation, ErrorResult& aRv)
|
||||
nsDOMCameraControl::SetExposureCompensation(double aCompensation, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(mCameraControl);
|
||||
|
||||
if (!aCompensation.WasPassed()) {
|
||||
// use NaN to switch the camera back into auto mode
|
||||
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, NAN);
|
||||
return;
|
||||
}
|
||||
|
||||
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation.Value());
|
||||
aRv = mCameraControl->Set(CAMERA_PARAM_EXPOSURECOMPENSATION, aCompensation);
|
||||
}
|
||||
|
||||
double
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
double GetFocusDistanceNear(ErrorResult& aRv);
|
||||
double GetFocusDistanceOptimum(ErrorResult& aRv);
|
||||
double GetFocusDistanceFar(ErrorResult& aRv);
|
||||
void SetExposureCompensation(const dom::Optional<double>& aCompensation, ErrorResult& aRv);
|
||||
void SetExposureCompensation(double aCompensation, ErrorResult& aRv);
|
||||
double GetExposureCompensation(ErrorResult& aRv);
|
||||
int32_t SensorAngle();
|
||||
already_AddRefed<dom::CameraCapabilities> Capabilities();
|
||||
|
@ -228,43 +228,43 @@ var tests = [
|
||||
"exposureCompensation = " + cam.exposureCompensation);
|
||||
|
||||
// Check normal values
|
||||
cam.setExposureCompensation(0.0);
|
||||
cam.exposureCompensation = 0.0;
|
||||
ok(cam.exposureCompensation == 0.0,
|
||||
"exposureCompensation = " + cam.exposureCompensation);
|
||||
cam.setExposureCompensation(cap.minExposureCompensation);
|
||||
cam.exposureCompensation = cap.minExposureCompensation;
|
||||
ok(cam.exposureCompensation == cap.minExposureCompensation,
|
||||
"exposureCompensation(min) = " + cam.exposureCompensation);
|
||||
cam.setExposureCompensation(cap.maxExposureCompensation);
|
||||
cam.exposureCompensation = cap.maxExposureCompensation;
|
||||
ok(cam.exposureCompensation == cap.maxExposureCompensation,
|
||||
"exposureCompensation(max) = " + cam.exposureCompensation);
|
||||
|
||||
// Rounding
|
||||
cam.setExposureCompensation(1.24);
|
||||
cam.exposureCompensation = 1.24;
|
||||
ok(cam.exposureCompensation == 1.0,
|
||||
"exposureCompensation(1.24) = " + cam.exposureCompensation);
|
||||
cam.setExposureCompensation(1.25);
|
||||
cam.exposureCompensation = 1.25;
|
||||
ok(cam.exposureCompensation == 1.5,
|
||||
"exposureCompensation(1.25) = " + cam.exposureCompensation);
|
||||
cam.setExposureCompensation(-1.24);
|
||||
cam.exposureCompensation = -1.24;
|
||||
ok(cam.exposureCompensation == -1.0,
|
||||
"exposureCompensation(-1.24) = " + cam.exposureCompensation);
|
||||
cam.setExposureCompensation(-1.25);
|
||||
cam.exposureCompensation = -1.25;
|
||||
ok(cam.exposureCompensation == -1.5,
|
||||
"exposureCompensation(-1.25) = " + cam.exposureCompensation);
|
||||
|
||||
// Check out-of-bounds values
|
||||
cam.setExposureCompensation(cap.minExposureCompensation - 1.0);
|
||||
cam.exposureCompensation = cap.minExposureCompensation - 1.0;
|
||||
ok(cam.exposureCompensation == cap.minExposureCompensation,
|
||||
"exposureCompensation(min - 1.0) = " + cam.exposureCompensation);
|
||||
cam.setExposureCompensation(cap.maxExposureCompensation + 1.0);
|
||||
cam.exposureCompensation = cap.maxExposureCompensation + 1.0;
|
||||
ok(cam.exposureCompensation == cap.maxExposureCompensation,
|
||||
"exposureCompensation(max + 1.0) = " + cam.exposureCompensation);
|
||||
|
||||
// Check extreme values
|
||||
cam.setExposureCompensation(-1 * Math.pow(2, 32));
|
||||
cam.exposureCompensation = -1 * Math.pow(2, 32);
|
||||
ok(cam.exposureCompensation == cap.minExposureCompensation,
|
||||
"exposureCompensation(-2^32) = " + cam.exposureCompensation);
|
||||
cam.setExposureCompensation(Math.pow(2, 32));
|
||||
cam.exposureCompensation = Math.pow(2, 32);
|
||||
ok(cam.exposureCompensation == cap.maxExposureCompensation,
|
||||
"exposureCompensation(2^32) = " + cam.exposureCompensation);
|
||||
|
||||
|
@ -218,16 +218,13 @@ interface CameraControl : MediaStream
|
||||
[Throws]
|
||||
readonly attribute unrestricted double focusDistanceFar;
|
||||
|
||||
/* 'compensation' is optional, and if missing, will
|
||||
set the camera to use automatic exposure compensation.
|
||||
|
||||
acceptable values must range from minExposureCompensation
|
||||
to maxExposureCompensation in steps of stepExposureCompensation;
|
||||
invalid values will be rounded to the nearest valid value. */
|
||||
/* over- or under-expose the image; acceptable values must range from
|
||||
minExposureCompensation to maxExposureCompensation in steps of
|
||||
stepExposureCompensation. Invalid values will be rounded to the nearest
|
||||
valid value; out-of-bounds values will be limited to the range
|
||||
supported by the camera. */
|
||||
[Throws]
|
||||
void setExposureCompensation(optional double compensation);
|
||||
[Throws]
|
||||
readonly attribute unrestricted double exposureCompensation;
|
||||
attribute double exposureCompensation;
|
||||
|
||||
/* one of the values chosen from capabilities.isoModes; default
|
||||
value is "auto" if supported. */
|
||||
|
Loading…
Reference in New Issue
Block a user