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

Side by Side Diff: samplecode/PerlinPatch.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 2015 Google Inc. 2 * Copyright 2015 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 "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 SkPaint paint; 131 SkPaint paint;
132 132
133 SkScalar texWidth = fTexScale * TexWidth; 133 SkScalar texWidth = fTexScale * TexWidth;
134 SkScalar texHeight = fTexScale * TexHeight; 134 SkScalar texHeight = fTexScale * TexHeight;
135 const SkPoint texCoords[SkPatchUtils::kNumCorners] = { 135 const SkPoint texCoords[SkPatchUtils::kNumCorners] = {
136 { fTexX - texWidth, fTexY - texHeight}, 136 { fTexX - texWidth, fTexY - texHeight},
137 { fTexX + texWidth, fTexY - texHeight}, 137 { fTexX + texWidth, fTexY - texHeight},
138 { fTexX + texWidth, fTexY + texHeight}, 138 { fTexX + texWidth, fTexY + texHeight},
139 { fTexX - texWidth, fTexY + texHeight}} 139 { fTexX - texWidth, fTexY + texHeight}}
140 ; 140 ;
141 141
142 SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(SkXfermode::kSrc_Mode)) ; 142 sk_sp<SkXfermode> xfer(SkXfermode::Make(SkXfermode::kSrc_Mode));
143 143
144 SkScalar scaleFreq = 2.0; 144 SkScalar scaleFreq = 2.0;
145 fShader1 = SkPerlinNoiseShader2::MakeImprovedNoise(fXFreq/scaleFreq, fYF req/scaleFreq, 4, 145 fShader1 = SkPerlinNoiseShader2::MakeImprovedNoise(fXFreq/scaleFreq, fYF req/scaleFreq, 4,
146 fSeed); 146 fSeed);
147 fShaderCompose = SkShader::MakeComposeShader(fShader0, fShader1, nullptr ); 147 fShaderCompose = SkShader::MakeComposeShader(fShader0, fShader1, nullptr );
148 148
149 paint.setShader(fShaderCompose); 149 paint.setShader(fShaderCompose);
150 canvas->drawPatch(fPts, nullptr, texCoords, xfer, paint); 150 canvas->drawPatch(fPts, nullptr, texCoords, xfer, paint);
151 151
152 draw_control_points(canvas, fPts); 152 draw_control_points(canvas, fPts);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 this->inval(nullptr); 198 this->inval(nullptr);
199 return true; 199 return true;
200 } 200 }
201 201
202 private: 202 private:
203 typedef SampleView INHERITED; 203 typedef SampleView INHERITED;
204 }; 204 };
205 205
206 DEF_SAMPLE( return new PerlinPatchView(); ) 206 DEF_SAMPLE( return new PerlinPatchView(); )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698