remove legacy factory for overdrawcolorfilter

Change-Id: I19453c51bf275050d6426b82a1ad717348a3ea56
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271136
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2020-02-15 09:56:07 -05:00
parent 81e84a6e7f
commit 2c5ee18724
3 changed files with 3 additions and 28 deletions

View File

@ -24,9 +24,8 @@
#define WIDTH 500
#define HEIGHT 500
// These are treated as RGBA_premul
static const uint32_t kOverdrawColors[6] = {
0x00000000, 0x5f00005f, 0x2f2f0000, 0x2f002f00, 0x3f00003f, 0x7f00007f,
static const SkColor kOverdrawColors[6] = {
0x00000000, 0x5fff0000, 0x2f0000ff, 0x2f00ff00, 0x3fff0000, 0x7fff0000,
};
@ -52,7 +51,7 @@ DEF_SIMPLE_GM_BG(overdraw_canvas, canvas, WIDTH, HEIGHT, SK_ColorWHITE) {
// Draw overdraw colors to the canvas. The color filter will convert counts to colors.
SkPaint paint;
paint.setColorFilter(SkOverdrawColorFilter::Make(kOverdrawColors));
paint.setColorFilter(SkOverdrawColorFilter::MakeWithSkColors(kOverdrawColors));
canvas->drawImage(counts.get(), 0.0f, 0.0f, &paint);
canvas->drawString("This is some text:", 180, 300, SkFont(), SkPaint());
}

View File

@ -23,10 +23,6 @@ class SK_API SkOverdrawColorFilter : public SkColorFilter {
public:
static constexpr int kNumColors = 6;
// DEPRECATED
// For historical reasons, this version of Make() assumes the array is RGBA-premul
static sk_sp<SkColorFilter> Make(const uint32_t colors[kNumColors]);
static sk_sp<SkColorFilter> MakeWithSkColors(const SkColor colors[kNumColors]) {
return sk_sp<SkColorFilter>(new SkOverdrawColorFilter(colors));
}

View File

@ -43,26 +43,6 @@ void main(inout half4 color) {
)";
#endif
#ifdef SK_PMCOLOR_IS_BGRA
static uint32_t swizzle_rb(uint32_t c) {
// c is not SkColor per-se, but these macros will correctly swap r/b channels
return SkColorSetARGB(SkColorGetA(c), SkColorGetB(c), SkColorGetG(c), SkColorGetR(c));
}
#endif
// Legacy factory, will go away
sk_sp<SkColorFilter> SkOverdrawColorFilter::Make(const uint32_t rgba[kNumColors]) {
SkColor colors[kNumColors];
for (int i = 0; i < kNumColors; ++i) {
#ifdef SK_PMCOLOR_IS_BGRA
colors[i] = SkUnPreMultiply::PMColorToColor(swizzle_rb(rgba[i]));
#else
colors[i] = SkUnPreMultiply::PMColorToColor(rgba[i]);
#endif
}
return MakeWithSkColors(colors);
}
static void convert_to_pm4f(SkPMColor4f dst[], const SkColor src[]) {
for (int i = 0; i < SkOverdrawColorFilter::kNumColors; ++i) {
dst[i] = SkColor4f::FromColor(src[i]).premul();