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

Side by Side Diff: samplecode/SampleApp.cpp

Issue 112903002: Fix SampleApp BBH shortcut collision. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: postEventToSink -> post_event_to_sink Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 #include "SampleApp.h" 7 #include "SampleApp.h"
8 8
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #define FPS_REPEAT_MULTIPLIER 1 92 #define FPS_REPEAT_MULTIPLIER 1
93 #else 93 #else
94 #define FPS_REPEAT_MULTIPLIER 10 94 #define FPS_REPEAT_MULTIPLIER 10
95 #endif 95 #endif
96 #define FPS_REPEAT_COUNT (10 * FPS_REPEAT_MULTIPLIER) 96 #define FPS_REPEAT_COUNT (10 * FPS_REPEAT_MULTIPLIER)
97 97
98 static SampleWindow* gSampleWindow; 98 static SampleWindow* gSampleWindow;
99 99
100 static bool gShowGMBounds; 100 static bool gShowGMBounds;
101 101
102 static void postEventToSink(SkEvent* evt, SkEventSink* sink) { 102 static void post_event_to_sink(SkEvent* evt, SkEventSink* sink) {
103 evt->setTargetID(sink->getSinkID())->post(); 103 evt->setTargetID(sink->getSinkID())->post();
104 } 104 }
105 105
106 /////////////////////////////////////////////////////////////////////////////// 106 ///////////////////////////////////////////////////////////////////////////////
107 107
108 static const char* skip_until(const char* str, const char* skip) { 108 static const char* skip_until(const char* str, const char* skip) {
109 if (!str) { 109 if (!str) {
110 return NULL; 110 return NULL;
111 } 111 }
112 return strstr(str, skip); 112 return strstr(str, skip);
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 // If another constructor set our dimensions, ensure that our 1017 // If another constructor set our dimensions, ensure that our
1018 // onSizeChange gets called. 1018 // onSizeChange gets called.
1019 if (this->height() && this->width()) { 1019 if (this->height() && this->width()) {
1020 this->onSizeChange(); 1020 this->onSizeChange();
1021 } 1021 }
1022 1022
1023 // can't call this synchronously, since it may require a subclass to 1023 // can't call this synchronously, since it may require a subclass to
1024 // to implement, or the caller may need us to have returned from the 1024 // to implement, or the caller may need us to have returned from the
1025 // constructor first. Hence we post an event to ourselves. 1025 // constructor first. Hence we post an event to ourselves.
1026 // this->updateTitle(); 1026 // this->updateTitle();
1027 postEventToSink(new SkEvent(gUpdateWindowTitleEvtName), this); 1027 post_event_to_sink(new SkEvent(gUpdateWindowTitleEvtName), this);
1028 } 1028 }
1029 1029
1030 SampleWindow::~SampleWindow() { 1030 SampleWindow::~SampleWindow() {
1031 delete fPicture; 1031 delete fPicture;
1032 delete fPdfCanvas; 1032 delete fPdfCanvas;
1033 fTypeface->unref(); 1033 fTypeface->unref();
1034 1034
1035 SkSafeUnref(fDevManager); 1035 SkSafeUnref(fDevManager);
1036 } 1036 }
1037 1037
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1824 switch (str[i]) { 1824 switch (str[i]) {
1825 case ':': str[i] = '-'; break; 1825 case ':': str[i] = '-'; break;
1826 case '/': str[i] = '-'; break; 1826 case '/': str[i] = '-'; break;
1827 case ' ': str[i] = '_'; break; 1827 case ' ': str[i] = '_'; break;
1828 default: break; 1828 default: break;
1829 } 1829 }
1830 } 1830 }
1831 } 1831 }
1832 #endif 1832 #endif
1833 1833
1834 //extern bool gIgnoreFastBlurRect;
1835
1836 bool SampleWindow::onHandleChar(SkUnichar uni) { 1834 bool SampleWindow::onHandleChar(SkUnichar uni) {
1837 { 1835 {
1838 SkView* view = curr_view(this); 1836 SkView* view = curr_view(this);
1839 if (view) { 1837 if (view) {
1840 SkEvent evt(gCharEvtName); 1838 SkEvent evt(gCharEvtName);
1841 evt.setFast32(uni); 1839 evt.setFast32(uni);
1842 if (view->doQuery(&evt)) { 1840 if (view->doQuery(&evt)) {
1843 return true; 1841 return true;
1844 } 1842 }
1845 } 1843 }
(...skipping 22 matching lines...) Expand all
1868 fScrollTestX = fScrollTestY = 0; 1866 fScrollTestX = fScrollTestY = 0;
1869 } else { 1867 } else {
1870 fScrollTestX += dx; 1868 fScrollTestX += dx;
1871 fScrollTestY += dy; 1869 fScrollTestY += dy;
1872 } 1870 }
1873 this->inval(NULL); 1871 this->inval(NULL);
1874 return true; 1872 return true;
1875 } 1873 }
1876 1874
1877 switch (uni) { 1875 switch (uni) {
1878 case 'b': 1876 case 'B':
1879 { 1877 post_event_to_sink(SkNEW_ARGS(SkEvent, ("PictFileView::toggleBBox")) , curr_view(this));
1880 postEventToSink(SkNEW_ARGS(SkEvent, ("PictFileView::toggleBBox")), c urr_view(this)); 1878 // Cannot call updateTitle() synchronously, because the toggleBBox e vent is still in
1881 this->updateTitle(); 1879 // the queue.
1880 post_event_to_sink(SkNEW_ARGS(SkEvent, (gUpdateWindowTitleEvtName)), this);
1882 this->inval(NULL); 1881 this->inval(NULL);
1883 break; 1882 break;
1884 }
1885 case 'B':
1886 // gIgnoreFastBlurRect = !gIgnoreFastBlurRect;
1887 this->inval(NULL);
1888 break;
1889
1890 case 'f': 1883 case 'f':
1891 // only 1884 // only
1892 toggleFPS(); 1885 toggleFPS();
1893 break; 1886 break;
1894 case 'g': 1887 case 'g':
1895 fRequestGrabImage = true; 1888 fRequestGrabImage = true;
1896 this->inval(NULL); 1889 this->inval(NULL);
1897 break; 1890 break;
1898 case 'G': 1891 case 'G':
1899 gShowGMBounds = !gShowGMBounds; 1892 gShowGMBounds = !gShowGMBounds;
1900 postEventToSink(GMSampleView::NewShowSizeEvt(gShowGMBounds), 1893 post_event_to_sink(GMSampleView::NewShowSizeEvt(gShowGMBounds),
1901 curr_view(this)); 1894 curr_view(this));
1902 this->inval(NULL); 1895 this->inval(NULL);
1903 break; 1896 break;
1904 case 'i': 1897 case 'i':
1905 this->zoomIn(); 1898 this->zoomIn();
1906 break; 1899 break;
1907 case 'o': 1900 case 'o':
1908 this->zoomOut(); 1901 this->zoomOut();
1909 break; 1902 break;
1910 case 'r': 1903 case 'r':
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 SkGraphics::Init(); 2616 SkGraphics::Init();
2624 SkEvent::Init(); 2617 SkEvent::Init();
2625 } 2618 }
2626 2619
2627 // FIXME: this should be in a header 2620 // FIXME: this should be in a header
2628 void application_term(); 2621 void application_term();
2629 void application_term() { 2622 void application_term() {
2630 SkEvent::Term(); 2623 SkEvent::Term();
2631 SkGraphics::Term(); 2624 SkGraphics::Term();
2632 } 2625 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698