OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrGLProgramDesc.h" | 8 #include "GrGLProgramDesc.h" |
9 #include "GrBackendEffectFactory.h" | 9 #include "GrBackendEffectFactory.h" |
10 #include "GrDrawEffect.h" | 10 #include "GrDrawEffect.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 (skipCoverage ? 0 : (drawState.numCoverageStages() - firstE
ffectiveCoverageStage)); | 98 (skipCoverage ? 0 : (drawState.numCoverageStages() - firstE
ffectiveCoverageStage)); |
99 | 99 |
100 size_t newKeyLength = KeyLength(numEffects); | 100 size_t newKeyLength = KeyLength(numEffects); |
101 bool allocChanged; | 101 bool allocChanged; |
102 desc->fKey.reset(newKeyLength, SkAutoMalloc::kAlloc_OnShrink, &allocChanged)
; | 102 desc->fKey.reset(newKeyLength, SkAutoMalloc::kAlloc_OnShrink, &allocChanged)
; |
103 if (allocChanged || !desc->fInitialized) { | 103 if (allocChanged || !desc->fInitialized) { |
104 // make sure any padding in the header is zero if we we haven't used thi
s allocation before. | 104 // make sure any padding in the header is zero if we we haven't used thi
s allocation before. |
105 memset(desc->header(), 0, kHeaderSize); | 105 memset(desc->header(), 0, kHeaderSize); |
106 } | 106 } |
107 // write the key length | 107 // write the key length |
108 *desc->atOffset<uint32_t, kLengthOffset>() = newKeyLength; | 108 *desc->atOffset<uint32_t, kLengthOffset>() = SkToU32(newKeyLength); |
109 | 109 |
110 KeyHeader* header = desc->header(); | 110 KeyHeader* header = desc->header(); |
111 EffectKey* effectKeys = desc->effectKeys(); | 111 EffectKey* effectKeys = desc->effectKeys(); |
112 | 112 |
113 int currEffectKey = 0; | 113 int currEffectKey = 0; |
114 bool readsDst = false; | 114 bool readsDst = false; |
115 bool readFragPosition = false; | 115 bool readFragPosition = false; |
116 bool hasVertexCode = false; | 116 bool hasVertexCode = false; |
117 if (!skipColor) { | 117 if (!skipColor) { |
118 for (int s = firstEffectiveColorStage; s < drawState.numColorStages(); +
+s) { | 118 for (int s = firstEffectiveColorStage; s < drawState.numColorStages(); +
+s) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { | 281 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { |
282 fInitialized = other.fInitialized; | 282 fInitialized = other.fInitialized; |
283 if (fInitialized) { | 283 if (fInitialized) { |
284 size_t keyLength = other.keyLength(); | 284 size_t keyLength = other.keyLength(); |
285 fKey.reset(keyLength); | 285 fKey.reset(keyLength); |
286 memcpy(fKey.get(), other.fKey.get(), keyLength); | 286 memcpy(fKey.get(), other.fKey.get(), keyLength); |
287 } | 287 } |
288 return *this; | 288 return *this; |
289 } | 289 } |
OLD | NEW |