OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SampleApp.h" | 8 #include "SampleApp.h" |
9 | 9 |
10 #include "OverView.h" | 10 #include "OverView.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 : INHERITED(canvas) | 468 : INHERITED(canvas) |
469 , fLCDState(lcd) | 469 , fLCDState(lcd) |
470 , fAAState(aa) | 470 , fAAState(aa) |
471 , fSubpixelState(subpixel) | 471 , fSubpixelState(subpixel) |
472 , fHintingState(hinting) | 472 , fHintingState(hinting) |
473 , fFilterQualityIndex(filterQuality) { | 473 , fFilterQualityIndex(filterQuality) { |
474 SkASSERT((unsigned)filterQuality < SK_ARRAY_COUNT(gFilterQualityStates))
; | 474 SkASSERT((unsigned)filterQuality < SK_ARRAY_COUNT(gFilterQualityStates))
; |
475 } | 475 } |
476 | 476 |
477 protected: | 477 protected: |
478 bool onFilter(const SkPaint* paint, Type t, SkTLazy<SkPaint>* filteredPaint)
const override { | 478 bool onFilter(SkTCopyOnFirstWrite<SkPaint>* paint, Type t) const override { |
479 if (!paint) { | 479 if (!*paint) { |
480 return true; | 480 return true; |
481 } | 481 } |
482 | 482 |
483 filteredPaint->set(*paint); | |
484 if (kText_Type == t && SkOSMenu::kMixedState != fLCDState) { | 483 if (kText_Type == t && SkOSMenu::kMixedState != fLCDState) { |
485 filteredPaint->get()->setLCDRenderText(SkOSMenu::kOnState == fLCDSta
te); | 484 paint->writable()->setLCDRenderText(SkOSMenu::kOnState == fLCDState)
; |
486 } | 485 } |
487 if (SkOSMenu::kMixedState != fAAState) { | 486 if (SkOSMenu::kMixedState != fAAState) { |
488 filteredPaint->get()->setAntiAlias(SkOSMenu::kOnState == fAAState); | 487 paint->writable()->setAntiAlias(SkOSMenu::kOnState == fAAState); |
489 } | 488 } |
490 if (0 != fFilterQualityIndex) { | 489 if (0 != fFilterQualityIndex) { |
491 filteredPaint->get()->setFilterQuality( | 490 paint->writable()->setFilterQuality(gFilterQualityStates[fFilterQual
ityIndex].fQuality); |
492 gFilterQualityStates[fFilterQualityIndex].fQuality); | |
493 } | 491 } |
494 if (SkOSMenu::kMixedState != fSubpixelState) { | 492 if (SkOSMenu::kMixedState != fSubpixelState) { |
495 filteredPaint->get()->setSubpixelText(SkOSMenu::kOnState == fSubpixe
lState); | 493 paint->writable()->setSubpixelText(SkOSMenu::kOnState == fSubpixelSt
ate); |
496 } | 494 } |
497 if (0 != fHintingState && fHintingState < (int)SK_ARRAY_COUNT(gHintingSt
ates)) { | 495 if (0 != fHintingState && fHintingState < (int)SK_ARRAY_COUNT(gHintingSt
ates)) { |
498 filteredPaint->get()->setHinting(gHintingStates[fHintingState].hinti
ng); | 496 paint->writable()->setHinting(gHintingStates[fHintingState].hinting)
; |
499 } | 497 } |
500 return true; | 498 return true; |
501 } | 499 } |
502 | 500 |
503 private: | 501 private: |
504 SkOSMenu::TriState fLCDState; | 502 SkOSMenu::TriState fLCDState; |
505 SkOSMenu::TriState fAAState; | 503 SkOSMenu::TriState fAAState; |
506 SkOSMenu::TriState fSubpixelState; | 504 SkOSMenu::TriState fSubpixelState; |
507 int fHintingState; | 505 int fHintingState; |
508 int fFilterQualityIndex; | 506 int fFilterQualityIndex; |
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 #ifdef SK_BUILD_FOR_MAC | 2265 #ifdef SK_BUILD_FOR_MAC |
2268 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2266 setenv("ANDROID_ROOT", "/android/device/data", 0); |
2269 #endif | 2267 #endif |
2270 SkGraphics::Init(); | 2268 SkGraphics::Init(); |
2271 SkEvent::Init(); | 2269 SkEvent::Init(); |
2272 } | 2270 } |
2273 | 2271 |
2274 void application_term() { | 2272 void application_term() { |
2275 SkEvent::Term(); | 2273 SkEvent::Term(); |
2276 } | 2274 } |
OLD | NEW |