epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
reed@google.com | bf0001d | 2014-01-13 14:53:55 +0000 | [diff] [blame] | 7 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #include "SampleCode.h" |
| 9 | #include "SkView.h" |
| 10 | #include "SkCanvas.h" |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 11 | #include "SkReadBuffer.h" |
| 12 | #include "SkWriteBuffer.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 13 | #include "SkGradientShader.h" |
| 14 | #include "SkGraphics.h" |
| 15 | #include "SkImageDecoder.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 16 | #include "SkPath.h" |
| 17 | #include "SkRandom.h" |
| 18 | #include "SkRegion.h" |
| 19 | #include "SkShader.h" |
| 20 | #include "SkUtils.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 21 | #include "SkColorPriv.h" |
| 22 | #include "SkColorFilter.h" |
| 23 | #include "SkTime.h" |
| 24 | #include "SkTypeface.h" |
| 25 | #include "SkXfermode.h" |
| 26 | |
| 27 | #include "SkStream.h" |
| 28 | #include "SkXMLParser.h" |
| 29 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 30 | static void test_breakText() { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 31 | SkPaint paint; |
| 32 | const char* text = "sdfkljAKLDFJKEWkldfjlk#$%&sdfs.dsj"; |
| 33 | size_t length = strlen(text); |
| 34 | SkScalar width = paint.measureText(text, length); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 35 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 36 | SkScalar mm = 0; |
| 37 | SkScalar nn = 0; |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 38 | for (SkScalar w = 0; w <= width; w += SK_Scalar1) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 39 | SkScalar m; |
| 40 | size_t n = paint.breakText(text, length, w, &m, |
| 41 | SkPaint::kBackward_TextBufferDirection); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 42 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 43 | SkASSERT(n <= length); |
| 44 | SkASSERT(m <= width); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 45 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 46 | if (n == 0) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 47 | SkASSERT(m == 0); |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 48 | } else { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 49 | // now assert that we're monotonic |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 50 | if (n == nn) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 51 | SkASSERT(m == mm); |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 52 | } else { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 53 | SkASSERT(n > nn); |
| 54 | SkASSERT(m > mm); |
| 55 | } |
| 56 | } |
tomhudson@google.com | ffe39bd | 2012-05-17 15:38:00 +0000 | [diff] [blame] | 57 | nn = SkIntToScalar((unsigned int)n); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 58 | mm = m; |
| 59 | } |
| 60 | |
senorblanco@chromium.org | 64cc579 | 2011-05-19 19:58:58 +0000 | [diff] [blame] | 61 | SkDEBUGCODE(size_t length2 =) paint.breakText(text, length, width, &mm); |
reed@google.com | 261b8e2 | 2011-04-14 17:53:24 +0000 | [diff] [blame] | 62 | SkASSERT(length2 == length); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 63 | SkASSERT(mm == width); |
| 64 | } |
| 65 | |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 66 | static SkRandom gRand; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 67 | |
| 68 | class SkPowerMode : public SkXfermode { |
| 69 | public: |
| 70 | SkPowerMode(SkScalar exponent) { this->init(exponent); } |
| 71 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 72 | virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count, |
mike@reedtribe.org | 3af2b8d | 2012-12-24 18:26:43 +0000 | [diff] [blame] | 73 | const SkAlpha aa[]) const SK_OVERRIDE; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 74 | |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 75 | typedef SkFlattenable* (*Factory)(SkReadBuffer&); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 76 | |
commit-bot@chromium.org | 0f10f7b | 2014-03-13 18:02:17 +0000 | [diff] [blame] | 77 | SK_TO_STRING_OVERRIDE() |
djsollen@google.com | ba28d03 | 2012-03-26 17:57:35 +0000 | [diff] [blame] | 78 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPowerMode) |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 79 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 80 | private: |
| 81 | SkScalar fExp; // user's value |
| 82 | uint8_t fTable[256]; // cache |
| 83 | |
| 84 | void init(SkScalar exponent); |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 85 | SkPowerMode(SkReadBuffer& b) : INHERITED(b) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 86 | // read the exponent |
djsollen@google.com | c73dd5c | 2012-08-07 15:54:32 +0000 | [diff] [blame] | 87 | this->init(SkFixedToScalar(b.readFixed())); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 88 | } |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 89 | virtual void flatten(SkWriteBuffer& b) const SK_OVERRIDE { |
djsollen@google.com | 5492424 | 2012-03-29 15:18:04 +0000 | [diff] [blame] | 90 | this->INHERITED::flatten(b); |
djsollen@google.com | c73dd5c | 2012-08-07 15:54:32 +0000 | [diff] [blame] | 91 | b.writeFixed(SkScalarToFixed(fExp)); |
djsollen@google.com | 5492424 | 2012-03-29 15:18:04 +0000 | [diff] [blame] | 92 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 93 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 94 | typedef SkXfermode INHERITED; |
| 95 | }; |
| 96 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 97 | void SkPowerMode::init(SkScalar e) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 98 | fExp = e; |
| 99 | float ee = SkScalarToFloat(e); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 100 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 101 | printf("------ %g\n", ee); |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 102 | for (int i = 0; i < 256; i++) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 103 | float x = i / 255.f; |
| 104 | // printf(" %d %g", i, x); |
| 105 | x = powf(x, ee); |
| 106 | // printf(" %g", x); |
reed@google.com | e1ca705 | 2013-12-17 19:22:07 +0000 | [diff] [blame] | 107 | int xx = SkScalarRoundToInt(x * 255); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 108 | // printf(" %d\n", xx); |
| 109 | fTable[i] = SkToU8(xx); |
| 110 | } |
| 111 | } |
| 112 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 113 | void SkPowerMode::xfer16(uint16_t dst[], const SkPMColor src[], int count, |
mike@reedtribe.org | 3af2b8d | 2012-12-24 18:26:43 +0000 | [diff] [blame] | 114 | const SkAlpha aa[]) const { |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 115 | for (int i = 0; i < count; i++) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 116 | SkPMColor c = src[i]; |
| 117 | int r = SkGetPackedR32(c); |
| 118 | int g = SkGetPackedG32(c); |
| 119 | int b = SkGetPackedB32(c); |
| 120 | r = fTable[r]; |
| 121 | g = fTable[g]; |
| 122 | b = fTable[b]; |
| 123 | dst[i] = SkPack888ToRGB16(r, g, b); |
| 124 | } |
| 125 | } |
| 126 | |
commit-bot@chromium.org | 0f10f7b | 2014-03-13 18:02:17 +0000 | [diff] [blame] | 127 | #ifndef SK_IGNORE_TO_STRING |
robertphillips@google.com | b83b6b4 | 2013-01-22 14:32:09 +0000 | [diff] [blame] | 128 | void SkPowerMode::toString(SkString* str) const { |
| 129 | str->append("SkPowerMode: exponent "); |
| 130 | str->appendScalar(fExp); |
| 131 | } |
| 132 | #endif |
| 133 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 134 | static const struct { |
| 135 | const char* fName; |
| 136 | uint32_t fFlags; |
| 137 | bool fFlushCache; |
| 138 | } gHints[] = { |
| 139 | { "Linear", SkPaint::kLinearText_Flag, false }, |
| 140 | { "Normal", 0, true }, |
| 141 | { "Subpixel", SkPaint::kSubpixelText_Flag, true } |
| 142 | }; |
| 143 | |
commit-bot@chromium.org | e003aec | 2014-05-12 13:35:55 +0000 | [diff] [blame] | 144 | static void DrawTheText(SkCanvas* canvas, const char text[], size_t length, SkScalar x, SkScalar y, |
| 145 | const SkPaint& paint, SkScalar clickX) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 146 | SkPaint p(paint); |
| 147 | |
| 148 | #if 0 |
| 149 | canvas->drawText(text, length, x, y, paint); |
| 150 | #else |
| 151 | { |
| 152 | SkPoint pts[1000]; |
| 153 | SkScalar xpos = x; |
| 154 | SkASSERT(length <= SK_ARRAY_COUNT(pts)); |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 155 | for (size_t i = 0; i < length; i++) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 156 | pts[i].set(xpos, y), xpos += paint.getTextSize(); |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 157 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 158 | canvas->drawPosText(text, length, pts, paint); |
| 159 | } |
| 160 | #endif |
| 161 | |
| 162 | p.setSubpixelText(true); |
| 163 | x += SkIntToScalar(180); |
| 164 | canvas->drawText(text, length, x, y, p); |
| 165 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 166 | #ifdef SK_DEBUG |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 167 | if (true) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 168 | p.setSubpixelText(false); |
| 169 | p.setLinearText(true); |
| 170 | x += SkIntToScalar(180); |
| 171 | canvas->drawText(text, length, x, y, p); |
| 172 | } |
| 173 | #endif |
| 174 | } |
| 175 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 176 | class TextSpeedView : public SampleView { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 177 | public: |
rmistry@google.com | ae933ce | 2012-08-23 18:19:56 +0000 | [diff] [blame] | 178 | TextSpeedView() { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 179 | fHints = 0; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 180 | fClickX = 0; |
| 181 | |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 182 | test_breakText(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 183 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 184 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 185 | protected: |
| 186 | // overrides from SkEventSink |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 187 | virtual bool onQuery(SkEvent* evt) { |
| 188 | if (SampleCode::TitleQ(*evt)) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 189 | SampleCode::TitleR(evt, "Text"); |
| 190 | return true; |
| 191 | } |
| 192 | return this->INHERITED::onQuery(evt); |
| 193 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 194 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 195 | static void make_textstrip(SkBitmap* bm) { |
commit-bot@chromium.org | a8c1831 | 2014-02-17 02:55:57 +0000 | [diff] [blame] | 196 | bm->allocPixels(SkImageInfo::Make(200, 18, kRGB_565_SkColorType, |
| 197 | kOpaque_SkAlphaType)); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 198 | bm->eraseColor(SK_ColorWHITE); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 199 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 200 | SkCanvas canvas(*bm); |
| 201 | SkPaint paint; |
| 202 | const char* s = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit"; |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 203 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 204 | paint.setFlags(paint.getFlags() | SkPaint::kAntiAlias_Flag |
| 205 | | SkPaint::kDevKernText_Flag); |
| 206 | paint.setTextSize(SkIntToScalar(14)); |
| 207 | canvas.drawText(s, strlen(s), SkIntToScalar(8), SkIntToScalar(14), paint); |
| 208 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 209 | |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 210 | static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 211 | for (size_t i = 0; i < n; i++) |
| 212 | pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480); |
| 213 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 214 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 215 | virtual void onDrawContent(SkCanvas* canvas) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 216 | SkAutoCanvasRestore restore(canvas, false); |
| 217 | { |
| 218 | SkRect r; |
| 219 | r.set(0, 0, SkIntToScalar(1000), SkIntToScalar(20)); |
| 220 | // canvas->saveLayer(&r, NULL, SkCanvas::kHasAlphaLayer_SaveFlag); |
| 221 | } |
| 222 | |
| 223 | SkPaint paint; |
| 224 | // const uint16_t glyphs[] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 }; |
| 225 | int index = fHints % SK_ARRAY_COUNT(gHints); |
| 226 | index = 1; |
| 227 | // const char* style = gHints[index].fName; |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 228 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 229 | // canvas->translate(0, SkIntToScalar(50)); |
| 230 | |
| 231 | // canvas->drawText(style, strlen(style), SkIntToScalar(20), SkIntToScalar(20), paint); |
| 232 | |
reed@android.com | 04d86c6 | 2010-01-25 22:02:44 +0000 | [diff] [blame] | 233 | SkSafeUnref(paint.setTypeface(SkTypeface::CreateFromFile("/skimages/samplefont.ttf"))); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 234 | paint.setAntiAlias(true); |
| 235 | paint.setFlags(paint.getFlags() | gHints[index].fFlags); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 236 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 237 | SkRect clip; |
| 238 | clip.set(SkIntToScalar(25), SkIntToScalar(34), SkIntToScalar(88), SkIntToScalar(155)); |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 239 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 240 | const char* text = "Hamburgefons"; |
| 241 | size_t length = strlen(text); |
| 242 | |
reed@google.com | 2f3dc9d | 2011-05-02 17:33:45 +0000 | [diff] [blame] | 243 | SkScalar y = SkIntToScalar(0); |
| 244 | for (int i = 9; i <= 24; i++) { |
| 245 | paint.setTextSize(SkIntToScalar(i) /*+ (gRand.nextU() & 0xFFFF)*/); |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 246 | for (SkScalar dx = 0; dx <= SkIntToScalar(3)/4; |
| 247 | dx += SkIntToScalar(1) /* /4 */) { |
reed@google.com | 2f3dc9d | 2011-05-02 17:33:45 +0000 | [diff] [blame] | 248 | y += paint.getFontSpacing(); |
commit-bot@chromium.org | e003aec | 2014-05-12 13:35:55 +0000 | [diff] [blame] | 249 | DrawTheText(canvas, text, length, SkIntToScalar(20) + dx, y, paint, fClickX); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 250 | } |
| 251 | } |
reed@google.com | 2f3dc9d | 2011-05-02 17:33:45 +0000 | [diff] [blame] | 252 | if (gHints[index].fFlushCache) { |
| 253 | // SkGraphics::SetFontCacheUsed(0); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 254 | } |
| 255 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 256 | |
reed@google.com | 4d5c26d | 2013-01-08 16:17:50 +0000 | [diff] [blame] | 257 | virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, |
| 258 | unsigned modi) SK_OVERRIDE { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 259 | fClickX = x; |
| 260 | this->inval(NULL); |
reed@google.com | 4d5c26d | 2013-01-08 16:17:50 +0000 | [diff] [blame] | 261 | return this->INHERITED::onFindClickHandler(x, y, modi); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 262 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 263 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 264 | virtual bool onClick(Click* click) { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 265 | return this->INHERITED::onClick(click); |
| 266 | } |
reed@google.com | 82065d6 | 2011-02-07 15:30:46 +0000 | [diff] [blame] | 267 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 268 | private: |
| 269 | int fHints; |
| 270 | SkScalar fClickX; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 271 | |
reed@google.com | 9e39bb3 | 2011-05-18 12:17:53 +0000 | [diff] [blame] | 272 | typedef SampleView INHERITED; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 273 | }; |
| 274 | |
| 275 | ////////////////////////////////////////////////////////////////////////////// |
| 276 | |
| 277 | static SkView* MyFactory() { return new TextSpeedView; } |
| 278 | static SkViewRegister reg(MyFactory); |