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

Side by Side Diff: samplecode/SampleLitAtlas.cpp

Issue 2195893002: Always return ImageShader, even from SkShader::MakeBitmapShader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update serialize-8888 ignore list: skbug.com/5595 Created 4 years, 4 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 2016 Google Inc. 2 * Copyright 2016 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 "SkBitmapProcShader.h" 10 #include "SkBitmapProcShader.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 diffMat.setRectToRect(fDiffTex[i], r, SkMatrix::kFill_ScaleToFit); 127 diffMat.setRectToRect(fDiffTex[i], r, SkMatrix::kFill_ScaleToFit);
128 normalMat.setRectToRect(fNormTex[i], r, SkMatrix::kFill_ScaleToFit); 128 normalMat.setRectToRect(fNormTex[i], r, SkMatrix::kFill_ScaleToFit);
129 129
130 SkMatrix m; 130 SkMatrix m;
131 m.setRSXform(xforms[i]); 131 m.setRSXform(xforms[i]);
132 132
133 sk_sp<SkShader> normalMap = SkMakeBitmapShader(fAtlas, SkShader::kCl amp_TileMode, 133 sk_sp<SkShader> normalMap = SkMakeBitmapShader(fAtlas, SkShader::kCl amp_TileMode,
134 SkShader::kClamp_TileMode, &normalMat, nullptr); 134 SkShader::kClamp_TileMode, &normalMat, nullptr);
135 sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalM ap( 135 sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalM ap(
136 std::move(normalMap), m); 136 std::move(normalMap), m);
137 sk_sp<SkShader> diffuseShader = SkBitmapProcShader::MakeBitmapShader (fAtlas, 137 sk_sp<SkShader> diffuseShader = SkShader::MakeBitmapShader(fAtlas,
138 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, &diffM at); 138 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, &diffM at);
139 paint.setShader(SkLightingShader::Make(std::move(diffuseShader), 139 paint.setShader(SkLightingShader::Make(std::move(diffuseShader),
140 std::move(normalSource), fLights)); 140 std::move(normalSource), fLights));
141 141
142 canvas->save(); 142 canvas->save();
143 canvas->setMatrix(m); 143 canvas->setMatrix(m);
144 canvas->drawRect(r, paint); 144 canvas->drawRect(r, paint);
145 canvas->restore(); 145 canvas->restore();
146 } 146 }
147 #endif 147 #endif
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 private: 507 private:
508 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable; 508 SkAutoTUnref<DrawLitAtlasDrawable> fDrawable;
509 509
510 typedef SampleView INHERITED; 510 typedef SampleView INHERITED;
511 }; 511 };
512 512
513 ////////////////////////////////////////////////////////////////////////////// 513 //////////////////////////////////////////////////////////////////////////////
514 514
515 static SkView* MyFactory() { return new DrawLitAtlasView; } 515 static SkView* MyFactory() { return new DrawLitAtlasView; }
516 static SkViewRegister reg(MyFactory); 516 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698