fune/widget/android/AndroidColors.h
Andrew Osmond 91b071ed14 Bug 1618345 - Enforce proper color management by splitting gfx::Color into sRGBColor and DeviceColor types. r=jrmuizel
gfx::Color is currently misused in many places. The DrawTargets expect
the color space to be in device space, e.g. what we are actually going
to draw using. Everything sitting above generally deals with sRGB, as
specified in CSS. Sometimes we missed the conversion from sRGB to device
space when issuing draw calls, and similarly sometimes we converted the
color to device space twice.

This patch splits the type in two. sRGBColor and DeviceColor now
represent sRGB and device color spaces respectively. DrawTarget only
accepts DeviceColor, and one can get a DeviceColor from an sRGBColor via
the ToDeviceColor helper API. The reftests now pass with color
management enabled for everything (e.g. CSS) instead of just tagged
raster images.

There will be a follow up patch to enable color management everywhere by
default on all supported platforms.

Differential Revision: https://phabricator.services.mozilla.com/D64771

--HG--
extra : moz-landing-system : lando
2020-03-09 14:16:17 +00:00

28 lines
1.2 KiB
C++

/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/* 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_widget_AndroidColors_h
#define mozilla_widget_AndroidColors_h
#include "mozilla/gfx/2D.h"
namespace mozilla {
namespace widget {
static const gfx::sRGBColor sAndroidBackgroundColor(gfx::sRGBColor(1.0f, 1.0f,
1.0f));
static const gfx::sRGBColor sAndroidBorderColor(gfx::sRGBColor(0.73f, 0.73f,
0.73f));
static const gfx::sRGBColor sAndroidCheckColor(gfx::sRGBColor(0.19f, 0.21f,
0.23f));
static const gfx::sRGBColor sAndroidDisabledColor(gfx::sRGBColor(0.88f, 0.88f,
0.88f));
static const gfx::sRGBColor sAndroidActiveColor(gfx::sRGBColor(0.94f, 0.94f,
0.94f));
} // namespace widget
} // namespace mozilla
#endif // mozilla_widget_AndroidColors_h