Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: samplecode/SampleApp.cpp

Issue 1576183002: SkTCopyOnFirstWrite-based SkPaintFilterCanvas API (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: minor cleanup Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/utils/SkPaintFilterCanvas.h ('k') | src/utils/SkPaintFilterCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/utils/SkPaintFilterCanvas.h ('k') | src/utils/SkPaintFilterCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698