| Index: samplecode/SampleApp.cpp
|
| diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
|
| index 9f0bd4524ced5cb46c5e4d124be7deec3a177dbc..6f0a7005ebade7b3f159e53ebb6da11aea128d9b 100644
|
| --- a/samplecode/SampleApp.cpp
|
| +++ b/samplecode/SampleApp.cpp
|
| @@ -465,34 +465,35 @@ class FlagsFilterCanvas : public SkPaintFilterCanvas {
|
| public:
|
| FlagsFilterCanvas(SkCanvas* canvas, SkOSMenu::TriState lcd, SkOSMenu::TriState aa,
|
| SkOSMenu::TriState subpixel, int hinting, int filterQuality)
|
| - : INHERITED(canvas->imageInfo().width(), canvas->imageInfo().height())
|
| + : INHERITED(canvas)
|
| , fLCDState(lcd)
|
| , fAAState(aa)
|
| , fSubpixelState(subpixel)
|
| , fHintingState(hinting)
|
| , fFilterQualityIndex(filterQuality) {
|
| SkASSERT((unsigned)filterQuality < SK_ARRAY_COUNT(gFilterQualityStates));
|
| -
|
| - this->addCanvas(canvas);
|
| }
|
|
|
| protected:
|
| - void onFilterPaint(SkPaint* paint, Type t) const override {
|
| - if (kText_Type == t && SkOSMenu::kMixedState != fLCDState) {
|
| - paint->setLCDRenderText(SkOSMenu::kOnState == fLCDState);
|
| - }
|
| - if (SkOSMenu::kMixedState != fAAState) {
|
| - paint->setAntiAlias(SkOSMenu::kOnState == fAAState);
|
| - }
|
| - if (0 != fFilterQualityIndex) {
|
| - paint->setFilterQuality(gFilterQualityStates[fFilterQualityIndex].fQuality);
|
| - }
|
| - if (SkOSMenu::kMixedState != fSubpixelState) {
|
| - paint->setSubpixelText(SkOSMenu::kOnState == fSubpixelState);
|
| - }
|
| - if (0 != fHintingState && fHintingState < (int)SK_ARRAY_COUNT(gHintingStates)) {
|
| - paint->setHinting(gHintingStates[fHintingState].hinting);
|
| + bool onFilter(SkPaint* paint, Type t) const override {
|
| + if (paint) {
|
| + if (kText_Type == t && SkOSMenu::kMixedState != fLCDState) {
|
| + paint->setLCDRenderText(SkOSMenu::kOnState == fLCDState);
|
| + }
|
| + if (SkOSMenu::kMixedState != fAAState) {
|
| + paint->setAntiAlias(SkOSMenu::kOnState == fAAState);
|
| + }
|
| + if (0 != fFilterQualityIndex) {
|
| + paint->setFilterQuality(gFilterQualityStates[fFilterQualityIndex].fQuality);
|
| + }
|
| + if (SkOSMenu::kMixedState != fSubpixelState) {
|
| + paint->setSubpixelText(SkOSMenu::kOnState == fSubpixelState);
|
| + }
|
| + if (0 != fHintingState && fHintingState < (int)SK_ARRAY_COUNT(gHintingStates)) {
|
| + paint->setHinting(gHintingStates[fHintingState].hinting);
|
| + }
|
| }
|
| + return true;
|
| }
|
|
|
| private:
|
|
|