| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); | 557 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
| 558 } | 558 } |
| 559 | 559 |
| 560 return true; | 560 return true; |
| 561 } | 561 } |
| 562 | 562 |
| 563 bool GrGLGpu::onWritePixels(GrSurface* surface, | 563 bool GrGLGpu::onWritePixels(GrSurface* surface, |
| 564 int left, int top, int width, int height, | 564 int left, int top, int width, int height, |
| 565 GrPixelConfig config, const void* buffer, | 565 GrPixelConfig config, const void* buffer, |
| 566 size_t rowBytes) { | 566 size_t rowBytes) { |
| 567 if (nullptr == buffer) { | |
| 568 return false; | |
| 569 } | |
| 570 | |
| 571 GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture()); | 567 GrGLTexture* glTex = static_cast<GrGLTexture*>(surface->asTexture()); |
| 572 if (!glTex) { | 568 if (!glTex) { |
| 573 return false; | 569 return false; |
| 574 } | 570 } |
| 575 | 571 |
| 576 // OpenGL doesn't do sRGB <-> linear conversions when reading and writing pi
xels. | 572 // OpenGL doesn't do sRGB <-> linear conversions when reading and writing pi
xels. |
| 577 if (GrPixelConfigIsSRGB(surface->config()) != GrPixelConfigIsSRGB(config)) { | 573 if (GrPixelConfigIsSRGB(surface->config()) != GrPixelConfigIsSRGB(config)) { |
| 578 return false; | 574 return false; |
| 579 } | 575 } |
| 580 | 576 |
| (...skipping 2610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3191 this->setVertexArrayID(gpu, 0); | 3187 this->setVertexArrayID(gpu, 0); |
| 3192 } | 3188 } |
| 3193 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3189 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 3194 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3190 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 3195 fDefaultVertexArrayAttribState.resize(attrCount); | 3191 fDefaultVertexArrayAttribState.resize(attrCount); |
| 3196 } | 3192 } |
| 3197 attribState = &fDefaultVertexArrayAttribState; | 3193 attribState = &fDefaultVertexArrayAttribState; |
| 3198 } | 3194 } |
| 3199 return attribState; | 3195 return attribState; |
| 3200 } | 3196 } |
| OLD | NEW |