| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 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" |
| 11 #include "SkBlurMaskFilter.h" | 11 #include "SkBlurMaskFilter.h" |
| 12 #include "SkCamera.h" | 12 #include "SkCamera.h" |
| 13 #include "SkColorFilter.h" | 13 #include "SkColorFilter.h" |
| 14 #include "SkColorPriv.h" | 14 #include "SkColorPriv.h" |
| 15 #include "SkDevice.h" | 15 #include "SkDevice.h" |
| 16 #include "SkGradientShader.h" | 16 #include "SkGradientShader.h" |
| 17 #include "SkImageDecoder.h" | 17 #include "SkImageDecoder.h" |
| 18 #include "SkInterpolator.h" | 18 #include "SkInterpolator.h" |
| 19 #include "SkMaskFilter.h" | 19 #include "SkMaskFilter.h" |
| 20 #include "SkPath.h" | 20 #include "SkPath.h" |
| 21 #include "SkRegion.h" | 21 #include "SkRegion.h" |
| 22 #include "SkShader.h" | 22 #include "SkShader.h" |
| 23 #include "SkTime.h" | 23 #include "SkTime.h" |
| 24 #include "SkTypeface.h" | 24 #include "SkTypeface.h" |
| 25 #include "SkUtils.h" | 25 #include "SkUtils.h" |
| 26 #include "SkKey.h" | 26 #include "SkKey.h" |
| 27 #include "SkXfermode.h" | 27 #include "SkXfermode.h" |
| 28 #include "SkDrawFilter.h" | 28 #include "SkDrawFilter.h" |
| 29 | 29 |
| 30 static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) { | 30 static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) { |
| 31 SkColor colors[] = { 0, SK_ColorWHITE }; | 31 SkColor colors[] = { 0, SK_ColorWHITE }; |
| 32 SkPoint pts[] = { { 0, 0 }, { 0, SK_Scalar1*20 } }; | 32 SkPoint pts[] = { { 0, 0 }, { 0, SK_Scalar1*20 } }; |
| 33 SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 2, SkShad
er::kClamp_TileMode, | 33 paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, 2, |
| 34 0, &localMatrix); | 34 SkShader::kClamp_TileMode, 0,
&localMatrix)); |
| 35 | |
| 36 paint->setShader(s)->unref(); | |
| 37 paint->setXfermodeMode(SkXfermode::kDstIn_Mode); | 35 paint->setXfermodeMode(SkXfermode::kDstIn_Mode); |
| 38 } | 36 } |
| 39 | 37 |
| 40 static void dump_layers(const char label[], SkCanvas* canvas) { | 38 static void dump_layers(const char label[], SkCanvas* canvas) { |
| 41 SkDebugf("Dump Layers(%s)\n", label); | 39 SkDebugf("Dump Layers(%s)\n", label); |
| 42 | 40 |
| 43 SkCanvas::LayerIter iter(canvas, true); | 41 SkCanvas::LayerIter iter(canvas, true); |
| 44 int index = 0; | 42 int index = 0; |
| 45 while (!iter.done()) { | 43 while (!iter.done()) { |
| 46 SkImageInfo info = iter.device()->imageInfo(); | 44 SkImageInfo info = iter.device()->imageInfo(); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 this->inval(nullptr); | 300 this->inval(nullptr); |
| 303 fCenter = click->fCurr; | 301 fCenter = click->fCurr; |
| 304 return this->INHERITED::onClick(click); | 302 return this->INHERITED::onClick(click); |
| 305 } | 303 } |
| 306 | 304 |
| 307 private: | 305 private: |
| 308 typedef SampleView INHERITED; | 306 typedef SampleView INHERITED; |
| 309 }; | 307 }; |
| 310 DEF_SAMPLE( return new BackdropView; ) | 308 DEF_SAMPLE( return new BackdropView; ) |
| 311 | 309 |
| OLD | NEW |