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

Side by Side Diff: src/core/SkLightingShader.cpp

Issue 2080993002: Added API for Bevel NormalSource. (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-diffuse-api-change
Patch Set: Small init fix Created 4 years, 5 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 "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 return new (storage) LightingShaderContext(*this, rec, diffuseContext, norma lProvider, 485 return new (storage) LightingShaderContext(*this, rec, diffuseContext, norma lProvider,
486 heapAllocated); 486 heapAllocated);
487 } 487 }
488 488
489 /////////////////////////////////////////////////////////////////////////////// 489 ///////////////////////////////////////////////////////////////////////////////
490 490
491 sk_sp<SkShader> SkLightingShader::Make(sk_sp<SkShader> diffuseShader, 491 sk_sp<SkShader> SkLightingShader::Make(sk_sp<SkShader> diffuseShader,
492 sk_sp<SkNormalSource> normalSource, 492 sk_sp<SkNormalSource> normalSource,
493 sk_sp<SkLights> lights) { 493 sk_sp<SkLights> lights) {
494 if (!diffuseShader || !normalSource) { 494 if (!diffuseShader) {
495 // TODO: Use paint's color in absence of a diffuseShader 495 // TODO: Use paint's color in absence of a diffuseShader
496 // TODO: Use a default implementation of normalSource instead
497 return nullptr; 496 return nullptr;
498 } 497 }
robertphillips 2016/07/11 19:13:21 Hmmm, don't we just want the flat guy?
dvonbeck 2016/07/13 14:23:37 This was before i wrote the flat guy. Now that I u
robertphillips 2016/07/13 14:40:22 This doesn't look like the flat guy.
dvonbeck 2016/07/13 16:09:16 Patch 5 no longer has modifications to lighting sh
499 498 if (!normalSource) {
499 normalSource = SkNormalSource::MakeBevel(SkNormalSource::BevelType::kLin ear, 0, 0);
500 }
500 return sk_make_sp<SkLightingShaderImpl>(std::move(diffuseShader), std::move( normalSource), 501 return sk_make_sp<SkLightingShaderImpl>(std::move(diffuseShader), std::move( normalSource),
501 std::move(lights)); 502 std::move(lights));
502 } 503 }
503 504
504 /////////////////////////////////////////////////////////////////////////////// 505 ///////////////////////////////////////////////////////////////////////////////
505 506
506 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) 507 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader)
507 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) 508 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl)
508 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 509 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
509 510
510 /////////////////////////////////////////////////////////////////////////////// 511 ///////////////////////////////////////////////////////////////////////////////
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698