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

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

Issue 1720933002: Add ContextRec param to SkShader::contextSize() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: ContextRec plumbing only Created 4 years, 10 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
« no previous file with comments | « src/core/SkEmptyShader.h ('k') | src/core/SkLocalMatrixShader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 bool isOpaque() const override; 73 bool isOpaque() const override;
74 74
75 #if SK_SUPPORT_GPU 75 #if SK_SUPPORT_GPU
76 const GrFragmentProcessor* asFragmentProcessor(GrContext*, 76 const GrFragmentProcessor* asFragmentProcessor(GrContext*,
77 const SkMatrix& viewM, 77 const SkMatrix& viewM,
78 const SkMatrix* localMatrix, 78 const SkMatrix* localMatrix,
79 SkFilterQuality) const overri de; 79 SkFilterQuality) const overri de;
80 #endif 80 #endif
81 81
82 size_t contextSize() const override; 82 size_t contextSize(const ContextRec&) const override;
83 83
84 class LightingShaderContext : public SkShader::Context { 84 class LightingShaderContext : public SkShader::Context {
85 public: 85 public:
86 // The context takes ownership of the states. It will call their destruc tors 86 // The context takes ownership of the states. It will call their destruc tors
87 // but will NOT free the memory. 87 // but will NOT free the memory.
88 LightingShaderContext(const SkLightingShaderImpl&, const ContextRec&, 88 LightingShaderContext(const SkLightingShaderImpl&, const ContextRec&,
89 SkBitmapProcState* diffuseState, SkBitmapProcState * normalState); 89 SkBitmapProcState* diffuseState, SkBitmapProcState * normalState);
90 ~LightingShaderContext() override; 90 ~LightingShaderContext() override;
91 91
92 void shadeSpan(int x, int y, SkPMColor[], int count) override; 92 void shadeSpan(int x, int y, SkPMColor[], int count) override;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 409 }
410 410
411 #endif 411 #endif
412 412
413 //////////////////////////////////////////////////////////////////////////// 413 ////////////////////////////////////////////////////////////////////////////
414 414
415 bool SkLightingShaderImpl::isOpaque() const { 415 bool SkLightingShaderImpl::isOpaque() const {
416 return fDiffuseMap.isOpaque(); 416 return fDiffuseMap.isOpaque();
417 } 417 }
418 418
419 size_t SkLightingShaderImpl::contextSize() const { 419 size_t SkLightingShaderImpl::contextSize(const ContextRec&) const {
420 return 2 * sizeof(SkBitmapProcState) + sizeof(LightingShaderContext); 420 return 2 * sizeof(SkBitmapProcState) + sizeof(LightingShaderContext);
421 } 421 }
422 422
423 SkLightingShaderImpl::LightingShaderContext::LightingShaderContext(const SkLight ingShaderImpl& shader, 423 SkLightingShaderImpl::LightingShaderContext::LightingShaderContext(const SkLight ingShaderImpl& shader,
424 const Context Rec& rec, 424 const Context Rec& rec,
425 SkBitmapProcS tate* diffuseState, 425 SkBitmapProcS tate* diffuseState,
426 SkBitmapProcS tate* normalState) 426 SkBitmapProcS tate* normalState)
427 : INHERITED(shader, rec) 427 : INHERITED(shader, rec)
428 , fDiffuseState(diffuseState) 428 , fDiffuseState(diffuseState)
429 , fNormalState(normalState) 429 , fNormalState(normalState)
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 normLocalM); 718 normLocalM);
719 } 719 }
720 720
721 /////////////////////////////////////////////////////////////////////////////// 721 ///////////////////////////////////////////////////////////////////////////////
722 722
723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader) 723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingShader)
724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl) 724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLightingShaderImpl)
725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
726 726
727 /////////////////////////////////////////////////////////////////////////////// 727 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkEmptyShader.h ('k') | src/core/SkLocalMatrixShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698