| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/gl_renderer.h" | 5 #include "cc/gl_renderer.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include <public/WebGraphicsContext3D.h> | 36 #include <public/WebGraphicsContext3D.h> |
| 37 #include <public/WebSharedGraphicsContext3D.h> | 37 #include <public/WebSharedGraphicsContext3D.h> |
| 38 #include <set> | 38 #include <set> |
| 39 #include <string> | 39 #include <string> |
| 40 #include <vector> | 40 #include <vector> |
| 41 | 41 |
| 42 using namespace std; | 42 using namespace std; |
| 43 using WebKit::WebGraphicsContext3D; | 43 using WebKit::WebGraphicsContext3D; |
| 44 using WebKit::WebGraphicsMemoryAllocation; | 44 using WebKit::WebGraphicsMemoryAllocation; |
| 45 using WebKit::WebSharedGraphicsContext3D; | 45 using WebKit::WebSharedGraphicsContext3D; |
| 46 using WebKit::WebTransformationMatrix; | 46 using gfx::Transform; |
| 47 | 47 |
| 48 namespace cc { | 48 namespace cc { |
| 49 | 49 |
| 50 namespace { | 50 namespace { |
| 51 | 51 |
| 52 bool needsIOSurfaceReadbackWorkaround() | 52 bool needsIOSurfaceReadbackWorkaround() |
| 53 { | 53 { |
| 54 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 55 return true; | 55 return true; |
| 56 #else | 56 #else |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde
rDrawQuad* quad) | 323 void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde
rDrawQuad* quad) |
| 324 { | 324 { |
| 325 static float glMatrix[16]; | 325 static float glMatrix[16]; |
| 326 const SolidColorProgram* program = solidColorProgram(); | 326 const SolidColorProgram* program = solidColorProgram(); |
| 327 DCHECK(program && (program->initialized() || isContextLost())); | 327 DCHECK(program && (program->initialized() || isContextLost())); |
| 328 GLC(context(), context()->useProgram(program->program())); | 328 GLC(context(), context()->useProgram(program->program())); |
| 329 | 329 |
| 330 // Use the full quadRect for debug quads to not move the edges based on part
ial swaps. | 330 // Use the full quadRect for debug quads to not move the edges based on part
ial swaps. |
| 331 const gfx::Rect& layerRect = quad->rect; | 331 const gfx::Rect& layerRect = quad->rect; |
| 332 WebTransformationMatrix renderMatrix = quad->quadTransform(); | 332 Transform renderMatrix = quad->quadTransform(); |
| 333 renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerR
ect.height() + layerRect.y()); | 333 renderMatrix.PreconcatTranslate(0.5 * layerRect.width() + layerRect.x(), 0.5
* layerRect.height() + layerRect.y()); |
| 334 renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); | 334 renderMatrix.PreconcatScale(layerRect.width(), layerRect.height()); |
| 335 GLRenderer::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); | 335 GLRenderer::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); |
| 336 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc
ation(), 1, false, &glMatrix[0])); | 336 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc
ation(), 1, false, &glMatrix[0])); |
| 337 | 337 |
| 338 SkColor color = quad->color; | 338 SkColor color = quad->color; |
| 339 float alpha = SkColorGetA(color) / 255.0; | 339 float alpha = SkColorGetA(color) / 255.0; |
| 340 | 340 |
| 341 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (
SkColorGetB(color) / 255.0) * alpha, alpha)); | 341 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(
), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (
SkColorGetB(color) / 255.0) * alpha, alpha)); |
| 342 | 342 |
| 343 GLC(context(), context()->lineWidth(quad->width)); | 343 GLC(context(), context()->lineWidth(quad->width)); |
| 344 | 344 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 canvas.clear(0x0); | 428 canvas.clear(0x0); |
| 429 canvas.drawSprite(source, 0, 0, &paint); | 429 canvas.drawSprite(source, 0, 0, &paint); |
| 430 canvas.flush(); | 430 canvas.flush(); |
| 431 context3d->flush(); | 431 context3d->flush(); |
| 432 return device.accessBitmap(false); | 432 return device.accessBitmap(false); |
| 433 } | 433 } |
| 434 | 434 |
| 435 scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters( | 435 scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters( |
| 436 DrawingFrame& frame, const RenderPassDrawQuad* quad, | 436 DrawingFrame& frame, const RenderPassDrawQuad* quad, |
| 437 const WebKit::WebFilterOperations& filters, | 437 const WebKit::WebFilterOperations& filters, |
| 438 const WebTransformationMatrix& contentsDeviceTransform, | 438 const Transform& contentsDeviceTransform, |
| 439 const WebTransformationMatrix& contentsDeviceTransformInverse) | 439 const Transform& contentsDeviceTransformInverse) |
| 440 { | 440 { |
| 441 // This method draws a background filter, which applies a filter to any pixe
ls behind the quad and seen through its background. | 441 // This method draws a background filter, which applies a filter to any pixe
ls behind the quad and seen through its background. |
| 442 // The algorithm works as follows: | 442 // The algorithm works as follows: |
| 443 // 1. Compute a bounding box around the pixels that will be visible through
the quad. | 443 // 1. Compute a bounding box around the pixels that will be visible through
the quad. |
| 444 // 2. Read the pixels in the bounding box into a buffer R. | 444 // 2. Read the pixels in the bounding box into a buffer R. |
| 445 // 3. Apply the background filter to R, so that it is applied in the pixels'
coordinate space. | 445 // 3. Apply the background filter to R, so that it is applied in the pixels'
coordinate space. |
| 446 // 4. Apply the quad's inverse transform to map the pixels in R into the qua
d's content space. This implicitly | 446 // 4. Apply the quad's inverse transform to map the pixels in R into the qua
d's content space. This implicitly |
| 447 // clips R by the content bounds of the quad since the destination texture h
as bounds matching the quad's content. | 447 // clips R by the content bounds of the quad since the destination texture h
as bounds matching the quad's content. |
| 448 // 5. Draw the background texture for the contents using the same transform
as used to draw the contents itself. This is done | 448 // 5. Draw the background texture for the contents using the same transform
as used to draw the contents itself. This is done |
| 449 // without blending to replace the current background pixels with the new fi
ltered background. | 449 // without blending to replace the current background pixels with the new fi
ltered background. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso
urceProvider); | 486 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso
urceProvider); |
| 487 if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect.size(), GL_R
GBA, ResourceProvider::TextureUsageFramebuffer)) | 487 if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect.size(), GL_R
GBA, ResourceProvider::TextureUsageFramebuffer)) |
| 488 return scoped_ptr<ScopedResource>(); | 488 return scoped_ptr<ScopedResource>(); |
| 489 | 489 |
| 490 const RenderPass* targetRenderPass = frame.currentRenderPass; | 490 const RenderPass* targetRenderPass = frame.currentRenderPass; |
| 491 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->rect); | 491 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(
), quad->rect); |
| 492 | 492 |
| 493 if (usingBackgroundTexture) { | 493 if (usingBackgroundTexture) { |
| 494 // Copy the readback pixels from device to the background texture for th
e surface. | 494 // Copy the readback pixels from device to the background texture for th
e surface. |
| 495 WebTransformationMatrix deviceToFramebufferTransform; | 495 Transform deviceToFramebufferTransform; |
| 496 deviceToFramebufferTransform.translate(quad->rect.width() / 2.0, quad->r
ect.height() / 2.0); | 496 deviceToFramebufferTransform.PreconcatTranslate(quad->rect.width() / 2.0
, quad->rect.height() / 2.0); |
| 497 deviceToFramebufferTransform.scale3d(quad->rect.width(), quad->rect.heig
ht(), 1); | 497 deviceToFramebufferTransform.PreconcatScale3d(quad->rect.width(), quad->
rect.height(), 1); |
| 498 deviceToFramebufferTransform.multiply(contentsDeviceTransformInverse); | 498 deviceToFramebufferTransform.PreconcatTransform(contentsDeviceTransformI
nverse); |
| 499 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic
eRect, deviceToFramebufferTransform); | 499 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic
eRect, deviceToFramebufferTransform); |
| 500 } | 500 } |
| 501 | 501 |
| 502 useRenderPass(frame, targetRenderPass); | 502 useRenderPass(frame, targetRenderPass); |
| 503 | 503 |
| 504 if (!usingBackgroundTexture) | 504 if (!usingBackgroundTexture) |
| 505 return scoped_ptr<ScopedResource>(); | 505 return scoped_ptr<ScopedResource>(); |
| 506 return backgroundTexture.Pass(); | 506 return backgroundTexture.Pass(); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
d* quad) | 509 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
d* quad) |
| 510 { | 510 { |
| 511 CachedResource* contentsTexture = m_renderPassTextures.get(quad->render_pass
_id); | 511 CachedResource* contentsTexture = m_renderPassTextures.get(quad->render_pass
_id); |
| 512 if (!contentsTexture || !contentsTexture->id()) | 512 if (!contentsTexture || !contentsTexture->id()) |
| 513 return; | 513 return; |
| 514 | 514 |
| 515 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass
_id); | 515 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass
_id); |
| 516 DCHECK(renderPass); | 516 DCHECK(renderPass); |
| 517 if (!renderPass) | 517 if (!renderPass) |
| 518 return; | 518 return; |
| 519 | 519 |
| 520 WebTransformationMatrix quadRectMatrix; | 520 Transform quadRectMatrix; |
| 521 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect); | 521 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect); |
| 522 WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * fram
e.projectionMatrix * quadRectMatrix).to2dTransform(); | 522 Transform contentsDeviceTransform = MathUtil::to2dTransform(frame.windowMatr
ix * frame.projectionMatrix * quadRectMatrix); |
| 523 | 523 |
| 524 // Can only draw surface if device matrix is invertible. | 524 // Can only draw surface if device matrix is invertible. |
| 525 if (!contentsDeviceTransform.isInvertible()) | 525 if (!contentsDeviceTransform.IsInvertible()) |
| 526 return; | 526 return; |
| 527 | 527 |
| 528 WebTransformationMatrix contentsDeviceTransformInverse = contentsDeviceTrans
form.inverse(); | 528 Transform contentsDeviceTransformInverse = MathUtil::inverse(contentsDeviceT
ransform); |
| 529 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( | 529 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( |
| 530 frame, quad, renderPass->background_filters, | 530 frame, quad, renderPass->background_filters, |
| 531 contentsDeviceTransform, contentsDeviceTransformInverse); | 531 contentsDeviceTransform, contentsDeviceTransformInverse); |
| 532 | 532 |
| 533 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. | 533 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. |
| 534 // Apply filters to the contents texture. | 534 // Apply filters to the contents texture. |
| 535 SkBitmap filterBitmap; | 535 SkBitmap filterBitmap; |
| 536 if (renderPass->filter) { | 536 if (renderPass->filter) { |
| 537 filterBitmap = applyImageFilter(this, renderPass->filter, contentsTextur
e, m_client->hasImplThread()); | 537 filterBitmap = applyImageFilter(this, renderPass->filter, contentsTextur
e, m_client->hasImplThread()); |
| 538 } else { | 538 } else { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 742 |
| 743 // Map to normalized texture coordinates. | 743 // Map to normalized texture coordinates. |
| 744 const gfx::Size& textureSize = quad->texture_size; | 744 const gfx::Size& textureSize = quad->texture_size; |
| 745 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width(); | 745 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width(); |
| 746 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height(); | 746 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height(); |
| 747 float fragmentTexScaleX = clampTexRect.width() / textureSize.width(); | 747 float fragmentTexScaleX = clampTexRect.width() / textureSize.width(); |
| 748 float fragmentTexScaleY = clampTexRect.height() / textureSize.height(); | 748 float fragmentTexScaleY = clampTexRect.height() / textureSize.height(); |
| 749 | 749 |
| 750 | 750 |
| 751 gfx::QuadF localQuad; | 751 gfx::QuadF localQuad; |
| 752 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind
owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform(); | 752 Transform deviceTransform = MathUtil::to2dTransform(frame.windowMatrix * fra
me.projectionMatrix * quad->quadTransform()); |
| 753 if (!deviceTransform.isInvertible()) | 753 if (!deviceTransform.IsInvertible()) |
| 754 return; | 754 return; |
| 755 | 755 |
| 756 bool clipped = false; | 756 bool clipped = false; |
| 757 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q
uad->visibleContentRect()), clipped); | 757 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q
uad->visibleContentRect()), clipped); |
| 758 DCHECK(!clipped); | 758 DCHECK(!clipped); |
| 759 | 759 |
| 760 TileProgramUniforms uniforms; | 760 TileProgramUniforms uniforms; |
| 761 // For now, we simply skip anti-aliasing with the quad is clipped. This only
happens | 761 // For now, we simply skip anti-aliasing with the quad is clipped. This only
happens |
| 762 // on perspective transformed layers that go partially behind the camera. | 762 // on perspective transformed layers that go partially behind the camera. |
| 763 if (quad->IsAntialiased() && !clipped) { | 763 if (quad->IsAntialiased() && !clipped) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1; | 833 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1; |
| 834 bottomEdge.scale(sign); | 834 bottomEdge.scale(sign); |
| 835 leftEdge.scale(sign); | 835 leftEdge.scale(sign); |
| 836 topEdge.scale(sign); | 836 topEdge.scale(sign); |
| 837 rightEdge.scale(sign); | 837 rightEdge.scale(sign); |
| 838 | 838 |
| 839 // Create device space quad. | 839 // Create device space quad. |
| 840 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); | 840 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); |
| 841 | 841 |
| 842 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was generated with to2dTransform() so we don't need to project. | 842 // Map device space quad to local space. deviceTransform has no 3d compo
nent since it was generated with to2dTransform() so we don't need to project. |
| 843 WebTransformationMatrix deviceTransformInverse = deviceTransform.inverse
(); | 843 Transform deviceTransformInverse = MathUtil::inverse(deviceTransform); |
| 844 localQuad = MathUtil::mapQuad(deviceTransformInverse, deviceQuad.ToQuadF
(), clipped); | 844 localQuad = MathUtil::mapQuad(deviceTransformInverse, deviceQuad.ToQuadF
(), clipped); |
| 845 | 845 |
| 846 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become | 846 // We should not DCHECK(!clipped) here, because anti-aliasing inflation
may cause deviceQuad to become |
| 847 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. | 847 // clipped. To our knowledge this scenario does not need to be handled d
ifferently than the unclipped case. |
| 848 } else { | 848 } else { |
| 849 // Move fragment shader transform to vertex shader. We can do this while | 849 // Move fragment shader transform to vertex shader. We can do this while |
| 850 // still producing correct results as fragmentTexTransformLocation | 850 // still producing correct results as fragmentTexTransformLocation |
| 851 // should always be non-negative when tiles are transformed in a way | 851 // should always be non-negative when tiles are transformed in a way |
| 852 // that could result in sampling outside the layer. | 852 // that could result in sampling outside the layer. |
| 853 vertexTexScaleX *= fragmentTexScaleX; | 853 vertexTexScaleX *= fragmentTexScaleX; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 | 1056 |
| 1057 void GLRenderer::ensureScissorTestDisabled() | 1057 void GLRenderer::ensureScissorTestDisabled() |
| 1058 { | 1058 { |
| 1059 if (!m_isScissorEnabled) | 1059 if (!m_isScissorEnabled) |
| 1060 return; | 1060 return; |
| 1061 | 1061 |
| 1062 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); | 1062 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); |
| 1063 m_isScissorEnabled = false; | 1063 m_isScissorEnabled = false; |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 void GLRenderer::toGLMatrix(float* flattened, const WebTransformationMatrix& m) | 1066 void GLRenderer::toGLMatrix(float* glMatrix, const Transform& transform) |
| 1067 { | 1067 { |
| 1068 flattened[0] = m.m11(); | 1068 transform.matrix().asColMajorf(glMatrix); |
| 1069 flattened[1] = m.m12(); | |
| 1070 flattened[2] = m.m13(); | |
| 1071 flattened[3] = m.m14(); | |
| 1072 flattened[4] = m.m21(); | |
| 1073 flattened[5] = m.m22(); | |
| 1074 flattened[6] = m.m23(); | |
| 1075 flattened[7] = m.m24(); | |
| 1076 flattened[8] = m.m31(); | |
| 1077 flattened[9] = m.m32(); | |
| 1078 flattened[10] = m.m33(); | |
| 1079 flattened[11] = m.m34(); | |
| 1080 flattened[12] = m.m41(); | |
| 1081 flattened[13] = m.m42(); | |
| 1082 flattened[14] = m.m43(); | |
| 1083 flattened[15] = m.m44(); | |
| 1084 } | 1069 } |
| 1085 | 1070 |
| 1086 void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation) | 1071 void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation) |
| 1087 { | 1072 { |
| 1088 if (quadLocation == -1) | 1073 if (quadLocation == -1) |
| 1089 return; | 1074 return; |
| 1090 | 1075 |
| 1091 float point[8]; | 1076 float point[8]; |
| 1092 point[0] = quad.p1().x(); | 1077 point[0] = quad.p1().x(); |
| 1093 point[1] = quad.p1().y(); | 1078 point[1] = quad.p1().y(); |
| 1094 point[2] = quad.p2().x(); | 1079 point[2] = quad.p2().x(); |
| 1095 point[3] = quad.p2().y(); | 1080 point[3] = quad.p2().y(); |
| 1096 point[4] = quad.p3().x(); | 1081 point[4] = quad.p3().x(); |
| 1097 point[5] = quad.p3().y(); | 1082 point[5] = quad.p3().y(); |
| 1098 point[6] = quad.p4().x(); | 1083 point[6] = quad.p4().x(); |
| 1099 point[7] = quad.p4().y(); | 1084 point[7] = quad.p4().y(); |
| 1100 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); | 1085 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); |
| 1101 } | 1086 } |
| 1102 | 1087 |
| 1103 void GLRenderer::setShaderOpacity(float opacity, int alphaLocation) | 1088 void GLRenderer::setShaderOpacity(float opacity, int alphaLocation) |
| 1104 { | 1089 { |
| 1105 if (alphaLocation != -1) | 1090 if (alphaLocation != -1) |
| 1106 GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); | 1091 GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); |
| 1107 } | 1092 } |
| 1108 | 1093 |
| 1109 void GLRenderer::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTr
ansformationMatrix& drawTransform, const gfx::RectF& quadRect, int matrixLocatio
n) | 1094 void GLRenderer::drawQuadGeometry(const DrawingFrame& frame, const gfx::Transfor
m& drawTransform, const gfx::RectF& quadRect, int matrixLocation) |
| 1110 { | 1095 { |
| 1111 WebTransformationMatrix quadRectMatrix; | 1096 Transform quadRectMatrix; |
| 1112 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); | 1097 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); |
| 1113 static float glMatrix[16]; | 1098 static float glMatrix[16]; |
| 1114 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); | 1099 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); |
| 1115 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr
ix[0])); | 1100 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr
ix[0])); |
| 1116 | 1101 |
| 1117 GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0
)); | 1102 GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0
)); |
| 1118 } | 1103 } |
| 1119 | 1104 |
| 1120 void GLRenderer::copyTextureToFramebuffer(const DrawingFrame& frame, int texture
Id, const gfx::Rect& rect, const WebTransformationMatrix& drawMatrix) | 1105 void GLRenderer::copyTextureToFramebuffer(const DrawingFrame& frame, int texture
Id, const gfx::Rect& rect, const Transform& drawMatrix) |
| 1121 { | 1106 { |
| 1122 const RenderPassProgram* program = renderPassProgram(); | 1107 const RenderPassProgram* program = renderPassProgram(); |
| 1123 | 1108 |
| 1124 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId)); | 1109 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId)); |
| 1125 | 1110 |
| 1126 GLC(context(), context()->useProgram(program->program())); | 1111 GLC(context(), context()->useProgram(program->program())); |
| 1127 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); | 1112 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio
n(), 0)); |
| 1128 setShaderOpacity(1, program->fragmentShader().alphaLocation()); | 1113 setShaderOpacity(1, program->fragmentShader().alphaLocation()); |
| 1129 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca
tion()); | 1114 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca
tion()); |
| 1130 } | 1115 } |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 | 1626 |
| 1642 releaseRenderPassTextures(); | 1627 releaseRenderPassTextures(); |
| 1643 } | 1628 } |
| 1644 | 1629 |
| 1645 bool GLRenderer::isContextLost() | 1630 bool GLRenderer::isContextLost() |
| 1646 { | 1631 { |
| 1647 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1632 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1648 } | 1633 } |
| 1649 | 1634 |
| 1650 } // namespace cc | 1635 } // namespace cc |
| OLD | NEW |