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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Android SDK only supports mode & matrix color filters | 62 // Android SDK only supports mode & matrix color filters |
63 // (and, again, no modes above kLighten_Mode). | 63 // (and, again, no modes above kLighten_Mode). |
64 SkColorFilter* cf = paint->getColorFilter(); | 64 SkColorFilter* cf = paint->getColorFilter(); |
65 if (cf) { | 65 if (cf) { |
66 SkColor color; | 66 SkColor color; |
67 SkXfermode::Mode mode; | 67 SkXfermode::Mode mode; |
68 SkScalar srcColorMatrix[20]; | 68 SkScalar srcColorMatrix[20]; |
69 bool isMode = cf->asColorMode(&color, &mode); | 69 bool isMode = cf->asColorMode(&color, &mode); |
70 if (isMode && mode > SkXfermode::kLighten_Mode) { | 70 if (isMode && mode > SkXfermode::kLighten_Mode) { |
71 paint->setColorFilter( | 71 paint->setColorFilter( |
72 SkColorFilter::MakeModeFilter(color, SkXfermode::kSrcOver_Mode))
; | 72 SkColorFilter::CreateModeFilter(color, SkXfermode::kSrcOver_Mode
)); |
73 } else if (!isMode && !cf->asColorMatrix(srcColorMatrix)) { | 73 } else if (!isMode && !cf->asColorMatrix(srcColorMatrix)) { |
74 paint->setColorFilter(nullptr); | 74 paint->setColorFilter(nullptr); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 78 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
79 SkPathEffect* pe = paint->getPathEffect(); | 79 SkPathEffect* pe = paint->getPathEffect(); |
80 if (pe && !pe->exposedInAndroidJavaAPI()) { | 80 if (pe && !pe->exposedInAndroidJavaAPI()) { |
81 paint->setPathEffect(nullptr); | 81 paint->setPathEffect(nullptr); |
82 } | 82 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 fProxyTarget->clipPath(path, op, style); | 349 fProxyTarget->clipPath(path, op, style); |
350 } | 350 } |
351 | 351 |
352 void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { | 352 void SkAndroidSDKCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) { |
353 fProxyTarget->clipRegion(region, op); | 353 fProxyTarget->clipRegion(region, op); |
354 } | 354 } |
355 | 355 |
356 void SkAndroidSDKCanvas::onDiscard() { fProxyTarget->discard(); } | 356 void SkAndroidSDKCanvas::onDiscard() { fProxyTarget->discard(); } |
357 | 357 |
358 | 358 |
OLD | NEW |