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 "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
(...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2421 srcGLRect.fLeft, srcGLRect.fBottom, | 2421 srcGLRect.fLeft, srcGLRect.fBottom, |
2422 srcGLRect.fWidth, srcGLRect.fHeight)); | 2422 srcGLRect.fWidth, srcGLRect.fHeight)); |
2423 copied = true; | 2423 copied = true; |
2424 if (srcFBO) { | 2424 if (srcFBO) { |
2425 GL_CALL(DeleteFramebuffers(1, &srcFBO)); | 2425 GL_CALL(DeleteFramebuffers(1, &srcFBO)); |
2426 } | 2426 } |
2427 } else if (can_blit_framebuffer(dst, src, this)) { | 2427 } else if (can_blit_framebuffer(dst, src, this)) { |
2428 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, | 2428 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, |
2429 srcRect.width(), srcRect.height()); | 2429 srcRect.width(), srcRect.height()); |
2430 bool selfOverlap = false; | 2430 bool selfOverlap = false; |
2431 if (dst->surfacePriv().isSameAs(src)) { | 2431 if (dst == src) { |
2432 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect); | 2432 selfOverlap = SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect); |
2433 } | 2433 } |
2434 | 2434 |
2435 if (!selfOverlap) { | 2435 if (!selfOverlap) { |
2436 GrGLuint dstFBO; | 2436 GrGLuint dstFBO; |
2437 GrGLuint srcFBO; | 2437 GrGLuint srcFBO; |
2438 GrGLIRect dstVP; | 2438 GrGLIRect dstVP; |
2439 GrGLIRect srcVP; | 2439 GrGLIRect srcVP; |
2440 dstFBO = this->bindSurfaceAsFBO(dst, GR_GL_DRAW_FRAMEBUFFER, &dstVP)
; | 2440 dstFBO = this->bindSurfaceAsFBO(dst, GR_GL_DRAW_FRAMEBUFFER, &dstVP)
; |
2441 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_READ_FRAMEBUFFER, &srcVP)
; | 2441 srcFBO = this->bindSurfaceAsFBO(src, GR_GL_READ_FRAMEBUFFER, &srcVP)
; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2495 const SkIRect& srcRect, | 2495 const SkIRect& srcRect, |
2496 const SkIPoint& dstPoint) { | 2496 const SkIPoint& dstPoint) { |
2497 // This mirrors the logic in onCopySurface. We prefer our base makes the co
py if we need to | 2497 // This mirrors the logic in onCopySurface. We prefer our base makes the co
py if we need to |
2498 // create a temp fbo | 2498 // create a temp fbo |
2499 // TODO verify this assumption, it may not be true at all | 2499 // TODO verify this assumption, it may not be true at all |
2500 bool wouldNeedTempFBO = false; | 2500 bool wouldNeedTempFBO = false; |
2501 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem
pFBO) { | 2501 if (can_copy_texsubimage(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem
pFBO) { |
2502 return true; | 2502 return true; |
2503 } | 2503 } |
2504 if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem
pFBO) { | 2504 if (can_blit_framebuffer(dst, src, this, &wouldNeedTempFBO) && !wouldNeedTem
pFBO) { |
2505 if (dst->surfacePriv().isSameAs(src)) { | 2505 if (dst == src) { |
2506 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, | 2506 SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX, dstPoint.fY, |
2507 srcRect.width(), srcRect.height(
)); | 2507 srcRect.width(), srcRect.height(
)); |
2508 if(!SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect)) { | 2508 if(!SkIRect::IntersectsNoEmptyCheck(dstRect, srcRect)) { |
2509 return true; | 2509 return true; |
2510 } | 2510 } |
2511 } else { | 2511 } else { |
2512 return true; | 2512 return true; |
2513 } | 2513 } |
2514 } | 2514 } |
2515 return false; | 2515 return false; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 this->setVertexArrayID(gpu, 0); | 2555 this->setVertexArrayID(gpu, 0); |
2556 } | 2556 } |
2557 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2557 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2558 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2558 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2559 fDefaultVertexArrayAttribState.resize(attrCount); | 2559 fDefaultVertexArrayAttribState.resize(attrCount); |
2560 } | 2560 } |
2561 attribState = &fDefaultVertexArrayAttribState; | 2561 attribState = &fDefaultVertexArrayAttribState; |
2562 } | 2562 } |
2563 return attribState; | 2563 return attribState; |
2564 } | 2564 } |
OLD | NEW |