Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1752)

Side by Side Diff: gm/patch.cpp

Issue 1832223002: switch xfermodes over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const SkXfermode::Mode modes[] = { 88 const SkXfermode::Mode modes[] = {
89 SkXfermode::kSrc_Mode, 89 SkXfermode::kSrc_Mode,
90 SkXfermode::kDst_Mode, 90 SkXfermode::kDst_Mode,
91 SkXfermode::kModulate_Mode, 91 SkXfermode::kModulate_Mode,
92 }; 92 };
93 93
94 sk_sp<SkShader> shader(make_shader()); 94 sk_sp<SkShader> shader(make_shader());
95 95
96 canvas->save(); 96 canvas->save();
97 for (int y = 0; y < 3; y++) { 97 for (int y = 0; y < 3; y++) {
98 SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(modes[y])); 98 sk_sp<SkXfermode> xfer(SkXfermode::Make(modes[y]));
99 99
100 for (int x = 0; x < 4; x++) { 100 for (int x = 0; x < 4; x++) {
101 canvas->save(); 101 canvas->save();
102 canvas->translate(x * 350.0f, y * 350.0f); 102 canvas->translate(x * 350.0f, y * 350.0f);
103 switch (x) { 103 switch (x) {
104 case 0: 104 case 0:
105 canvas->drawPatch(cubics, nullptr, nullptr, xfer, paint) ; 105 canvas->drawPatch(cubics, nullptr, nullptr, xfer, paint) ;
106 break; 106 break;
107 case 1: 107 case 1:
108 canvas->drawPatch(cubics, colors, nullptr, xfer, paint); 108 canvas->drawPatch(cubics, colors, nullptr, xfer, paint);
(...skipping 11 matching lines...) Expand all
120 default: 120 default:
121 break; 121 break;
122 } 122 }
123 123
124 draw_control_points(canvas, cubics); 124 draw_control_points(canvas, cubics);
125 canvas->restore(); 125 canvas->restore();
126 } 126 }
127 } 127 }
128 canvas->restore(); 128 canvas->restore();
129 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698