OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkLightingImageFilter.h" | 9 #include "SkLightingImageFilter.h" |
10 #include "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 SkScalar cutoffAngle = SkIntToScalar(15); | 73 SkScalar cutoffAngle = SkIntToScalar(15); |
74 SkScalar kd = SkIntToScalar(2); | 74 SkScalar kd = SkIntToScalar(2); |
75 SkScalar ks = SkIntToScalar(1); | 75 SkScalar ks = SkIntToScalar(1); |
76 SkScalar shininess = SkIntToScalar(8); | 76 SkScalar shininess = SkIntToScalar(8); |
77 SkScalar surfaceScale = SkIntToScalar(1); | 77 SkScalar surfaceScale = SkIntToScalar(1); |
78 SkColor white(0xFFFFFFFF); | 78 SkColor white(0xFFFFFFFF); |
79 SkPaint paint; | 79 SkPaint paint; |
80 | 80 |
81 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65)); | 81 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65)); |
82 SkImageFilter::CropRect fullSizeCropRect(SkRect::MakeXYWH(0, 0, 100, 100
)); | 82 SkImageFilter::CropRect fullSizeCropRect(SkRect::MakeXYWH(0, 0, 100, 100
)); |
83 SkAutoTUnref<SkImageFilter> noopCropped(SkOffsetImageFilter::Create(0, 0
, nullptr, &cropRect)); | 83 sk_sp<SkImageFilter> noopCropped(SkOffsetImageFilter::Make(0, 0, nullptr
, &cropRect)); |
84 | 84 |
85 int y = 0; | 85 int y = 0; |
86 for (int i = 0; i < 3; i++) { | 86 for (int i = 0; i < 3; i++) { |
87 const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2)
? &fullSizeCropRect : nullptr; | 87 const SkImageFilter::CropRect* cr = (i == 1) ? &cropRect : (i == 2)
? &fullSizeCropRect : nullptr; |
88 SkImageFilter* input = (i == 2) ? noopCropped.get() : nullptr; | 88 SkImageFilter* input = (i == 2) ? noopCropped.get() : nullptr; |
89 paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(po
intLocation, | 89 paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(po
intLocation, |
90 wh
ite, | 90 wh
ite, |
91 su
rfaceScale, | 91 su
rfaceScale, |
92 kd
, | 92 kd
, |
93 in
put, | 93 in
put, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 private: | 152 private: |
153 SkBitmap fBitmap; | 153 SkBitmap fBitmap; |
154 | 154 |
155 typedef GM INHERITED; | 155 typedef GM INHERITED; |
156 }; | 156 }; |
157 | 157 |
158 ////////////////////////////////////////////////////////////////////////////// | 158 ////////////////////////////////////////////////////////////////////////////// |
159 | 159 |
160 DEF_GM(return new ImageLightingGM;) | 160 DEF_GM(return new ImageLightingGM;) |
161 } | 161 } |
OLD | NEW |