OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
9 #include "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
10 #include "GrGLGLSL.h" | 10 #include "GrGLGLSL.h" |
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 width >= this->caps()->minTextureSize() && | 1765 width >= this->caps()->minTextureSize() && |
1766 height >= this->caps()->minTextureSize(); | 1766 height >= this->caps()->minTextureSize(); |
1767 | 1767 |
1768 // Start off assuming that any temp draw should be to the readConfig, then c
heck if that will | 1768 // Start off assuming that any temp draw should be to the readConfig, then c
heck if that will |
1769 // be inefficient. | 1769 // be inefficient. |
1770 GrPixelConfig srcConfig = srcSurface->config(); | 1770 GrPixelConfig srcConfig = srcSurface->config(); |
1771 tempDrawInfo->fTempSurfaceDesc.fConfig = readConfig; | 1771 tempDrawInfo->fTempSurfaceDesc.fConfig = readConfig; |
1772 | 1772 |
1773 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { | 1773 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { |
1774 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; | 1774 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; |
| 1775 tempDrawInfo->fSwapRAndB = true; |
| 1776 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
1775 } else if (kMesa_GrGLDriver == this->glContext().driver() && | 1777 } else if (kMesa_GrGLDriver == this->glContext().driver() && |
1776 GrBytesPerPixel(readConfig) == 4 && | 1778 GrBytesPerPixel(readConfig) == 4 && |
1777 GrPixelConfigSwapRAndB(readConfig) == srcConfig) { | 1779 GrPixelConfigSwapRAndB(readConfig) == srcConfig) { |
1778 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. | 1780 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. |
1779 // Better to do a draw with a R/B swap and then read as the original con
fig. | 1781 // Better to do a draw with a R/B swap and then read as the original con
fig. |
1780 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; | 1782 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; |
1781 tempDrawInfo->fSwapRAndB = true; | 1783 tempDrawInfo->fSwapRAndB = true; |
1782 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); | 1784 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
1783 } else if (readConfig == kBGRA_8888_GrPixelConfig && | 1785 } else if (readConfig == kBGRA_8888_GrPixelConfig && |
1784 !this->glCaps().readPixelsSupported(this->glInterface(), GR_GL_BG
RA, | 1786 !this->glCaps().readPixelsSupported(this->glInterface(), GR_GL_BG
RA, |
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3210 this->setVertexArrayID(gpu, 0); | 3212 this->setVertexArrayID(gpu, 0); |
3211 } | 3213 } |
3212 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3214 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3213 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3215 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3214 fDefaultVertexArrayAttribState.resize(attrCount); | 3216 fDefaultVertexArrayAttribState.resize(attrCount); |
3215 } | 3217 } |
3216 attribState = &fDefaultVertexArrayAttribState; | 3218 attribState = &fDefaultVertexArrayAttribState; |
3217 } | 3219 } |
3218 return attribState; | 3220 return attribState; |
3219 } | 3221 } |
OLD | NEW |