| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 static sk_sp<SkColorFilter> make_cf2() { | 48 static sk_sp<SkColorFilter> make_cf2() { |
| 49 return SkColorFilter::MakeModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode); | 49 return SkColorFilter::MakeModeFilter(0x8044CC88, SkXfermode::kSrcATop_Mode); |
| 50 } | 50 } |
| 51 | 51 |
| 52 static void draw_into_canvas(SkCanvas* canvas) { | 52 static void draw_into_canvas(SkCanvas* canvas) { |
| 53 const SkRect r = SkRect::MakeWH(50, 100); | 53 const SkRect r = SkRect::MakeWH(50, 100); |
| 54 sk_sp<SkShader> (*shaders[])() { make_opaque_color, make_alpha_color }; | 54 sk_sp<SkShader> (*shaders[])() { make_opaque_color, make_alpha_color }; |
| 55 sk_sp<SkColorFilter> (*filters[])() { make_cf_null, make_cf0, make_cf1, make
_cf2 }; | 55 sk_sp<SkColorFilter> (*filters[])() { make_cf_null, make_cf0, make_cf1, make
_cf2 }; |
| 56 | 56 |
| 57 SkPaint paint; | 57 SkPaint paint; |
| 58 for (auto shProc : shaders) { | 58 for (auto shProc : shaders) { |
| 59 paint.setShader(shProc()); | 59 paint.setShader(shProc()); |
| 60 for (auto cfProc : filters) { | 60 for (auto cfProc : filters) { |
| 61 paint.setColorFilter(cfProc()); | 61 paint.setColorFilter(cfProc()); |
| 62 canvas->drawRect(r, paint); | 62 canvas->drawRect(r, paint); |
| 63 canvas->translate(60, 0); | 63 canvas->translate(60, 0); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 } | 66 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 77 for (auto profile : profiles) { | 77 for (auto profile : profiles) { |
| 78 const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType,
kPremul_SkAlphaType, | 78 const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType,
kPremul_SkAlphaType, |
| 79 profile); | 79 profile); |
| 80 auto surface(SkSurface::MakeRaster(info)); | 80 auto surface(SkSurface::MakeRaster(info)); |
| 81 surface->getCanvas()->drawPaint(bg); | 81 surface->getCanvas()->drawPaint(bg); |
| 82 draw_into_canvas(surface->getCanvas()); | 82 draw_into_canvas(surface->getCanvas()); |
| 83 surface->draw(canvas, 0, 0, nullptr); | 83 surface->draw(canvas, 0, 0, nullptr); |
| 84 canvas->translate(0, 120); | 84 canvas->translate(0, 120); |
| 85 } | 85 } |
| 86 } | 86 } |
| OLD | NEW |