Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2c5ee18

Browse files
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>
1 parent 81e84a6 commit 2c5ee18

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

gm/overdrawcanvas.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
#define WIDTH 500
2525
#define HEIGHT 500
2626

27-
// These are treated as RGBA_premul
28-
static const uint32_t kOverdrawColors[6] = {
29-
0x00000000, 0x5f00005f, 0x2f2f0000, 0x2f002f00, 0x3f00003f, 0x7f00007f,
27+
static const SkColor kOverdrawColors[6] = {
28+
0x00000000, 0x5fff0000, 0x2f0000ff, 0x2f00ff00, 0x3fff0000, 0x7fff0000,
3029
};
3130

3231

@@ -52,7 +51,7 @@ DEF_SIMPLE_GM_BG(overdraw_canvas, canvas, WIDTH, HEIGHT, SK_ColorWHITE) {
5251

5352
// Draw overdraw colors to the canvas. The color filter will convert counts to colors.
5453
SkPaint paint;
55-
paint.setColorFilter(SkOverdrawColorFilter::Make(kOverdrawColors));
54+
paint.setColorFilter(SkOverdrawColorFilter::MakeWithSkColors(kOverdrawColors));
5655
canvas->drawImage(counts.get(), 0.0f, 0.0f, &paint);
5756
canvas->drawString("This is some text:", 180, 300, SkFont(), SkPaint());
5857
}

include/effects/SkOverdrawColorFilter.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ class SK_API SkOverdrawColorFilter : public SkColorFilter {
2323
public:
2424
static constexpr int kNumColors = 6;
2525

26-
// DEPRECATED
27-
// For historical reasons, this version of Make() assumes the array is RGBA-premul
28-
static sk_sp<SkColorFilter> Make(const uint32_t colors[kNumColors]);
29-
3026
static sk_sp<SkColorFilter> MakeWithSkColors(const SkColor colors[kNumColors]) {
3127
return sk_sp<SkColorFilter>(new SkOverdrawColorFilter(colors));
3228
}

src/effects/SkOverdrawColorFilter.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,6 @@ void main(inout half4 color) {
4343
)";
4444
#endif
4545

46-
#ifdef SK_PMCOLOR_IS_BGRA
47-
static uint32_t swizzle_rb(uint32_t c) {
48-
// c is not SkColor per-se, but these macros will correctly swap r/b channels
49-
return SkColorSetARGB(SkColorGetA(c), SkColorGetB(c), SkColorGetG(c), SkColorGetR(c));
50-
}
51-
#endif
52-
53-
// Legacy factory, will go away
54-
sk_sp<SkColorFilter> SkOverdrawColorFilter::Make(const uint32_t rgba[kNumColors]) {
55-
SkColor colors[kNumColors];
56-
for (int i = 0; i < kNumColors; ++i) {
57-
#ifdef SK_PMCOLOR_IS_BGRA
58-
colors[i] = SkUnPreMultiply::PMColorToColor(swizzle_rb(rgba[i]));
59-
#else
60-
colors[i] = SkUnPreMultiply::PMColorToColor(rgba[i]);
61-
#endif
62-
}
63-
return MakeWithSkColors(colors);
64-
}
65-
6646
static void convert_to_pm4f(SkPMColor4f dst[], const SkColor src[]) {
6747
for (int i = 0; i < SkOverdrawColorFilter::kNumColors; ++i) {
6848
dst[i] = SkColor4f::FromColor(src[i]).premul();

0 commit comments

Comments
 (0)