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 #include "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
9 | 9 |
10 #include "../private/GrGLSL.h" | 10 #include "../private/GrGLSL.h" |
(...skipping 3987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3998 GrGLfloat dy1 = 2.f * (dstPoint.fY + h) / dh - 1.f; | 3998 GrGLfloat dy1 = 2.f * (dstPoint.fY + h) / dh - 1.f; |
3999 if (kBottomLeft_GrSurfaceOrigin == dst->origin()) { | 3999 if (kBottomLeft_GrSurfaceOrigin == dst->origin()) { |
4000 dy0 = -dy0; | 4000 dy0 = -dy0; |
4001 dy1 = -dy1; | 4001 dy1 = -dy1; |
4002 } | 4002 } |
4003 | 4003 |
4004 GrGLfloat sx0 = (GrGLfloat)srcRect.fLeft; | 4004 GrGLfloat sx0 = (GrGLfloat)srcRect.fLeft; |
4005 GrGLfloat sx1 = (GrGLfloat)(srcRect.fLeft + w); | 4005 GrGLfloat sx1 = (GrGLfloat)(srcRect.fLeft + w); |
4006 GrGLfloat sy0 = (GrGLfloat)srcRect.fTop; | 4006 GrGLfloat sy0 = (GrGLfloat)srcRect.fTop; |
4007 GrGLfloat sy1 = (GrGLfloat)(srcRect.fTop + h); | 4007 GrGLfloat sy1 = (GrGLfloat)(srcRect.fTop + h); |
| 4008 int sw = src->width(); |
4008 int sh = src->height(); | 4009 int sh = src->height(); |
4009 if (kBottomLeft_GrSurfaceOrigin == src->origin()) { | 4010 if (kBottomLeft_GrSurfaceOrigin == src->origin()) { |
4010 sy0 = sh - sy0; | 4011 sy0 = sh - sy0; |
4011 sy1 = sh - sy1; | 4012 sy1 = sh - sy1; |
4012 } | 4013 } |
4013 // src rect edges in normalized texture space (0 to 1) unless we're using a
RECTANGLE texture. | 4014 // src rect edges in normalized texture space (0 to 1) |
4014 GrGLenum srcTarget = srcTex->target(); | 4015 sx0 /= sw; |
4015 if (GR_GL_TEXTURE_RECTANGLE != srcTarget) { | 4016 sx1 /= sw; |
4016 int sw = src->width(); | 4017 sy0 /= sh; |
4017 sx0 /= sw; | 4018 sy1 /= sh; |
4018 sx1 /= sw; | |
4019 sy0 /= sh; | |
4020 sy1 /= sh; | |
4021 } | |
4022 | 4019 |
4023 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fPosXformUniform, dx1 - dx0, dy1 -
dy0, dx0, dy0)); | 4020 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fPosXformUniform, dx1 - dx0, dy1 -
dy0, dx0, dy0)); |
4024 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fTexCoordXformUniform, | 4021 GL_CALL(Uniform4f(fCopyPrograms[progIdx].fTexCoordXformUniform, |
4025 sx1 - sx0, sy1 - sy0, sx0, sy0)); | 4022 sx1 - sx0, sy1 - sy0, sx0, sy0)); |
4026 GL_CALL(Uniform1i(fCopyPrograms[progIdx].fTextureUniform, 0)); | 4023 GL_CALL(Uniform1i(fCopyPrograms[progIdx].fTextureUniform, 0)); |
4027 | 4024 |
4028 GrXferProcessor::BlendInfo blendInfo; | 4025 GrXferProcessor::BlendInfo blendInfo; |
4029 blendInfo.reset(); | 4026 blendInfo.reset(); |
4030 this->flushBlend(blendInfo, GrSwizzle::RGBA()); | 4027 this->flushBlend(blendInfo, GrSwizzle::RGBA()); |
4031 this->flushColorWrite(true); | 4028 this->flushColorWrite(true); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4495 GL_CALL(WaitSync(glSem->sync(), 0, GR_GL_TIMEOUT_IGNORED)); | 4492 GL_CALL(WaitSync(glSem->sync(), 0, GR_GL_TIMEOUT_IGNORED)); |
4496 } | 4493 } |
4497 | 4494 |
4498 void GrGLGpu::deleteSync(GrGLsync sync) const { | 4495 void GrGLGpu::deleteSync(GrGLsync sync) const { |
4499 GL_CALL(DeleteSync(sync)); | 4496 GL_CALL(DeleteSync(sync)); |
4500 } | 4497 } |
4501 | 4498 |
4502 void GrGLGpu::flush() { | 4499 void GrGLGpu::flush() { |
4503 GL_CALL(Flush()); | 4500 GL_CALL(Flush()); |
4504 } | 4501 } |
OLD | NEW |