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

Side by Side Diff: cc/gl_renderer.cc

Issue 11364044: cc: Replace WebCore::FloatQuad with gfx::QuadF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reeebase. Created 8 years, 1 month 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
« no previous file with comments | « cc/gl_renderer.h ('k') | cc/layer_quad.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/gl_renderer.h" 7 #include "cc/gl_renderer.h"
8 8
9 #include "FloatQuad.h" 9 #include "FloatRect.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/string_split.h" 12 #include "base/string_split.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "cc/damage_tracker.h" 14 #include "cc/damage_tracker.h"
15 #include "cc/geometry_binding.h" 15 #include "cc/geometry_binding.h"
16 #include "cc/layer_quad.h" 16 #include "cc/layer_quad.h"
17 #include "cc/math_util.h" 17 #include "cc/math_util.h"
18 #include "cc/platform_color.h" 18 #include "cc/platform_color.h"
19 #include "cc/priority_calculator.h" 19 #include "cc/priority_calculator.h"
20 #include "cc/proxy.h" 20 #include "cc/proxy.h"
21 #include "cc/render_pass.h" 21 #include "cc/render_pass.h"
22 #include "cc/render_surface_filters.h" 22 #include "cc/render_surface_filters.h"
23 #include "cc/scoped_texture.h" 23 #include "cc/scoped_texture.h"
24 #include "cc/settings.h" 24 #include "cc/settings.h"
25 #include "cc/single_thread_proxy.h" 25 #include "cc/single_thread_proxy.h"
26 #include "cc/stream_video_draw_quad.h" 26 #include "cc/stream_video_draw_quad.h"
27 #include "cc/texture_draw_quad.h" 27 #include "cc/texture_draw_quad.h"
28 #include "cc/video_layer_impl.h" 28 #include "cc/video_layer_impl.h"
29 #include "third_party/khronos/GLES2/gl2.h" 29 #include "third_party/khronos/GLES2/gl2.h"
30 #include "third_party/khronos/GLES2/gl2ext.h" 30 #include "third_party/khronos/GLES2/gl2ext.h"
31 #include "third_party/skia/include/core/SkBitmap.h" 31 #include "third_party/skia/include/core/SkBitmap.h"
32 #include "third_party/skia/include/core/SkColor.h" 32 #include "third_party/skia/include/core/SkColor.h"
33 #include "third_party/skia/include/gpu/GrContext.h" 33 #include "third_party/skia/include/gpu/GrContext.h"
34 #include "third_party/skia/include/gpu/GrTexture.h" 34 #include "third_party/skia/include/gpu/GrTexture.h"
35 #include "third_party/skia/include/gpu/SkGpuDevice.h" 35 #include "third_party/skia/include/gpu/SkGpuDevice.h"
36 #include "third_party/skia/include/gpu/SkGrTexturePixelRef.h" 36 #include "third_party/skia/include/gpu/SkGrTexturePixelRef.h"
37 #include "ui/gfx/quad_f.h"
37 #include "ui/gfx/rect_conversions.h" 38 #include "ui/gfx/rect_conversions.h"
38 #include <public/WebGraphicsContext3D.h> 39 #include <public/WebGraphicsContext3D.h>
39 #include <public/WebSharedGraphicsContext3D.h> 40 #include <public/WebSharedGraphicsContext3D.h>
40 #include <set> 41 #include <set>
41 #include <string> 42 #include <string>
42 #include <vector> 43 #include <vector>
43 44
44 using namespace std; 45 using namespace std;
45 using WebKit::WebGraphicsContext3D; 46 using WebKit::WebGraphicsContext3D;
46 using WebKit::WebGraphicsMemoryAllocation; 47 using WebKit::WebGraphicsMemoryAllocation;
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (filters.isEmpty()) 450 if (filters.isEmpty())
450 return scoped_ptr<ScopedTexture>(); 451 return scoped_ptr<ScopedTexture>();
451 452
452 // FIXME: We only allow background filters on an opaque render surface becau se other surfaces may contain 453 // FIXME: We only allow background filters on an opaque render surface becau se other surfaces may contain
453 // translucent pixels, and the contents behind those translucent pixels woul dn't have the filter applied. 454 // translucent pixels, and the contents behind those translucent pixels woul dn't have the filter applied.
454 if (frame.currentRenderPass->hasTransparentBackground()) 455 if (frame.currentRenderPass->hasTransparentBackground())
455 return scoped_ptr<ScopedTexture>(); 456 return scoped_ptr<ScopedTexture>();
456 DCHECK(!frame.currentTexture); 457 DCHECK(!frame.currentTexture);
457 458
458 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused). 459 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused).
459 gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(content sDeviceTransform, sharedGeometryQuad().boundingBox())); 460 gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(content sDeviceTransform, sharedGeometryQuad().BoundingBox()));
460 461
461 int top, right, bottom, left; 462 int top, right, bottom, left;
462 filters.getOutsets(top, right, bottom, left); 463 filters.getOutsets(top, right, bottom, left);
463 deviceRect.Inset(-left, -top, -right, -bottom); 464 deviceRect.Inset(-left, -top, -right, -bottom);
464 465
465 deviceRect.Intersect(frame.currentRenderPass->outputRect()); 466 deviceRect.Intersect(frame.currentRenderPass->outputRect());
466 467
467 scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_ resourceProvider); 468 scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_ resourceProvider);
468 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) 469 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect))
469 return scoped_ptr<ScopedTexture>(); 470 return scoped_ptr<ScopedTexture>();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 539 }
539 540
540 // Draw the background texture if there is one. 541 // Draw the background texture if there is one.
541 if (backgroundTexture) { 542 if (backgroundTexture) {
542 DCHECK(backgroundTexture->size() == quad->quadRect().size()); 543 DCHECK(backgroundTexture->size() == quad->quadRect().size());
543 ResourceProvider::ScopedReadLockGL lock(m_resourceProvider, backgroundTe xture->id()); 544 ResourceProvider::ScopedReadLockGL lock(m_resourceProvider, backgroundTe xture->id());
544 copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad ->quadTransform()); 545 copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad ->quadTransform());
545 } 546 }
546 547
547 bool clipped = false; 548 bool clipped = false;
548 FloatQuad deviceQuad = MathUtil::mapQuad(contentsDeviceTransform, sharedGeom etryQuad(), clipped); 549 gfx::QuadF deviceQuad = MathUtil::mapQuad(contentsDeviceTransform, sharedGeo metryQuad(), clipped);
549 DCHECK(!clipped); 550 DCHECK(!clipped);
550 LayerQuad deviceLayerBounds = LayerQuad(FloatQuad(deviceQuad.boundingBox())) ; 551 LayerQuad deviceLayerBounds = LayerQuad(gfx::QuadF(deviceQuad.BoundingBox()) );
551 LayerQuad deviceLayerEdges = LayerQuad(deviceQuad); 552 LayerQuad deviceLayerEdges = LayerQuad(deviceQuad);
552 553
553 // Use anti-aliasing programs only when necessary. 554 // Use anti-aliasing programs only when necessary.
554 bool useAA = (!deviceQuad.isRectilinear() || !cc::FloatRect(deviceQuad.bound ingBox()).isExpressibleAsIntRect()); 555 bool useAA = (!deviceQuad.IsRectilinear() || !cc::FloatRect(deviceQuad.Bound ingBox()).isExpressibleAsIntRect());
555 if (useAA) { 556 if (useAA) {
556 deviceLayerBounds.inflateAntiAliasingDistance(); 557 deviceLayerBounds.inflateAntiAliasingDistance();
557 deviceLayerEdges.inflateAntiAliasingDistance(); 558 deviceLayerEdges.inflateAntiAliasingDistance();
558 } 559 }
559 560
560 scoped_ptr<ResourceProvider::ScopedReadLockGL> maskResourceLock; 561 scoped_ptr<ResourceProvider::ScopedReadLockGL> maskResourceLock;
561 unsigned maskTextureId = 0; 562 unsigned maskTextureId = 0;
562 if (quad->maskResourceId()) { 563 if (quad->maskResourceId()) {
563 maskResourceLock.reset(new ResourceProvider::ScopedReadLockGL(m_resource Provider, quad->maskResourceId())); 564 maskResourceLock.reset(new ResourceProvider::ScopedReadLockGL(m_resource Provider, quad->maskResourceId()));
564 maskTextureId = maskResourceLock->textureId(); 565 maskTextureId = maskResourceLock->textureId();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 629 }
629 630
630 if (shaderEdgeLocation != -1) { 631 if (shaderEdgeLocation != -1) {
631 float edge[24]; 632 float edge[24];
632 deviceLayerEdges.toFloatArray(edge); 633 deviceLayerEdges.toFloatArray(edge);
633 deviceLayerBounds.toFloatArray(&edge[12]); 634 deviceLayerBounds.toFloatArray(&edge[12]);
634 GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge)); 635 GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge));
635 } 636 }
636 637
637 // Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to proje ct. 638 // Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to proje ct.
638 FloatQuad surfaceQuad = MathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped); 639 gfx::QuadF surfaceQuad = MathUtil::mapQuad(contentsDeviceTransform.inverse() , deviceLayerEdges.ToQuadF(), clipped);
639 DCHECK(!clipped); 640 DCHECK(!clipped);
640 641
641 setShaderOpacity(quad->opacity(), shaderAlphaLocation); 642 setShaderOpacity(quad->opacity(), shaderAlphaLocation);
642 setShaderFloatQuad(surfaceQuad, shaderQuadLocation); 643 setShaderQuadF(surfaceQuad, shaderQuadLocation);
643 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatri xLocation); 644 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatri xLocation);
644 } 645 }
645 646
646 void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorD rawQuad* quad) 647 void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorD rawQuad* quad)
647 { 648 {
648 const SolidColorProgram* program = solidColorProgram(); 649 const SolidColorProgram* program = solidColorProgram();
649 GLC(context(), context()->useProgram(program->program())); 650 GLC(context(), context()->useProgram(program->program()));
650 651
651 SkColor color = quad->color(); 652 SkColor color = quad->color();
652 float opacity = quad->opacity(); 653 float opacity = quad->opacity();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 float vertexTexScaleY = tileRect.height() / clampRect.height(); 708 float vertexTexScaleY = tileRect.height() / clampRect.height();
708 709
709 // Map to normalized texture coordinates. 710 // Map to normalized texture coordinates.
710 const gfx::Size& textureSize = quad->textureSize(); 711 const gfx::Size& textureSize = quad->textureSize();
711 float fragmentTexTranslateX = textureOffset.x() / textureSize.width(); 712 float fragmentTexTranslateX = textureOffset.x() / textureSize.width();
712 float fragmentTexTranslateY = textureOffset.y() / textureSize.height(); 713 float fragmentTexTranslateY = textureOffset.y() / textureSize.height();
713 float fragmentTexScaleX = clampRect.width() / textureSize.width(); 714 float fragmentTexScaleX = clampRect.width() / textureSize.width();
714 float fragmentTexScaleY = clampRect.height() / textureSize.height(); 715 float fragmentTexScaleY = clampRect.height() / textureSize.height();
715 716
716 717
717 FloatQuad localQuad; 718 gfx::QuadF localQuad;
718 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform(); 719 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform();
719 if (!deviceTransform.isInvertible()) 720 if (!deviceTransform.isInvertible())
720 return; 721 return;
721 722
722 bool clipped = false; 723 bool clipped = false;
723 FloatQuad deviceLayerQuad = MathUtil::mapQuad(deviceTransform, FloatQuad(qua d->visibleContentRect()), clipped); 724 gfx::QuadF deviceLayerQuad = MathUtil::mapQuad(deviceTransform, gfx::QuadF(q uad->visibleContentRect()), clipped);
724 DCHECK(!clipped); 725 DCHECK(!clipped);
725 726
726 TileProgramUniforms uniforms; 727 TileProgramUniforms uniforms;
727 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens 728 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens
728 // on perspective transformed layers that go partially behind the camera. 729 // on perspective transformed layers that go partially behind the camera.
729 if (quad->isAntialiased() && !clipped) { 730 if (quad->isAntialiased() && !clipped) {
730 if (quad->swizzleContents()) 731 if (quad->swizzleContents())
731 tileUniformLocation(tileProgramSwizzleAA(), uniforms); 732 tileUniformLocation(tileProgramSwizzleAA(), uniforms);
732 else 733 else
733 tileUniformLocation(tileProgramAA(), uniforms); 734 tileUniformLocation(tileProgramAA(), uniforms);
(...skipping 14 matching lines...) Expand all
748 GLC(context(), context()->useProgram(uniforms.program)); 749 GLC(context(), context()->useProgram(uniforms.program));
749 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0)); 750 GLC(context(), context()->uniform1i(uniforms.samplerLocation, 0));
750 GLC(context(), context()->activeTexture(GL_TEXTURE0)); 751 GLC(context(), context()->activeTexture(GL_TEXTURE0));
751 ResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad ->resourceId()); 752 ResourceProvider::ScopedReadLockGL quadResourceLock(m_resourceProvider, quad ->resourceId());
752 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textur eId())); 753 GLC(context(), context()->bindTexture(GL_TEXTURE_2D, quadResourceLock.textur eId()));
753 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER , quad->textureFilter())); 754 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER , quad->textureFilter()));
754 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER , quad->textureFilter())); 755 GLC(context(), context()->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER , quad->textureFilter()));
755 756
756 bool useAA = !clipped && quad->isAntialiased(); 757 bool useAA = !clipped && quad->isAntialiased();
757 if (useAA) { 758 if (useAA) {
758 LayerQuad deviceLayerBounds = LayerQuad(FloatQuad(deviceLayerQuad.boundi ngBox())); 759 LayerQuad deviceLayerBounds = LayerQuad(gfx::QuadF(deviceLayerQuad.Bound ingBox()));
759 deviceLayerBounds.inflateAntiAliasingDistance(); 760 deviceLayerBounds.inflateAntiAliasingDistance();
760 761
761 LayerQuad deviceLayerEdges = LayerQuad(deviceLayerQuad); 762 LayerQuad deviceLayerEdges = LayerQuad(deviceLayerQuad);
762 deviceLayerEdges.inflateAntiAliasingDistance(); 763 deviceLayerEdges.inflateAntiAliasingDistance();
763 764
764 float edge[24]; 765 float edge[24];
765 deviceLayerEdges.toFloatArray(edge); 766 deviceLayerEdges.toFloatArray(edge);
766 deviceLayerBounds.toFloatArray(&edge[12]); 767 deviceLayerBounds.toFloatArray(&edge[12]);
767 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge)); 768 GLC(context(), context()->uniform3fv(uniforms.edgeLocation, 8, edge));
768 769
(...skipping 23 matching lines...) Expand all
792 // Only apply anti-aliasing to edges not clipped by culling or scissorin g. 793 // Only apply anti-aliasing to edges not clipped by culling or scissorin g.
793 if (quad->topEdgeAA() && tileRect.y() == quad->quadRect().y()) 794 if (quad->topEdgeAA() && tileRect.y() == quad->quadRect().y())
794 topEdge = deviceLayerEdges.top(); 795 topEdge = deviceLayerEdges.top();
795 if (quad->leftEdgeAA() && tileRect.x() == quad->quadRect().x()) 796 if (quad->leftEdgeAA() && tileRect.x() == quad->quadRect().x())
796 leftEdge = deviceLayerEdges.left(); 797 leftEdge = deviceLayerEdges.left();
797 if (quad->rightEdgeAA() && tileRect.right() == quad->quadRect().right()) 798 if (quad->rightEdgeAA() && tileRect.right() == quad->quadRect().right())
798 rightEdge = deviceLayerEdges.right(); 799 rightEdge = deviceLayerEdges.right();
799 if (quad->bottomEdgeAA() && tileRect.bottom() == quad->quadRect().bottom ()) 800 if (quad->bottomEdgeAA() && tileRect.bottom() == quad->quadRect().bottom ())
800 bottomEdge = deviceLayerEdges.bottom(); 801 bottomEdge = deviceLayerEdges.bottom();
801 802
802 float sign = FloatQuad(tileRect).isCounterclockwise() ? -1 : 1; 803 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1;
803 bottomEdge.scale(sign); 804 bottomEdge.scale(sign);
804 leftEdge.scale(sign); 805 leftEdge.scale(sign);
805 topEdge.scale(sign); 806 topEdge.scale(sign);
806 rightEdge.scale(sign); 807 rightEdge.scale(sign);
807 808
808 // Create device space quad. 809 // Create device space quad.
809 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); 810 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
810 811
811 // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to pro ject. 812 // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to pro ject.
812 WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse (); 813 WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse ();
813 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQu ad(), clipped); 814 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF (), clipped);
814 815
815 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become 816 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become
816 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case. 817 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case.
817 } else { 818 } else {
818 // Move fragment shader transform to vertex shader. We can do this while 819 // Move fragment shader transform to vertex shader. We can do this while
819 // still producing correct results as fragmentTexTransformLocation 820 // still producing correct results as fragmentTexTransformLocation
820 // should always be non-negative when tiles are transformed in a way 821 // should always be non-negative when tiles are transformed in a way
821 // that could result in sampling outside the layer. 822 // that could result in sampling outside the layer.
822 vertexTexScaleX *= fragmentTexScaleX; 823 vertexTexScaleX *= fragmentTexScaleX;
823 vertexTexScaleY *= fragmentTexScaleY; 824 vertexTexScaleY *= fragmentTexScaleY;
824 vertexTexTranslateX *= fragmentTexScaleX; 825 vertexTexTranslateX *= fragmentTexScaleX;
825 vertexTexTranslateY *= fragmentTexScaleY; 826 vertexTexTranslateY *= fragmentTexScaleY;
826 vertexTexTranslateX += fragmentTexTranslateX; 827 vertexTexTranslateX += fragmentTexTranslateX;
827 vertexTexTranslateY += fragmentTexTranslateY; 828 vertexTexTranslateY += fragmentTexTranslateY;
828 829
829 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY)); 830 GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
830 831
831 localQuad = gfx::RectF(tileRect); 832 localQuad = gfx::RectF(tileRect);
832 } 833 }
833 834
834 // Normalize to tileRect. 835 // Normalize to tileRect.
835 localQuad.scale(1.0f / tileRect.width(), 1.0f / tileRect.height()); 836 localQuad.Scale(1.0f / tileRect.width(), 1.0f / tileRect.height());
836 837
837 setShaderOpacity(quad->opacity(), uniforms.alphaLocation); 838 setShaderOpacity(quad->opacity(), uniforms.alphaLocation);
838 setShaderFloatQuad(localQuad, uniforms.pointLocation); 839 setShaderQuadF(localQuad, uniforms.pointLocation);
839 840
840 // The tile quad shader behaves differently compared to all other shaders. 841 // The tile quad shader behaves differently compared to all other shaders.
841 // The transform and vertex data are used to figure out the extents that the 842 // The transform and vertex data are used to figure out the extents that the
842 // un-antialiased quad should have and which vertex this is and the float 843 // un-antialiased quad should have and which vertex this is and the float
843 // quad passed in via uniform is the actual geometry that gets used to draw 844 // quad passed in via uniform is the actual geometry that gets used to draw
844 // it. This is why this centered rect is used and not the original quadRect. 845 // it. This is why this centered rect is used and not the original quadRect.
845 gfx::RectF centeredRect(gfx::PointF(-0.5 * tileRect.width(), -0.5 * tileRect .height()), tileRect.size()); 846 gfx::RectF centeredRect(gfx::PointF(-0.5 * tileRect.width(), -0.5 * tileRect .height()), tileRect.size());
846 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location); 847 drawQuadGeometry(frame, quad->quadTransform(), centeredRect, uniforms.matrix Location);
847 } 848 }
848 849
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 flattened[8] = m.m31(); 1045 flattened[8] = m.m31();
1045 flattened[9] = m.m32(); 1046 flattened[9] = m.m32();
1046 flattened[10] = m.m33(); 1047 flattened[10] = m.m33();
1047 flattened[11] = m.m34(); 1048 flattened[11] = m.m34();
1048 flattened[12] = m.m41(); 1049 flattened[12] = m.m41();
1049 flattened[13] = m.m42(); 1050 flattened[13] = m.m42();
1050 flattened[14] = m.m43(); 1051 flattened[14] = m.m43();
1051 flattened[15] = m.m44(); 1052 flattened[15] = m.m44();
1052 } 1053 }
1053 1054
1054 void GLRenderer::setShaderFloatQuad(const FloatQuad& quad, int quadLocation) 1055 void GLRenderer::setShaderQuadF(const gfx::QuadF& quad, int quadLocation)
1055 { 1056 {
1056 if (quadLocation == -1) 1057 if (quadLocation == -1)
1057 return; 1058 return;
1058 1059
1059 float point[8]; 1060 float point[8];
1060 point[0] = quad.p1().x(); 1061 point[0] = quad.p1().x();
1061 point[1] = quad.p1().y(); 1062 point[1] = quad.p1().y();
1062 point[2] = quad.p2().x(); 1063 point[2] = quad.p2().x();
1063 point[3] = quad.p2().y(); 1064 point[3] = quad.p2().y();
1064 point[4] = quad.p3().x(); 1065 point[4] = quad.p3().x();
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 1626
1626 releaseRenderPassTextures(); 1627 releaseRenderPassTextures();
1627 } 1628 }
1628 1629
1629 bool GLRenderer::isContextLost() 1630 bool GLRenderer::isContextLost()
1630 { 1631 {
1631 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1632 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1632 } 1633 }
1633 1634
1634 } // namespace cc 1635 } // namespace cc
OLDNEW
« no previous file with comments | « cc/gl_renderer.h ('k') | cc/layer_quad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698