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

Side by Side Diff: samplecode/SampleText.cpp

Issue 197763008: Allow toString capability to be toggled independent of developer mode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: remove gyp changes Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « include/effects/SkTransparentShader.h ('k') | src/core/SkBitmap.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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if (max < v) 42 if (max < v)
43 max = v; 43 max = v;
44 if (min > v) 44 if (min > v)
45 min = v; 45 min = v;
46 } 46 }
47 if (c > max) c = max; 47 if (c > max) c = max;
48 // if (c < min) c = min; 48 // if (c < min) c = min;
49 return c; 49 return c;
50 } 50 }
51 51
52 #ifdef SK_DEVELOPER 52 #ifndef SK_IGNORE_TO_STRING
53 virtual void toString(SkString* str) const SK_OVERRIDE { 53 virtual void toString(SkString* str) const SK_OVERRIDE {
54 str->append("ReduceNoise: ("); 54 str->append("ReduceNoise: (");
55 this->INHERITED::toString(str); 55 this->INHERITED::toString(str);
56 str->append(")"); 56 str->append(")");
57 } 57 }
58 #endif 58 #endif
59 59
60 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(ReduceNoise) 60 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(ReduceNoise)
61 61
62 private: 62 private:
(...skipping 11 matching lines...) Expand all
74 74
75 if (c >= 0) { 75 if (c >= 0) {
76 f = sqrtf(f); 76 f = sqrtf(f);
77 } else { 77 } else {
78 f *= f; 78 f *= f;
79 } 79 }
80 SkASSERT(f >= 0 && f <= 1); 80 SkASSERT(f >= 0 && f <= 1);
81 return (int)(f * 255); 81 return (int)(f * 255);
82 } 82 }
83 83
84 #ifdef SK_DEVELOPER 84 #ifndef SK_IGNORE_TO_STRING
85 virtual void toString(SkString* str) const SK_OVERRIDE { 85 virtual void toString(SkString* str) const SK_OVERRIDE {
86 str->append("Darken: ("); 86 str->append("Darken: (");
87 this->INHERITED::toString(str); 87 this->INHERITED::toString(str);
88 str->append(")"); 88 str->append(")");
89 } 89 }
90 #endif 90 #endif
91 91
92 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Darken) 92 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Darken)
93 93
94 private: 94 private:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 class SkPowerMode : public SkXfermode { 140 class SkPowerMode : public SkXfermode {
141 public: 141 public:
142 SkPowerMode(SkScalar exponent) { this->init(exponent); } 142 SkPowerMode(SkScalar exponent) { this->init(exponent); }
143 143
144 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, 144 virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
145 const SkAlpha aa[]) const SK_OVERRIDE; 145 const SkAlpha aa[]) const SK_OVERRIDE;
146 146
147 typedef SkFlattenable* (*Factory)(SkReadBuffer&); 147 typedef SkFlattenable* (*Factory)(SkReadBuffer&);
148 148
149 SK_DEVELOPER_TO_STRING() 149 SK_TO_STRING_OVERRIDE()
150 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPowerMode) 150 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPowerMode)
151 151
152 private: 152 private:
153 SkScalar fExp; // user's value 153 SkScalar fExp; // user's value
154 uint8_t fTable[256]; // cache 154 uint8_t fTable[256]; // cache
155 155
156 void init(SkScalar exponent); 156 void init(SkScalar exponent);
157 SkPowerMode(SkReadBuffer& b) : INHERITED(b) { 157 SkPowerMode(SkReadBuffer& b) : INHERITED(b) {
158 // read the exponent 158 // read the exponent
159 this->init(SkFixedToScalar(b.readFixed())); 159 this->init(SkFixedToScalar(b.readFixed()));
(...skipping 29 matching lines...) Expand all
189 int r = SkGetPackedR32(c); 189 int r = SkGetPackedR32(c);
190 int g = SkGetPackedG32(c); 190 int g = SkGetPackedG32(c);
191 int b = SkGetPackedB32(c); 191 int b = SkGetPackedB32(c);
192 r = fTable[r]; 192 r = fTable[r];
193 g = fTable[g]; 193 g = fTable[g];
194 b = fTable[b]; 194 b = fTable[b];
195 dst[i] = SkPack888ToRGB16(r, g, b); 195 dst[i] = SkPack888ToRGB16(r, g, b);
196 } 196 }
197 } 197 }
198 198
199 #ifdef SK_DEVELOPER 199 #ifndef SK_IGNORE_TO_STRING
200 void SkPowerMode::toString(SkString* str) const { 200 void SkPowerMode::toString(SkString* str) const {
201 str->append("SkPowerMode: exponent "); 201 str->append("SkPowerMode: exponent ");
202 str->appendScalar(fExp); 202 str->appendScalar(fExp);
203 } 203 }
204 #endif 204 #endif
205 205
206 static const struct { 206 static const struct {
207 const char* fName; 207 const char* fName;
208 uint32_t fFlags; 208 uint32_t fFlags;
209 bool fFlushCache; 209 bool fFlushCache;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 SkScalar fClickX; 351 SkScalar fClickX;
352 SkMaskFilter* fMF; 352 SkMaskFilter* fMF;
353 353
354 typedef SampleView INHERITED; 354 typedef SampleView INHERITED;
355 }; 355 };
356 356
357 ////////////////////////////////////////////////////////////////////////////// 357 //////////////////////////////////////////////////////////////////////////////
358 358
359 static SkView* MyFactory() { return new TextSpeedView; } 359 static SkView* MyFactory() { return new TextSpeedView; }
360 static SkViewRegister reg(MyFactory); 360 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/effects/SkTransparentShader.h ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698