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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); | 75 canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); |
76 | 76 |
77 SkPaint paint; | 77 SkPaint paint; |
78 sk_tool_utils::set_portable_typeface(&paint); | 78 sk_tool_utils::set_portable_typeface(&paint); |
79 paint.setColor(0x80F60000); | 79 paint.setColor(0x80F60000); |
80 | 80 |
81 const Proc procs[] = { | 81 const Proc procs[] = { |
82 draw_hair, draw_thick, draw_rect, draw_oval, draw_text | 82 draw_hair, draw_thick, draw_rect, draw_oval, draw_text |
83 }; | 83 }; |
84 | 84 |
85 const SkXfermode::Mode modes[] = { | 85 const SkBlendMode modes[] = { |
86 SkXfermode::kSrcOver_Mode, SkXfermode::kSrc_Mode, SkXfermode::kClear
_Mode | 86 SkBlendMode::kSrcOver, SkBlendMode::kSrc, SkBlendMode::kClear |
87 }; | 87 }; |
88 | 88 |
89 const PaintProc paintProcs[] = { | 89 const PaintProc paintProcs[] = { |
90 identity_paintproc, gradient_paintproc | 90 identity_paintproc, gradient_paintproc |
91 }; | 91 }; |
92 | 92 |
93 for (int aa = 0; aa <= 1; ++aa) { | 93 for (int aa = 0; aa <= 1; ++aa) { |
94 paint.setAntiAlias(SkToBool(aa)); | 94 paint.setAntiAlias(SkToBool(aa)); |
95 canvas->save(); | 95 canvas->save(); |
96 for (size_t i = 0; i < SK_ARRAY_COUNT(paintProcs); ++i) { | 96 for (size_t i = 0; i < SK_ARRAY_COUNT(paintProcs); ++i) { |
97 paintProcs[i](&paint); | 97 paintProcs[i](&paint); |
98 for (size_t x = 0; x < SK_ARRAY_COUNT(modes); ++x) { | 98 for (size_t x = 0; x < SK_ARRAY_COUNT(modes); ++x) { |
99 paint.setXfermodeMode(modes[x]); | 99 paint.setBlendMode(modes[x]); |
100 canvas->save(); | 100 canvas->save(); |
101 for (size_t y = 0; y < SK_ARRAY_COUNT(procs); ++y) { | 101 for (size_t y = 0; y < SK_ARRAY_COUNT(procs); ++y) { |
102 procs[y](canvas, paint); | 102 procs[y](canvas, paint); |
103 canvas->translate(0, H * 5 / 4); | 103 canvas->translate(0, H * 5 / 4); |
104 } | 104 } |
105 canvas->restore(); | 105 canvas->restore(); |
106 canvas->translate(W * 5 / 4, 0); | 106 canvas->translate(W * 5 / 4, 0); |
107 } | 107 } |
108 } | 108 } |
109 canvas->restore(); | 109 canvas->restore(); |
(...skipping 25 matching lines...) Expand all Loading... |
135 surf->draw(canvas, 0, 0, nullptr); | 135 surf->draw(canvas, 0, 0, nullptr); |
136 } | 136 } |
137 | 137 |
138 private: | 138 private: |
139 typedef skiagm::GM INHERITED; | 139 typedef skiagm::GM INHERITED; |
140 }; | 140 }; |
141 | 141 |
142 /////////////////////////////////////////////////////////////////////////////// | 142 /////////////////////////////////////////////////////////////////////////////// |
143 | 143 |
144 DEF_GM(return new SrcModeGM;) | 144 DEF_GM(return new SrcModeGM;) |
OLD | NEW |