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 "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 if (this->glCaps().packFlipYSupport()) { | 354 if (this->glCaps().packFlipYSupport()) { |
355 GL_CALL(PixelStorei(GR_GL_PACK_REVERSE_ROW_ORDER, GR_GL_FALSE)); | 355 GL_CALL(PixelStorei(GR_GL_PACK_REVERSE_ROW_ORDER, GR_GL_FALSE)); |
356 } | 356 } |
357 } | 357 } |
358 | 358 |
359 if (resetBits & kProgram_GrGLBackendState) { | 359 if (resetBits & kProgram_GrGLBackendState) { |
360 fHWProgramID = 0; | 360 fHWProgramID = 0; |
361 } | 361 } |
362 } | 362 } |
363 | 363 |
364 namespace { | 364 static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
{ |
365 | |
366 GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) { | |
367 // By default, GrRenderTargets are GL's normal orientation so that they | 365 // By default, GrRenderTargets are GL's normal orientation so that they |
368 // can be drawn to by the outside world without the client having | 366 // can be drawn to by the outside world without the client having |
369 // to render upside down. | 367 // to render upside down. |
370 if (kDefault_GrSurfaceOrigin == origin) { | 368 if (kDefault_GrSurfaceOrigin == origin) { |
371 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; | 369 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; |
372 } else { | 370 } else { |
373 return origin; | 371 return origin; |
374 } | 372 } |
375 } | 373 } |
376 | 374 |
377 } | |
378 | |
379 GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc) { | 375 GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc) { |
380 if (!this->configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) { | 376 if (!this->configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) { |
381 return NULL; | 377 return NULL; |
382 } | 378 } |
383 | 379 |
384 if (0 == desc.fTextureHandle) { | 380 if (0 == desc.fTextureHandle) { |
385 return NULL; | 381 return NULL; |
386 } | 382 } |
387 | 383 |
388 int maxSize = this->caps()->maxTextureSize(); | 384 int maxSize = this->caps()->maxTextureSize(); |
(...skipping 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 this->setVertexArrayID(gpu, 0); | 2775 this->setVertexArrayID(gpu, 0); |
2780 } | 2776 } |
2781 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2777 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2782 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2778 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2783 fDefaultVertexArrayAttribState.resize(attrCount); | 2779 fDefaultVertexArrayAttribState.resize(attrCount); |
2784 } | 2780 } |
2785 attribState = &fDefaultVertexArrayAttribState; | 2781 attribState = &fDefaultVertexArrayAttribState; |
2786 } | 2782 } |
2787 return attribState; | 2783 return attribState; |
2788 } | 2784 } |
OLD | NEW |