| OLD | NEW |
| 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 "GrXferProcessor.h" | 8 #include "GrXferProcessor.h" |
| 9 #include "gl/GrGLCaps.h" | 9 #include "gl/GrGLCaps.h" |
| 10 | 10 |
| 11 GrXferProcessor::GrXferProcessor() : fWillReadDstColor(false), fDstCopyTextureOf
fset() { | 11 GrXferProcessor::GrXferProcessor() : fWillReadDstColor(false), fDstCopyTextureOf
fset() { |
| 12 } | 12 } |
| 13 | 13 |
| 14 GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willR
eadDstColor) | 14 GrXferProcessor::GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willR
eadDstColor) |
| 15 : fWillReadDstColor(willReadDstColor) | 15 : fWillReadDstColor(willReadDstColor) |
| 16 , fDstCopyTextureOffset() { | 16 , fDstCopyTextureOffset() { |
| 17 if (dstCopy && dstCopy->texture()) { | 17 if (dstCopy && dstCopy->texture()) { |
| 18 fDstCopy.reset(dstCopy->texture()); | 18 fDstCopy.reset(dstCopy->texture()); |
| 19 fDstCopyTextureOffset = dstCopy->offset(); | 19 fDstCopyTextureOffset = dstCopy->offset(); |
| 20 this->addTextureAccess(&fDstCopy); | 20 this->addTextureAccess(&fDstCopy); |
| 21 this->setWillReadFragmentPosition(); | 21 this->setWillReadFragmentPosition(); |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 | 24 |
| 25 void GrXferProcessor::getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuil
der* b) const { | 25 void GrXferProcessor::getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBu
ilder* b) const { |
| 26 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; | 26 uint32_t key = this->willReadDstColor() ? 0x1 : 0x0; |
| 27 if (this->getDstCopyTexture() && | 27 if (this->getDstCopyTexture() && |
| 28 kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) { | 28 kTopLeft_GrSurfaceOrigin == this->getDstCopyTexture()->origin()) { |
| 29 key |= 0x2; | 29 key |= 0x2; |
| 30 } | 30 } |
| 31 b->add32(key); | 31 b->add32(key); |
| 32 this->onGetGLProcessorKey(caps, b); | 32 this->onGetGLProcessorKey(caps, b); |
| 33 } | 33 } |
| 34 | 34 |
| 35 /////////////////////////////////////////////////////////////////////////////// | 35 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 } | 50 } |
| 51 #endif | 51 #endif |
| 52 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); | 52 return this->onCreateXferProcessor(caps, colorPOI, coveragePOI, dstCopy); |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI
nfo& colorPOI, | 55 bool GrXPFactory::willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptI
nfo& colorPOI, |
| 56 const GrProcOptInfo& coveragePOI) const { | 56 const GrProcOptInfo& coveragePOI) const { |
| 57 return (this->willReadDstColor(caps, colorPOI, coveragePOI) && !caps.dstRead
InShaderSupport()); | 57 return (this->willReadDstColor(caps, colorPOI, coveragePOI) && !caps.dstRead
InShaderSupport()); |
| 58 } | 58 } |
| 59 | 59 |
| OLD | NEW |