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