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

Commit 2e30796

Browse files
Nathaniel NifongSkia Commit-Bot
Nathaniel Nifong
authored and
Skia Commit-Bot
committed
Clean up Enums in Canvaskit
- Removed inverse filltypes - Removed StrokeAndFill Paint Style - Removed TextEncoding (all functions assume UTF-8) Change-Id: Ie2824042b48b3dcefb41ef761bb3070df894da75 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276099 Commit-Queue: Nathaniel Nifong <[email protected]> Reviewed-by: Kevin Lubick <[email protected]>
1 parent fae71fb commit 2e30796

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed

modules/canvaskit/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
### Changed
2424
- Stop compiling jpeg and webp encoders, for a smaller binary.
2525

26+
### Removed
27+
- Removed inverse filltypes
28+
- Removed StrokeAndFill paint style
29+
- Removed TextEncoding enum (it was only used internally). All functions assume UTF-8.
30+
2631
## [0.13.0] - 2020-02-28
2732

2833
### Deprecated

modules/canvaskit/canvaskit_bindings.cpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,20 +1520,18 @@ EMSCRIPTEN_BINDINGS(Skia) {
15201520
.class_function("_MakeFromRSXform", optional_override([](uintptr_t /* char* */ sptr,
15211521
size_t strBtyes,
15221522
uintptr_t /* SkRSXform* */ xptr,
1523-
const SkFont& font,
1524-
SkTextEncoding encoding)->sk_sp<SkTextBlob> {
1523+
const SkFont& font)->sk_sp<SkTextBlob> {
15251524
// See comment above for uintptr_t explanation
15261525
const char* str = reinterpret_cast<const char*>(sptr);
15271526
const SkRSXform* xforms = reinterpret_cast<const SkRSXform*>(xptr);
15281527

1529-
return SkTextBlob::MakeFromRSXform(str, strBtyes, xforms, font, encoding);
1528+
return SkTextBlob::MakeFromRSXform(str, strBtyes, xforms, font, SkTextEncoding::kUTF8);
15301529
}), allow_raw_pointers())
15311530
.class_function("_MakeFromText", optional_override([](uintptr_t /* char* */ sptr,
1532-
size_t len, const SkFont& font,
1533-
SkTextEncoding encoding)->sk_sp<SkTextBlob> {
1531+
size_t len, const SkFont& font)->sk_sp<SkTextBlob> {
15341532
// See comment above for uintptr_t explanation
15351533
const char* str = reinterpret_cast<const char*>(sptr);
1536-
return SkTextBlob::MakeFromText(str, len, font, encoding);
1534+
return SkTextBlob::MakeFromText(str, len, font, SkTextEncoding::kUTF8);
15371535
}), allow_raw_pointers());
15381536

15391537
class_<SkTypeface>("SkTypeface")
@@ -1643,24 +1641,22 @@ EMSCRIPTEN_BINDINGS(Skia) {
16431641

16441642
enum_<SkPathFillType>("FillType")
16451643
.value("Winding", SkPathFillType::kWinding)
1646-
.value("EvenOdd", SkPathFillType::kEvenOdd)
1647-
.value("InverseWinding", SkPathFillType::kInverseWinding)
1648-
.value("InverseEvenOdd", SkPathFillType::kInverseEvenOdd);
1644+
.value("EvenOdd", SkPathFillType::kEvenOdd);
16491645

16501646
enum_<SkFilterQuality>("FilterQuality")
16511647
.value("None", SkFilterQuality::kNone_SkFilterQuality)
16521648
.value("Low", SkFilterQuality::kLow_SkFilterQuality)
16531649
.value("Medium", SkFilterQuality::kMedium_SkFilterQuality)
16541650
.value("High", SkFilterQuality::kHigh_SkFilterQuality);
16551651

1652+
// Only used to control the encode function.
16561653
enum_<SkEncodedImageFormat>("ImageFormat")
16571654
.value("PNG", SkEncodedImageFormat::kPNG)
16581655
.value("JPEG", SkEncodedImageFormat::kJPEG);
16591656

16601657
enum_<SkPaint::Style>("PaintStyle")
16611658
.value("Fill", SkPaint::Style::kFill_Style)
1662-
.value("Stroke", SkPaint::Style::kStroke_Style)
1663-
.value("StrokeAndFill", SkPaint::Style::kStrokeAndFill_Style);
1659+
.value("Stroke", SkPaint::Style::kStroke_Style);
16641660

16651661
#ifdef SK_INCLUDE_PATHOPS
16661662
enum_<SkPathOp>("PathOp")
@@ -1692,12 +1688,6 @@ EMSCRIPTEN_BINDINGS(Skia) {
16921688
.value("Slight", SkFontHinting::kSlight)
16931689
.value("Normal", SkFontHinting::kNormal)
16941690
.value("Full", SkFontHinting::kFull);
1695-
1696-
enum_<SkTextEncoding>("TextEncoding")
1697-
.value("UTF8", SkTextEncoding::kUTF8)
1698-
.value("UTF16", SkTextEncoding::kUTF16)
1699-
.value("UTF32", SkTextEncoding::kUTF32)
1700-
.value("GlyphID", SkTextEncoding::kGlyphID);
17011691
#endif
17021692

17031693
enum_<SkTileMode>("TileMode")

modules/canvaskit/externs.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,6 @@ var CanvasKit = {
625625
FillType: {
626626
Winding: {},
627627
EvenOdd: {},
628-
InverseWinding: {},
629-
InverseEvenOdd: {},
630628
},
631629

632630
FilterQuality: {
@@ -683,7 +681,6 @@ var CanvasKit = {
683681
PaintStyle: {
684682
Fill: {},
685683
Stroke: {},
686-
StrokeAndFill: {},
687684
},
688685

689686
PathOp: {
@@ -739,13 +736,6 @@ var CanvasKit = {
739736
RTL: {},
740737
},
741738

742-
TextEncoding: {
743-
UTF8: {},
744-
UTF16: {},
745-
UTF32: {},
746-
GlyphID: {},
747-
},
748-
749739
TileMode: {
750740
Clamp: {},
751741
Repeat: {},

modules/canvaskit/font.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ CanvasKit._extraInitializations.push(function() {
161161
stringToUTF8(str, strPtr, strLen);
162162
var rptr = rsxBuilder.build();
163163

164-
var blob = CanvasKit.SkTextBlob._MakeFromRSXform(strPtr, strLen - 1,
165-
rptr, font, CanvasKit.TextEncoding.UTF8);
164+
var blob = CanvasKit.SkTextBlob._MakeFromRSXform(strPtr, strLen - 1, rptr, font);
166165
if (!blob) {
167166
SkDebug('Could not make textblob from string "' + str + '"');
168167
return null;
@@ -185,7 +184,7 @@ CanvasKit._extraInitializations.push(function() {
185184
// Add 1 for the null terminator.
186185
stringToUTF8(str, strPtr, strLen);
187186

188-
var blob = CanvasKit.SkTextBlob._MakeFromText(strPtr, strLen - 1, font, CanvasKit.TextEncoding.UTF8);
187+
var blob = CanvasKit.SkTextBlob._MakeFromText(strPtr, strLen - 1, font);
189188
if (!blob) {
190189
SkDebug('Could not make textblob from string "' + str + '"');
191190
return null;

0 commit comments

Comments
 (0)