Simplify the poly union.
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1752433002 Review URL: https://codereview.chromium.org/1752433002
This commit is contained in:
parent
755539f0b1
commit
683ea9a08d
@ -273,21 +273,6 @@ private:
|
||||
Strategy fStrategy;
|
||||
};
|
||||
|
||||
class SkippedStage final : public SkLinearBitmapPipeline::BilerpProcessorInterface {
|
||||
void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override {
|
||||
SkFAIL("Skipped stage.");
|
||||
}
|
||||
void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override {
|
||||
SkFAIL("Skipped stage.");
|
||||
}
|
||||
void VECTORCALL bilerpList(Sk4s xs, Sk4s ys) override {
|
||||
SkFAIL("Skipped stage.");
|
||||
}
|
||||
void pointSpan(Span span) override {
|
||||
SkFAIL("Skipped stage.");
|
||||
}
|
||||
};
|
||||
|
||||
class TranslateMatrixStrategy {
|
||||
public:
|
||||
TranslateMatrixStrategy(SkVector offset)
|
||||
@ -390,7 +375,6 @@ static SkLinearBitmapPipeline::PointProcessorInterface* choose_matrix(
|
||||
next,
|
||||
SkVector{inverse.getTranslateX(), inverse.getTranslateY()});
|
||||
} else {
|
||||
matrixProc->Initialize<SkippedStage>();
|
||||
return next;
|
||||
}
|
||||
return matrixProc->get();
|
||||
@ -447,7 +431,6 @@ static SkLinearBitmapPipeline::PointProcessorInterface* choose_filter(
|
||||
SkFilterQuality filterQuailty,
|
||||
SkLinearBitmapPipeline::FilterStage* filterProc) {
|
||||
if (SkFilterQuality::kNone_SkFilterQuality == filterQuailty) {
|
||||
filterProc->Initialize<SkippedStage>();
|
||||
return next;
|
||||
} else {
|
||||
filterProc->Initialize<ExpandBilerp<>>(next);
|
||||
@ -689,7 +672,6 @@ static SkLinearBitmapPipeline::BilerpProcessorInterface* choose_tiler(
|
||||
SkFAIL("Not implemented.");
|
||||
break;
|
||||
}
|
||||
tileProcY->Initialize<SkippedStage>();
|
||||
} else {
|
||||
switch (yMode) {
|
||||
case SkShader::kClamp_TileMode:
|
||||
|
@ -29,9 +29,13 @@ public:
|
||||
template<typename Base, size_t kSize>
|
||||
class PolymorphicUnion {
|
||||
public:
|
||||
PolymorphicUnion() {}
|
||||
PolymorphicUnion() : fIsInitialized{false} {}
|
||||
|
||||
~PolymorphicUnion() { get()->~Base(); }
|
||||
~PolymorphicUnion() {
|
||||
if (fIsInitialized) {
|
||||
get()->~Base();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Variant, typename... Args>
|
||||
void Initialize(Args&&... args) {
|
||||
@ -39,6 +43,7 @@ public:
|
||||
"Size Variant: %d, Space: %d", sizeof(Variant), sizeof(fSpace));
|
||||
|
||||
new(&fSpace) Variant(std::forward<Args>(args)...);
|
||||
fIsInitialized = true;
|
||||
};
|
||||
|
||||
Base* get() const { return reinterpret_cast<Base*>(&fSpace); }
|
||||
@ -49,6 +54,7 @@ public:
|
||||
struct SK_STRUCT_ALIGN(16) Space {
|
||||
char space[kSize];
|
||||
};
|
||||
bool fIsInitialized;
|
||||
mutable Space fSpace;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user