| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrRODrawState.h" | 8 #include "GrRODrawState.h" |
| 9 | 9 |
| 10 #include "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
| 11 #include "GrRenderTarget.h" | 11 #include "GrRenderTarget.h" |
| 12 | 12 |
| 13 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
| 14 | 14 |
| 15 GrRODrawState::GrRODrawState(const GrRODrawState& drawState) : INHERITED() { | 15 GrRODrawState::GrRODrawState(const GrRODrawState& drawState) : INHERITED() { |
| 16 fRenderTarget.setResource(SkSafeRef(drawState.fRenderTarget.getResource()), | 16 fRenderTarget.setResource(SkSafeRef(drawState.fRenderTarget.getResource()), |
| 17 GrGpuResourceRef::kWrite_IOType); | 17 GrIORef::kWrite_IOType); |
| 18 } | 18 } |
| 19 | 19 |
| 20 bool GrRODrawState::isEqual(const GrRODrawState& that) const { | 20 bool GrRODrawState::isEqual(const GrRODrawState& that) const { |
| 21 bool usingVertexColors = this->hasColorVertexAttribute(); | 21 bool usingVertexColors = this->hasColorVertexAttribute(); |
| 22 if (!usingVertexColors && this->fColor != that.fColor) { | 22 if (!usingVertexColors && this->fColor != that.fColor) { |
| 23 return false; | 23 return false; |
| 24 } | 24 } |
| 25 | 25 |
| 26 if (this->getRenderTarget() != that.getRenderTarget() || | 26 if (this->getRenderTarget() != that.getRenderTarget() || |
| 27 this->fColorStages.count() != that.fColorStages.count() || | 27 this->fColorStages.count() != that.fColorStages.count() || |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // Since the shader will multiply coverage and color, the only way the f
inal A==1 is if | 346 // Since the shader will multiply coverage and color, the only way the f
inal A==1 is if |
| 347 // coverage and color both have A==1. | 347 // coverage and color both have A==1. |
| 348 return (kA_GrColorComponentFlag & validComponentFlags & coverageComponen
tFlags) && | 348 return (kA_GrColorComponentFlag & validComponentFlags & coverageComponen
tFlags) && |
| 349 0xFF == GrColorUnpackA(color) && 0xFF == GrColorUnpackA(coverage
); | 349 0xFF == GrColorUnpackA(color) && 0xFF == GrColorUnpackA(coverage
); |
| 350 | 350 |
| 351 } | 351 } |
| 352 | 352 |
| 353 return (kA_GrColorComponentFlag & validComponentFlags) && 0xFF == GrColorUnp
ackA(color); | 353 return (kA_GrColorComponentFlag & validComponentFlags) && 0xFF == GrColorUnp
ackA(color); |
| 354 } | 354 } |
| 355 | 355 |
| OLD | NEW |