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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 canvas->save(); | 105 canvas->save(); |
106 for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) { | 106 for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); ++i) { |
107 if (6 == i) { | 107 if (6 == i) { |
108 canvas->restore(); | 108 canvas->restore(); |
109 canvas->translate(W * 5, 0); | 109 canvas->translate(W * 5, 0); |
110 canvas->save(); | 110 canvas->save(); |
111 } | 111 } |
112 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); | 112 SkXfermode* mode = SkXfermode::Create(gModes[i].fMode); |
113 | 113 |
114 canvas->drawRect(bounds, fBGPaint); | 114 canvas->drawRect(bounds, fBGPaint); |
115 canvas->saveLayer(&bounds, NULL); | 115 canvas->saveLayer(&bounds, nullptr); |
116 SkScalar dy = drawCell(canvas, mode, | 116 SkScalar dy = drawCell(canvas, mode, |
117 gAlphaValue[alpha & 1], | 117 gAlphaValue[alpha & 1], |
118 gAlphaValue[alpha & 2]); | 118 gAlphaValue[alpha & 2]); |
119 canvas->restore(); | 119 canvas->restore(); |
120 | 120 |
121 canvas->translate(0, dy * 5 / 4); | 121 canvas->translate(0, dy * 5 / 4); |
122 SkSafeUnref(mode); | 122 SkSafeUnref(mode); |
123 } | 123 } |
124 canvas->restore(); | 124 canvas->restore(); |
125 canvas->restore(); | 125 canvas->restore(); |
126 canvas->translate(W * 5 / 4, 0); | 126 canvas->translate(W * 5 / 4, 0); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 private: | 130 private: |
131 typedef SampleView INHERITED; | 131 typedef SampleView INHERITED; |
132 }; | 132 }; |
133 | 133 |
134 /////////////////////////////////////////////////////////////////////////////// | 134 /////////////////////////////////////////////////////////////////////////////// |
135 | 135 |
136 static SkView* MyFactory() { return new AARectsModesView; } | 136 static SkView* MyFactory() { return new AARectsModesView; } |
137 static SkViewRegister reg(MyFactory); | 137 static SkViewRegister reg(MyFactory); |
OLD | NEW |