OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkAndroidSDKCanvas.h" | 8 #include "SkAndroidSDKCanvas.h" |
9 | 9 |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
11 #include "SkPaint.h" | 11 #include "SkPaint.h" |
12 #include "SkPathEffect.h" | 12 #include "SkPathEffect.h" |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
14 #include "SkTLazy.h" | 14 #include "SkTLazy.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 /** Discard SkShaders not exposed by the Android Java API. */ | 18 /** Discard SkShaders not exposed by the Android Java API. */ |
19 | 19 |
20 void CheckShader(SkPaint* paint) { | 20 void CheckShader(SkPaint* paint) { |
21 SkShader* shader = paint->getShader(); | 21 SkShader* shader = paint->getShader(); |
22 if (!shader) { | 22 if (!shader) { |
23 return; | 23 return; |
24 } | 24 } |
25 | 25 |
26 if (shader->asABitmap(NULL, NULL, NULL) == SkShader::kDefault_BitmapType) { | 26 if (shader->isABitmap()) { |
27 return; | 27 return; |
28 } | 28 } |
29 if (shader->asACompose(NULL)) { | 29 if (shader->asACompose(NULL)) { |
30 return; | 30 return; |
31 } | 31 } |
32 SkShader::GradientType gtype = shader->asAGradient(NULL); | 32 SkShader::GradientType gtype = shader->asAGradient(NULL); |
33 if (gtype == SkShader::kLinear_GradientType || | 33 if (gtype == SkShader::kLinear_GradientType || |
34 gtype == SkShader::kRadial_GradientType || | 34 gtype == SkShader::kRadial_GradientType || |
35 gtype == SkShader::kSweep_GradientType) { | 35 gtype == SkShader::kSweep_GradientType) { |
36 return; | 36 return; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 fProxyTarget->clipPath(path, op, style); | 343 fProxyTarget->clipPath(path, op, style); |
344 } | 344 } |
345 | 345 |
346 void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { | 346 void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { |
347 fProxyTarget->clipRegion(region, op); | 347 fProxyTarget->clipRegion(region, op); |
348 } | 348 } |
349 | 349 |
350 void SkAndroidSDKCanvas::onDiscard() { fProxyTarget->discard(); } | 350 void SkAndroidSDKCanvas::onDiscard() { fProxyTarget->discard(); } |
351 | 351 |
352 | 352 |
OLD | NEW |