| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return SkTableColorFilter::MakeARGB(tableA, tableR, tableG, tableB); | 32 return SkTableColorFilter::MakeARGB(tableA, tableR, tableG, tableB); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // This detector detects that color filter phase of the pixel pipeline receives
the correct value. | 35 // This detector detects that color filter phase of the pixel pipeline receives
the correct value. |
| 36 static void install_detector_color_filter(SkPaint* drawPaint) { | 36 static void install_detector_color_filter(SkPaint* drawPaint) { |
| 37 drawPaint->setColorFilter(make_detector_color_filter()); | 37 drawPaint->setColorFilter(make_detector_color_filter()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // This detector detects that image filter phase of the pixel pipeline receives
the correct value. | 40 // This detector detects that image filter phase of the pixel pipeline receives
the correct value. |
| 41 static void install_detector_image_filter(SkPaint* drawPaint) { | 41 static void install_detector_image_filter(SkPaint* drawPaint) { |
| 42 auto colorFilter(make_detector_color_filter()); | 42 sk_sp<SkColorFilter> colorFilter(make_detector_color_filter()); |
| 43 SkImageFilter* imageFilter = | 43 sk_sp<SkImageFilter> imageFilter( |
| 44 SkColorFilterImageFilter::Create(colorFilter.get(), drawPaint->getIm
ageFilter()); | 44 SkColorFilterImageFilter::Make(std::move(colorFilter), |
| 45 drawPaint->setImageFilter(imageFilter)->unref(); | 45 sk_ref_sp(drawPaint->getImageFilter()))); |
| 46 drawPaint->setImageFilter(std::move(imageFilter)); |
| 46 } | 47 } |
| 47 | 48 |
| 48 static void no_detector_install(SkPaint*) { | 49 static void no_detector_install(SkPaint*) { |
| 49 } | 50 } |
| 50 | 51 |
| 51 typedef void(*InstallDetectorFunc)(SkPaint*); | 52 typedef void(*InstallDetectorFunc)(SkPaint*); |
| 52 | 53 |
| 53 | 54 |
| 54 // Draws an pattern that can be optimized by alpha folding outer savelayer alpha
value to | 55 // Draws an pattern that can be optimized by alpha folding outer savelayer alpha
value to |
| 55 // inner draw. Since we know that folding will happen to the inner draw, install
a detector | 56 // inner draw. Since we know that folding will happen to the inner draw, install
a detector |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 canvas->flush(); | 207 canvas->flush(); |
| 207 } | 208 } |
| 208 | 209 |
| 209 canvas->restore(); | 210 canvas->restore(); |
| 210 canvas->translate(SkIntToScalar(0), SkIntToScalar(kTestRectSize)
+ SkIntToScalar(1)); | 211 canvas->translate(SkIntToScalar(0), SkIntToScalar(kTestRectSize)
+ SkIntToScalar(1)); |
| 211 } | 212 } |
| 212 | 213 |
| 213 } | 214 } |
| 214 } | 215 } |
| 215 } | 216 } |
| OLD | NEW |