Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1066)

Side by Side Diff: cc/gl_renderer.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde rDrawQuad* quad) 319 void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde rDrawQuad* quad)
320 { 320 {
321 static float glMatrix[16]; 321 static float glMatrix[16];
322 const SolidColorProgram* program = solidColorProgram(); 322 const SolidColorProgram* program = solidColorProgram();
323 DCHECK(program && (program->initialized() || isContextLost())); 323 DCHECK(program && (program->initialized() || isContextLost()));
324 GLC(context(), context()->useProgram(program->program())); 324 GLC(context(), context()->useProgram(program->program()));
325 325
326 // Use the full quadRect for debug quads to not move the edges based on part ial swaps. 326 // Use the full quadRect for debug quads to not move the edges based on part ial swaps.
327 const gfx::Rect& layerRect = quad->rect; 327 const gfx::Rect& layerRect = quad->rect;
328 WebTransformationMatrix renderMatrix = quad->quadTransform(); 328 Transform renderMatrix = quad->quadTransform();
329 renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerR ect.height() + layerRect.y()); 329 renderMatrix.PreconcatTranslate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y());
330 renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height()); 330 renderMatrix.PreconcatScale(layerRect.width(), layerRect.height());
331 GLRenderer::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix); 331 GLRenderer::toGLMatrix(&glMatrix[0], frame.projectionMatrix * renderMatrix);
332 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc ation(), 1, false, &glMatrix[0])); 332 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().matrixLoc ation(), 1, false, &glMatrix[0]));
333 333
334 SkColor color = quad->color; 334 SkColor color = quad->color;
335 float alpha = SkColorGetA(color) / 255.0; 335 float alpha = SkColorGetA(color) / 255.0;
336 336
337 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation( ), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, ( SkColorGetB(color) / 255.0) * alpha, alpha)); 337 GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation( ), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, ( SkColorGetB(color) / 255.0) * alpha, alpha));
338 338
339 GLC(context(), context()->lineWidth(quad->width)); 339 GLC(context(), context()->lineWidth(quad->width));
340 340
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 canvas.clear(0x0); 424 canvas.clear(0x0);
425 canvas.drawSprite(source, 0, 0, &paint); 425 canvas.drawSprite(source, 0, 0, &paint);
426 canvas.flush(); 426 canvas.flush();
427 context3d->flush(); 427 context3d->flush();
428 return device.accessBitmap(false); 428 return device.accessBitmap(false);
429 } 429 }
430 430
431 scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters( 431 scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters(
432 DrawingFrame& frame, const RenderPassDrawQuad* quad, 432 DrawingFrame& frame, const RenderPassDrawQuad* quad,
433 const WebKit::WebFilterOperations& filters, 433 const WebKit::WebFilterOperations& filters,
434 const WebTransformationMatrix& contentsDeviceTransform, 434 const Transform& contentsDeviceTransform,
435 const WebTransformationMatrix& contentsDeviceTransformInverse) 435 const Transform& contentsDeviceTransformInverse)
436 { 436 {
437 // This method draws a background filter, which applies a filter to any pixe ls behind the quad and seen through its background. 437 // This method draws a background filter, which applies a filter to any pixe ls behind the quad and seen through its background.
438 // The algorithm works as follows: 438 // The algorithm works as follows:
439 // 1. Compute a bounding box around the pixels that will be visible through the quad. 439 // 1. Compute a bounding box around the pixels that will be visible through the quad.
440 // 2. Read the pixels in the bounding box into a buffer R. 440 // 2. Read the pixels in the bounding box into a buffer R.
441 // 3. Apply the background filter to R, so that it is applied in the pixels' coordinate space. 441 // 3. Apply the background filter to R, so that it is applied in the pixels' coordinate space.
442 // 4. Apply the quad's inverse transform to map the pixels in R into the qua d's content space. This implicitly 442 // 4. Apply the quad's inverse transform to map the pixels in R into the qua d's content space. This implicitly
443 // clips R by the content bounds of the quad since the destination texture h as bounds matching the quad's content. 443 // clips R by the content bounds of the quad since the destination texture h as bounds matching the quad's content.
444 // 5. Draw the background texture for the contents using the same transform as used to draw the contents itself. This is done 444 // 5. Draw the background texture for the contents using the same transform as used to draw the contents itself. This is done
445 // without blending to replace the current background pixels with the new fi ltered background. 445 // 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
481 481
482 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso urceProvider); 482 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso urceProvider);
483 if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect.size(), GL_R GBA, ResourceProvider::TextureUsageFramebuffer)) 483 if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect.size(), GL_R GBA, ResourceProvider::TextureUsageFramebuffer))
484 return scoped_ptr<ScopedResource>(); 484 return scoped_ptr<ScopedResource>();
485 485
486 const RenderPass* targetRenderPass = frame.currentRenderPass; 486 const RenderPass* targetRenderPass = frame.currentRenderPass;
487 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quad->rect); 487 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quad->rect);
488 488
489 if (usingBackgroundTexture) { 489 if (usingBackgroundTexture) {
490 // Copy the readback pixels from device to the background texture for th e surface. 490 // Copy the readback pixels from device to the background texture for th e surface.
491 WebTransformationMatrix deviceToFramebufferTransform; 491 Transform deviceToFramebufferTransform;
492 deviceToFramebufferTransform.translate(quad->rect.width() / 2.0, quad->r ect.height() / 2.0); 492 deviceToFramebufferTransform.PreconcatTranslate(quad->rect.width() / 2.0 , quad->rect.height() / 2.0);
493 deviceToFramebufferTransform.scale3d(quad->rect.width(), quad->rect.heig ht(), 1); 493 deviceToFramebufferTransform.PreconcatScale3d(quad->rect.width(), quad-> rect.height(), 1);
494 deviceToFramebufferTransform.multiply(contentsDeviceTransformInverse); 494 deviceToFramebufferTransform.PreconcatTransform(contentsDeviceTransformI nverse);
495 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic eRect, deviceToFramebufferTransform); 495 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic eRect, deviceToFramebufferTransform);
496 } 496 }
497 497
498 useRenderPass(frame, targetRenderPass); 498 useRenderPass(frame, targetRenderPass);
499 499
500 if (!usingBackgroundTexture) 500 if (!usingBackgroundTexture)
501 return scoped_ptr<ScopedResource>(); 501 return scoped_ptr<ScopedResource>();
502 return backgroundTexture.Pass(); 502 return backgroundTexture.Pass();
503 } 503 }
504 504
505 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua d* quad) 505 void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua d* quad)
506 { 506 {
507 CachedResource* contentsTexture = m_renderPassTextures.get(quad->render_pass _id); 507 CachedResource* contentsTexture = m_renderPassTextures.get(quad->render_pass _id);
508 if (!contentsTexture || !contentsTexture->id()) 508 if (!contentsTexture || !contentsTexture->id())
509 return; 509 return;
510 510
511 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass _id); 511 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass _id);
512 DCHECK(renderPass); 512 DCHECK(renderPass);
513 if (!renderPass) 513 if (!renderPass)
514 return; 514 return;
515 515
516 WebTransformationMatrix quadRectMatrix; 516 Transform quadRectMatrix;
517 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect); 517 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect);
518 WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * fram e.projectionMatrix * quadRectMatrix).to2dTransform(); 518 Transform contentsDeviceTransform = MathUtil::to2dTransform(frame.windowMatr ix * frame.projectionMatrix * quadRectMatrix);
519 519
520 // Can only draw surface if device matrix is invertible. 520 // Can only draw surface if device matrix is invertible.
521 if (!contentsDeviceTransform.isInvertible()) 521 if (!contentsDeviceTransform.IsInvertible())
522 return; 522 return;
523 523
524 WebTransformationMatrix contentsDeviceTransformInverse = contentsDeviceTrans form.inverse(); 524 Transform contentsDeviceTransformInverse = MathUtil::inverse(contentsDeviceT ransform);
525 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( 525 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters(
526 frame, quad, renderPass->background_filters, 526 frame, quad, renderPass->background_filters,
527 contentsDeviceTransform, contentsDeviceTransformInverse); 527 contentsDeviceTransform, contentsDeviceTransformInverse);
528 528
529 // FIXME: Cache this value so that we don't have to do it for both the surfa ce and its replica. 529 // FIXME: Cache this value so that we don't have to do it for both the surfa ce and its replica.
530 // Apply filters to the contents texture. 530 // Apply filters to the contents texture.
531 SkBitmap filterBitmap; 531 SkBitmap filterBitmap;
532 if (renderPass->filter) { 532 if (renderPass->filter) {
533 filterBitmap = applyImageFilter(this, renderPass->filter, contentsTextur e, m_client->hasImplThread()); 533 filterBitmap = applyImageFilter(this, renderPass->filter, contentsTextur e, m_client->hasImplThread());
534 } else { 534 } else {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 738
739 // Map to normalized texture coordinates. 739 // Map to normalized texture coordinates.
740 const gfx::Size& textureSize = quad->texture_size; 740 const gfx::Size& textureSize = quad->texture_size;
741 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width(); 741 float fragmentTexTranslateX = clampTexRect.x() / textureSize.width();
742 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height(); 742 float fragmentTexTranslateY = clampTexRect.y() / textureSize.height();
743 float fragmentTexScaleX = clampTexRect.width() / textureSize.width(); 743 float fragmentTexScaleX = clampTexRect.width() / textureSize.width();
744 float fragmentTexScaleY = clampTexRect.height() / textureSize.height(); 744 float fragmentTexScaleY = clampTexRect.height() / textureSize.height();
745 745
746 746
747 gfx::QuadF localQuad; 747 gfx::QuadF localQuad;
748 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform(); 748 Transform deviceTransform = MathUtil::to2dTransform(frame.windowMatrix * fra me.projectionMatrix * quad->quadTransform());
749 if (!deviceTransform.isInvertible()) 749 if (!deviceTransform.IsInvertible())
750 return; 750 return;
751 751
752 bool clipped = false; 752 bool clipped = false;
753 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q uad->visibleContentRect()), clipped); 753 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q uad->visibleContentRect()), clipped);
754 DCHECK(!clipped); 754 DCHECK(!clipped);
755 755
756 TileProgramUniforms uniforms; 756 TileProgramUniforms uniforms;
757 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens 757 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens
758 // on perspective transformed layers that go partially behind the camera. 758 // on perspective transformed layers that go partially behind the camera.
759 if (quad->IsAntialiased() && !clipped) { 759 if (quad->IsAntialiased() && !clipped) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1; 829 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1;
830 bottomEdge.scale(sign); 830 bottomEdge.scale(sign);
831 leftEdge.scale(sign); 831 leftEdge.scale(sign);
832 topEdge.scale(sign); 832 topEdge.scale(sign);
833 rightEdge.scale(sign); 833 rightEdge.scale(sign);
834 834
835 // Create device space quad. 835 // Create device space quad.
836 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); 836 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
837 837
838 // 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. 838 // 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.
839 WebTransformationMatrix deviceTransformInverse = deviceTransform.inverse (); 839 Transform deviceTransformInverse = MathUtil::inverse(deviceTransform);
840 localQuad = MathUtil::mapQuad(deviceTransformInverse, deviceQuad.ToQuadF (), clipped); 840 localQuad = MathUtil::mapQuad(deviceTransformInverse, deviceQuad.ToQuadF (), clipped);
841 841
842 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become 842 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
843 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case. 843 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case.
844 } else { 844 } else {
845 // Move fragment shader transform to vertex shader. We can do this while 845 // Move fragment shader transform to vertex shader. We can do this while
846 // still producing correct results as fragmentTexTransformLocation 846 // still producing correct results as fragmentTexTransformLocation
847 // should always be non-negative when tiles are transformed in a way 847 // should always be non-negative when tiles are transformed in a way
848 // that could result in sampling outside the layer. 848 // that could result in sampling outside the layer.
849 vertexTexScaleX *= fragmentTexScaleX; 849 vertexTexScaleX *= fragmentTexScaleX;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 m_swapBufferRect.Union(gfx::ToEnclosingRect(frame.rootDamageRect)); 1034 m_swapBufferRect.Union(gfx::ToEnclosingRect(frame.rootDamageRect));
1035 1035
1036 GLC(m_context, m_context->disable(GL_BLEND)); 1036 GLC(m_context, m_context->disable(GL_BLEND));
1037 } 1037 }
1038 1038
1039 bool GLRenderer::flippedFramebuffer() const 1039 bool GLRenderer::flippedFramebuffer() const
1040 { 1040 {
1041 return true; 1041 return true;
1042 } 1042 }
1043 1043
1044 void GLRenderer::toGLMatrix(float* flattened, const WebTransformationMatrix& m) 1044 void GLRenderer::toGLMatrix(float* flattened, const Transform& m)
1045 { 1045 {
Ian Vollick 2012/11/21 22:07:09 use SkMatrix44::asColMajorf
1046 flattened[0] = m.m11(); 1046 flattened[0] = m.matrix().getDouble(0, 0);
1047 flattened[1] = m.m12(); 1047 flattened[1] = m.matrix().getDouble(1, 0);
1048 flattened[2] = m.m13(); 1048 flattened[2] = m.matrix().getDouble(2, 0);
1049 flattened[3] = m.m14(); 1049 flattened[3] = m.matrix().getDouble(3, 0);
1050 flattened[4] = m.m21(); 1050 flattened[4] = m.matrix().getDouble(0, 1);
1051 flattened[5] = m.m22(); 1051 flattened[5] = m.matrix().getDouble(1, 1);
1052 flattened[6] = m.m23(); 1052 flattened[6] = m.matrix().getDouble(2, 1);
1053 flattened[7] = m.m24(); 1053 flattened[7] = m.matrix().getDouble(3, 1);
1054 flattened[8] = m.m31(); 1054 flattened[8] = m.matrix().getDouble(0, 2);
1055 flattened[9] = m.m32(); 1055 flattened[9] = m.matrix().getDouble(1, 2);
1056 flattened[10] = m.m33(); 1056 flattened[10] = m.matrix().getDouble(2, 2);
1057 flattened[11] = m.m34(); 1057 flattened[11] = m.matrix().getDouble(3, 2);
1058 flattened[12] = m.m41(); 1058 flattened[12] = m.matrix().getDouble(0, 3);
1059 flattened[13] = m.m42(); 1059 flattened[13] = m.matrix().getDouble(1, 3);
1060 flattened[14] = m.m43(); 1060 flattened[14] = m.matrix().getDouble(2, 3);
1061 flattened[15] = m.m44(); 1061 flattened[15] = m.matrix().getDouble(3, 3);
1062 } 1062 }
1063 1063
1064 void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation) 1064 void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation)
1065 { 1065 {
1066 if (quadLocation == -1) 1066 if (quadLocation == -1)
1067 return; 1067 return;
1068 1068
1069 float point[8]; 1069 float point[8];
1070 point[0] = quad.p1().x(); 1070 point[0] = quad.p1().x();
1071 point[1] = quad.p1().y(); 1071 point[1] = quad.p1().y();
1072 point[2] = quad.p2().x(); 1072 point[2] = quad.p2().x();
1073 point[3] = quad.p2().y(); 1073 point[3] = quad.p2().y();
1074 point[4] = quad.p3().x(); 1074 point[4] = quad.p3().x();
1075 point[5] = quad.p3().y(); 1075 point[5] = quad.p3().y();
1076 point[6] = quad.p4().x(); 1076 point[6] = quad.p4().x();
1077 point[7] = quad.p4().y(); 1077 point[7] = quad.p4().y();
1078 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point)); 1078 GLC(m_context, m_context->uniform2fv(quadLocation, 4, point));
1079 } 1079 }
1080 1080
1081 void GLRenderer::setShaderOpacity(float opacity, int alphaLocation) 1081 void GLRenderer::setShaderOpacity(float opacity, int alphaLocation)
1082 { 1082 {
1083 if (alphaLocation != -1) 1083 if (alphaLocation != -1)
1084 GLC(m_context, m_context->uniform1f(alphaLocation, opacity)); 1084 GLC(m_context, m_context->uniform1f(alphaLocation, opacity));
1085 } 1085 }
1086 1086
1087 void GLRenderer::drawQuadGeometry(const DrawingFrame& frame, const WebKit::WebTr ansformationMatrix& drawTransform, const gfx::RectF& quadRect, int matrixLocatio n) 1087 void GLRenderer::drawQuadGeometry(const DrawingFrame& frame, const gfx::Transfor m& drawTransform, const gfx::RectF& quadRect, int matrixLocation)
1088 { 1088 {
1089 WebTransformationMatrix quadRectMatrix; 1089 Transform quadRectMatrix;
1090 quadRectTransform(&quadRectMatrix, drawTransform, quadRect); 1090 quadRectTransform(&quadRectMatrix, drawTransform, quadRect);
1091 static float glMatrix[16]; 1091 static float glMatrix[16];
1092 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix); 1092 toGLMatrix(&glMatrix[0], frame.projectionMatrix * quadRectMatrix);
1093 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr ix[0])); 1093 GLC(m_context, m_context->uniformMatrix4fv(matrixLocation, 1, false, &glMatr ix[0]));
1094 1094
1095 GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0 )); 1095 GLC(m_context, m_context->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0 ));
1096 } 1096 }
1097 1097
1098 void GLRenderer::copyTextureToFramebuffer(const DrawingFrame& frame, int texture Id, const gfx::Rect& rect, const WebTransformationMatrix& drawMatrix) 1098 void GLRenderer::copyTextureToFramebuffer(const DrawingFrame& frame, int texture Id, const gfx::Rect& rect, const Transform& drawMatrix)
1099 { 1099 {
1100 const RenderPassProgram* program = renderPassProgram(); 1100 const RenderPassProgram* program = renderPassProgram();
1101 1101
1102 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId)); 1102 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, textureId));
1103 1103
1104 GLC(context(), context()->useProgram(program->program())); 1104 GLC(context(), context()->useProgram(program->program()));
1105 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio n(), 0)); 1105 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio n(), 0));
1106 setShaderOpacity(1, program->fragmentShader().alphaLocation()); 1106 setShaderOpacity(1, program->fragmentShader().alphaLocation());
1107 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca tion()); 1107 drawQuadGeometry(frame, drawMatrix, rect, program->vertexShader().matrixLoca tion());
1108 } 1108 }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 1611
1612 releaseRenderPassTextures(); 1612 releaseRenderPassTextures();
1613 } 1613 }
1614 1614
1615 bool GLRenderer::isContextLost() 1615 bool GLRenderer::isContextLost()
1616 { 1616 {
1617 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1617 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1618 } 1618 }
1619 1619
1620 } // namespace cc 1620 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698