skia2/tests/SkColor4fTest.cpp
Brian Osman 81cbd03a24 Work toward removing SkPM4f
Added SkColor4f premul/unpremul that just return SkColor4f.
Renamed existing premul to toPM4f. For many uses of SkPM4f,
conversion to pure SkColor4f code was simple. In all other
cases, continue to use SkPM4f for now.

Also convert usage of one-off SkRGBAf class in SkPatchUtils,
and delete that class, along with some truly tautological
unit tests that were the only thing keeping some PM4f API
around.

Bug: skia:
Change-Id: I344c3290ee7af6bbe86c3ff74a2df2f5e87afa38
Reviewed-on: https://skia-review.googlesource.com/156005
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-09-21 15:44:51 +00:00

29 lines
718 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkColor.h"
#include "Test.h"
DEF_TEST(SkColor4f_FromColor, reporter) {
const struct {
SkColor fC;
SkColor4f fC4;
} recs[] = {
{ SK_ColorBLACK, { 0, 0, 0, 1 } },
{ SK_ColorWHITE, { 1, 1, 1, 1 } },
{ SK_ColorRED, { 1, 0, 0, 1 } },
{ SK_ColorGREEN, { 0, 1, 0, 1 } },
{ SK_ColorBLUE, { 0, 0, 1, 1 } },
{ 0, { 0, 0, 0, 0 } },
};
for (const auto& r : recs) {
SkColor4f c4 = SkColor4f::FromColor(r.fC);
REPORTER_ASSERT(reporter, c4 == r.fC4);
}
}