| 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 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); | 1918 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
| 1919 } else if (kMesa_GrGLDriver == this->glContext().driver() && | 1919 } else if (kMesa_GrGLDriver == this->glContext().driver() && |
| 1920 GrBytesPerPixel(readConfig) == 4 && | 1920 GrBytesPerPixel(readConfig) == 4 && |
| 1921 GrPixelConfigSwapRAndB(readConfig) == srcConfig) { | 1921 GrPixelConfigSwapRAndB(readConfig) == srcConfig) { |
| 1922 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. | 1922 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. |
| 1923 // Better to do a draw with a R/B swap and then read as the original con
fig. | 1923 // Better to do a draw with a R/B swap and then read as the original con
fig. |
| 1924 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; | 1924 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; |
| 1925 tempDrawInfo->fSwapRAndB = true; | 1925 tempDrawInfo->fSwapRAndB = true; |
| 1926 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); | 1926 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
| 1927 } else if (readConfig == kBGRA_8888_GrPixelConfig && | 1927 } else if (readConfig == kBGRA_8888_GrPixelConfig && |
| 1928 !this->glCaps().readPixelsSupported(this->glInterface(), GR_GL_BG
RA, | 1928 !this->glCaps().readPixelsSupported(this->glInterface(), readConf
ig, srcConfig)) { |
| 1929 GR_GL_UNSIGNED_BYTE, srcConfi
g)) { | |
| 1930 tempDrawInfo->fTempSurfaceDesc.fConfig = kRGBA_8888_GrPixelConfig; | 1929 tempDrawInfo->fTempSurfaceDesc.fConfig = kRGBA_8888_GrPixelConfig; |
| 1931 tempDrawInfo->fSwapRAndB = true; | 1930 tempDrawInfo->fSwapRAndB = true; |
| 1932 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); | 1931 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
| 1933 } | 1932 } |
| 1934 | 1933 |
| 1935 GrRenderTarget* srcAsRT = srcSurface->asRenderTarget(); | 1934 GrRenderTarget* srcAsRT = srcSurface->asRenderTarget(); |
| 1936 if (!srcAsRT) { | 1935 if (!srcAsRT) { |
| 1937 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); | 1936 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
| 1938 } else if (read_pixels_pays_for_y_flip(srcAsRT, this->glCaps(), width, heigh
t, readConfig, | 1937 } else if (read_pixels_pays_for_y_flip(srcAsRT, this->glCaps(), width, heigh
t, readConfig, |
| 1939 rowBytes)) { | 1938 rowBytes)) { |
| (...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3372 this->setVertexArrayID(gpu, 0); | 3371 this->setVertexArrayID(gpu, 0); |
| 3373 } | 3372 } |
| 3374 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3373 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 3375 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3374 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 3376 fDefaultVertexArrayAttribState.resize(attrCount); | 3375 fDefaultVertexArrayAttribState.resize(attrCount); |
| 3377 } | 3376 } |
| 3378 attribState = &fDefaultVertexArrayAttribState; | 3377 attribState = &fDefaultVertexArrayAttribState; |
| 3379 } | 3378 } |
| 3380 return attribState; | 3379 return attribState; |
| 3381 } | 3380 } |
| OLD | NEW |