OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SampleCode.h" | 7 #include "SampleCode.h" |
8 #include "SkAlphaThresholdFilter.h" | 8 #include "SkAlphaThresholdFilter.h" |
9 #include "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 241 } |
242 | 242 |
243 static void drawSomething(SkCanvas* canvas) { | 243 static void drawSomething(SkCanvas* canvas) { |
244 SkPaint paint; | 244 SkPaint paint; |
245 | 245 |
246 canvas->save(); | 246 canvas->save(); |
247 canvas->scale(0.5f, 0.5f); | 247 canvas->scale(0.5f, 0.5f); |
248 canvas->drawBitmap(make_bitmap(), 0, 0, NULL); | 248 canvas->drawBitmap(make_bitmap(), 0, 0, NULL); |
249 canvas->restore(); | 249 canvas->restore(); |
250 | 250 |
251 const char beforeStr[] = "before circle"; | |
252 const char afterStr[] = "after circle"; | |
253 | |
254 paint.setAntiAlias(true); | 251 paint.setAntiAlias(true); |
255 | 252 |
256 paint.setColor(SK_ColorRED); | 253 paint.setColor(SK_ColorRED); |
257 canvas->drawData(beforeStr, sizeof(beforeStr)); | |
258 canvas->drawCircle(SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/2
), SkIntToScalar(kBitmapSize/3), paint); | 254 canvas->drawCircle(SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/2
), SkIntToScalar(kBitmapSize/3), paint); |
259 canvas->drawData(afterStr, sizeof(afterStr)); | |
260 paint.setColor(SK_ColorBLACK); | 255 paint.setColor(SK_ColorBLACK); |
261 paint.setTextSize(SkIntToScalar(kBitmapSize/3)); | 256 paint.setTextSize(SkIntToScalar(kBitmapSize/3)); |
262 canvas->drawText("Picture", 7, SkIntToScalar(kBitmapSize/2), SkIntToScalar(k
BitmapSize/4), paint); | 257 canvas->drawText("Picture", 7, SkIntToScalar(kBitmapSize/2), SkIntToScalar(k
BitmapSize/4), paint); |
263 } | 258 } |
264 | 259 |
265 static SkImageFilter* make_image_filter(bool canBeNull = true) { | 260 static SkImageFilter* make_image_filter(bool canBeNull = true) { |
266 SkImageFilter* filter = 0; | 261 SkImageFilter* filter = 0; |
267 | 262 |
268 // Add a 1 in 3 chance to get a NULL input | 263 // Add a 1 in 3 chance to get a NULL input |
269 if (canBeNull && (R(3) == 1)) { return filter; } | 264 if (canBeNull && (R(3) == 1)) { return filter; } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 514 } |
520 | 515 |
521 private: | 516 private: |
522 typedef SkView INHERITED; | 517 typedef SkView INHERITED; |
523 }; | 518 }; |
524 | 519 |
525 ////////////////////////////////////////////////////////////////////////////// | 520 ////////////////////////////////////////////////////////////////////////////// |
526 | 521 |
527 static SkView* MyFactory() { return new ImageFilterFuzzView; } | 522 static SkView* MyFactory() { return new ImageFilterFuzzView; } |
528 static SkViewRegister reg(MyFactory); | 523 static SkViewRegister reg(MyFactory); |
OLD | NEW |