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

Side by Side Diff: cc/CCRendererGL.cpp

Issue 10989028: cc: Remove WebCore dependecies from CCRenderPass and CCDrawQuad classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months 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 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #if USE(ACCELERATED_COMPOSITING) 8 #if USE(ACCELERATED_COMPOSITING)
9 #include "CCRendererGL.h" 9 #include "CCRendererGL.h"
10 10
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 ASSERT(!frame.currentTexture); 372 ASSERT(!frame.currentTexture);
373 373
374 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused). 374 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused).
375 IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDev iceTransform, sharedGeometryQuad().boundingBox())); 375 IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDev iceTransform, sharedGeometryQuad().boundingBox()));
376 376
377 int top, right, bottom, left; 377 int top, right, bottom, left;
378 filters.getOutsets(top, right, bottom, left); 378 filters.getOutsets(top, right, bottom, left);
379 deviceRect.move(-left, -top); 379 deviceRect.move(-left, -top);
380 deviceRect.expand(left + right, top + bottom); 380 deviceRect.expand(left + right, top + bottom);
381 381
382 deviceRect.intersect(frame.currentRenderPass->outputRect()); 382 deviceRect.intersect(static_cast<IntRect>(frame.currentRenderPass->outputRec t()));
383
384 IntRect quadRect = quad->quadRect();
383 385
384 OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_ resourceProvider); 386 OwnPtr<CCScopedTexture> deviceBackgroundTexture = CCScopedTexture::create(m_ resourceProvider);
385 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect)) 387 if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect))
386 return nullptr; 388 return nullptr;
387 389
388 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get()); 390 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get());
389 if (!filteredDeviceBackground.getTexture()) 391 if (!filteredDeviceBackground.getTexture())
390 return nullptr; 392 return nullptr;
391 393
392 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture()); 394 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture());
393 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); 395 int filteredDeviceBackgroundTextureId = texture->getTextureHandle();
394 396
395 OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resour ceProvider); 397 OwnPtr<CCScopedTexture> backgroundTexture = CCScopedTexture::create(m_resour ceProvider);
396 if (!backgroundTexture->allocate(CCRenderer::ImplPool, quad->quadRect().size (), GraphicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer)) 398 if (!backgroundTexture->allocate(CCRenderer::ImplPool, quadRect.size(), Grap hicsContext3D::RGBA, CCResourceProvider::TextureUsageFramebuffer))
397 return nullptr; 399 return nullptr;
398 400
399 const CCRenderPass* targetRenderPass = frame.currentRenderPass; 401 const CCRenderPass* targetRenderPass = frame.currentRenderPass;
400 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quad->quadRect()); 402 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quadRect);
401 403
402 if (usingBackgroundTexture) { 404 if (usingBackgroundTexture) {
403 // Copy the readback pixels from device to the background texture for th e surface. 405 // Copy the readback pixels from device to the background texture for th e surface.
404 WebTransformationMatrix deviceToFramebufferTransform; 406 WebTransformationMatrix deviceToFramebufferTransform;
405 deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, q uad->quadRect().height() / 2.0); 407 deviceToFramebufferTransform.translate(quadRect.width() / 2.0, quadRect. height() / 2.0);
406 deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->qua dRect().height(), 1); 408 deviceToFramebufferTransform.scale3d(quadRect.width(), quadRect.height() , 1);
407 deviceToFramebufferTransform.multiply(contentsDeviceTransform.inverse()) ; 409 deviceToFramebufferTransform.multiply(contentsDeviceTransform.inverse()) ;
408 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic eRect, deviceToFramebufferTransform); 410 copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, devic eRect, deviceToFramebufferTransform);
409 } 411 }
410 412
411 useRenderPass(frame, targetRenderPass); 413 useRenderPass(frame, targetRenderPass);
412 414
413 if (!usingBackgroundTexture) 415 if (!usingBackgroundTexture)
414 return nullptr; 416 return nullptr;
415 return backgroundTexture.release(); 417 return backgroundTexture.release();
416 } 418 }
417 419
418 void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra wQuad* quad) 420 void CCRendererGL::drawRenderPassQuad(DrawingFrame& frame, const CCRenderPassDra wQuad* quad)
419 { 421 {
420 CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId ()); 422 CachedTexture* contentsTexture = m_renderPassTextures.get(quad->renderPassId ());
421 if (!contentsTexture || !contentsTexture->id()) 423 if (!contentsTexture || !contentsTexture->id())
422 return; 424 return;
423 425
424 const CCRenderPass* renderPass = frame.renderPassesById->get(quad->renderPas sId()); 426 const CCRenderPass* renderPass = frame.renderPassesById->get(quad->renderPas sId());
425 ASSERT(renderPass); 427 ASSERT(renderPass);
426 if (!renderPass) 428 if (!renderPass)
427 return; 429 return;
428 430
431 IntRect quadRect = quad->quadRect();
432
429 WebTransformationMatrix renderMatrix = quad->quadTransform(); 433 WebTransformationMatrix renderMatrix = quad->quadTransform();
430 renderMatrix.translate(0.5 * quad->quadRect().width() + quad->quadRect().x() , 0.5 * quad->quadRect().height() + quad->quadRect().y()); 434 renderMatrix.translate(0.5 * quadRect.width() + quadRect.x(), 0.5 * quadRect .height() + quadRect.y());
431 WebTransformationMatrix deviceMatrix = renderMatrix; 435 WebTransformationMatrix deviceMatrix = renderMatrix;
432 deviceMatrix.scaleNonUniform(quad->quadRect().width(), quad->quadRect().heig ht()); 436 deviceMatrix.scaleNonUniform(quadRect.width(), quadRect.height());
433 WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(fr ame.windowMatrix * frame.projectionMatrix * deviceMatrix).to2dTransform(); 437 WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(fr ame.windowMatrix * frame.projectionMatrix * deviceMatrix).to2dTransform();
434 438
435 // Can only draw surface if device matrix is invertible. 439 // Can only draw surface if device matrix is invertible.
436 if (!contentsDeviceTransform.isInvertible()) 440 if (!contentsDeviceTransform.isInvertible())
437 return; 441 return;
438 442
439 OwnPtr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(frame, qua d, renderPass->backgroundFilters(), contentsDeviceTransform); 443 OwnPtr<CCScopedTexture> backgroundTexture = drawBackgroundFilters(frame, qua d, renderPass->backgroundFilters(), contentsDeviceTransform);
440 444
441 // FIXME: Cache this value so that we don't have to do it for both the surfa ce and its replica. 445 // FIXME: Cache this value so that we don't have to do it for both the surfa ce and its replica.
442 // Apply filters to the contents texture. 446 // Apply filters to the contents texture.
443 SkBitmap filterBitmap = applyFilters(this, renderPass->filters(), contentsTe xture); 447 SkBitmap filterBitmap = applyFilters(this, renderPass->filters(), contentsTe xture);
444 OwnPtr<CCResourceProvider::ScopedReadLockGL> contentsResourceLock; 448 OwnPtr<CCResourceProvider::ScopedReadLockGL> contentsResourceLock;
445 unsigned contentsTextureId = 0; 449 unsigned contentsTextureId = 0;
446 if (filterBitmap.getTexture()) { 450 if (filterBitmap.getTexture()) {
447 GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTextur e()); 451 GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTextur e());
448 contentsTextureId = texture->getTextureHandle(); 452 contentsTextureId = texture->getTextureHandle();
449 } else { 453 } else {
450 contentsResourceLock = adoptPtr(new CCResourceProvider::ScopedReadLockGL (m_resourceProvider, contentsTexture->id())); 454 contentsResourceLock = adoptPtr(new CCResourceProvider::ScopedReadLockGL (m_resourceProvider, contentsTexture->id()));
451 contentsTextureId = contentsResourceLock->textureId(); 455 contentsTextureId = contentsResourceLock->textureId();
452 } 456 }
453 457
454 // Draw the background texture if there is one. 458 // Draw the background texture if there is one.
455 if (backgroundTexture) { 459 if (backgroundTexture) {
456 ASSERT(backgroundTexture->size() == quad->quadRect().size()); 460 ASSERT(backgroundTexture->size() == quadRect.size());
457 CCResourceProvider::ScopedReadLockGL lock(m_resourceProvider, background Texture->id()); 461 CCResourceProvider::ScopedReadLockGL lock(m_resourceProvider, background Texture->id());
458 copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad ->quadTransform()); 462 copyTextureToFramebuffer(frame, lock.textureId(), quadRect, quad->quadTr ansform());
459 } 463 }
460 464
461 bool clipped = false; 465 bool clipped = false;
462 FloatQuad deviceQuad = CCMathUtil::mapQuad(contentsDeviceTransform, sharedGe ometryQuad(), clipped); 466 FloatQuad deviceQuad = CCMathUtil::mapQuad(contentsDeviceTransform, sharedGe ometryQuad(), clipped);
463 ASSERT(!clipped); 467 ASSERT(!clipped);
464 CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceQuad.boundingBox ())); 468 CCLayerQuad deviceLayerBounds = CCLayerQuad(FloatQuad(deviceQuad.boundingBox ()));
465 CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceQuad); 469 CCLayerQuad deviceLayerEdges = CCLayerQuad(deviceQuad);
466 470
467 // Use anti-aliasing programs only when necessary. 471 // Use anti-aliasing programs only when necessary.
468 bool useAA = (!deviceQuad.isRectilinear() || !deviceQuad.boundingBox().isExp ressibleAsIntRect()); 472 bool useAA = (!deviceQuad.isRectilinear() || !deviceQuad.boundingBox().isExp ressibleAsIntRect());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 deviceLayerBounds.toFloatArray(&edge[12]); 551 deviceLayerBounds.toFloatArray(&edge[12]);
548 GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge)); 552 GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge));
549 } 553 }
550 554
551 // 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. 555 // 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.
552 FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse( ), deviceLayerEdges.floatQuad(), clipped); 556 FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse( ), deviceLayerEdges.floatQuad(), clipped);
553 ASSERT(!clipped); 557 ASSERT(!clipped);
554 558
555 setShaderOpacity(quad->opacity(), shaderAlphaLocation); 559 setShaderOpacity(quad->opacity(), shaderAlphaLocation);
556 setShaderFloatQuad(surfaceQuad, shaderQuadLocation); 560 setShaderFloatQuad(surfaceQuad, shaderQuadLocation);
557 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatri xLocation); 561 drawQuadGeometry(frame, quad->quadTransform(), quadRect, shaderMatrixLocatio n);
558 } 562 }
559 563
560 void CCRendererGL::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidCo lorDrawQuad* quad) 564 void CCRendererGL::drawSolidColorQuad(const DrawingFrame& frame, const CCSolidCo lorDrawQuad* quad)
561 { 565 {
562 const SolidColorProgram* program = solidColorProgram(); 566 const SolidColorProgram* program = solidColorProgram();
563 GLC(context(), context()->useProgram(program->program())); 567 GLC(context(), context()->useProgram(program->program()));
564 568
565 SkColor color = quad->color(); 569 SkColor color = quad->color();
566 float opacity = quad->opacity(); 570 float opacity = quad->opacity();
567 float alpha = (SkColorGetA(color) / 255.0) * opacity; 571 float alpha = (SkColorGetA(color) / 255.0) * opacity;
(...skipping 23 matching lines...) Expand all
591 uniforms.pointLocation = program->vertexShader().pointLocation(); 595 uniforms.pointLocation = program->vertexShader().pointLocation();
592 596
593 uniforms.samplerLocation = program->fragmentShader().samplerLocation(); 597 uniforms.samplerLocation = program->fragmentShader().samplerLocation();
594 uniforms.alphaLocation = program->fragmentShader().alphaLocation(); 598 uniforms.alphaLocation = program->fragmentShader().alphaLocation();
595 uniforms.fragmentTexTransformLocation = program->fragmentShader().fragmentTe xTransformLocation(); 599 uniforms.fragmentTexTransformLocation = program->fragmentShader().fragmentTe xTransformLocation();
596 uniforms.edgeLocation = program->fragmentShader().edgeLocation(); 600 uniforms.edgeLocation = program->fragmentShader().edgeLocation();
597 } 601 }
598 602
599 void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad) 603 void CCRendererGL::drawTileQuad(const DrawingFrame& frame, const CCTileDrawQuad* quad)
600 { 604 {
605 IntRect quadRect = quad->quadRect();
601 IntRect tileRect = quad->quadVisibleRect(); 606 IntRect tileRect = quad->quadVisibleRect();
602 607
603 FloatRect clampRect(tileRect); 608 FloatRect clampRect(tileRect);
604 // Clamp texture coordinates to avoid sampling outside the layer 609 // Clamp texture coordinates to avoid sampling outside the layer
605 // by deflating the tile region half a texel or half a texel 610 // by deflating the tile region half a texel or half a texel
606 // minus epsilon for one pixel layers. The resulting clamp region 611 // minus epsilon for one pixel layers. The resulting clamp region
607 // is mapped to the unit square by the vertex shader and mapped 612 // is mapped to the unit square by the vertex shader and mapped
608 // back to normalized texture coordinates by the fragment shader 613 // back to normalized texture coordinates by the fragment shader
609 // after being clamped to 0-1 range. 614 // after being clamped to 0-1 range.
610 const float epsilon = 1 / 1024.0f; 615 const float epsilon = 1 / 1024.0f;
611 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon); 616 float clampX = min(0.5, clampRect.width() / 2.0 - epsilon);
612 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon); 617 float clampY = min(0.5, clampRect.height() / 2.0 - epsilon);
613 clampRect.inflateX(-clampX); 618 clampRect.inflateX(-clampX);
614 clampRect.inflateY(-clampY); 619 clampRect.inflateY(-clampY);
615 FloatSize clampOffset = clampRect.minXMinYCorner() - FloatRect(tileRect).min XMinYCorner(); 620 FloatSize clampOffset = clampRect.minXMinYCorner() - FloatRect(tileRect).min XMinYCorner();
616 621
617 FloatPoint textureOffset = quad->textureOffset() + clampOffset + 622 FloatPoint textureOffset = static_cast<IntPoint>(quad->textureOffset()) + cl ampOffset +
618 IntPoint(tileRect.location() - quad->quadRect().l ocation()); 623 IntPoint(tileRect.location() - quadRect.location( ));
619 624
620 // Map clamping rectangle to unit square. 625 // Map clamping rectangle to unit square.
621 float vertexTexTranslateX = -clampRect.x() / clampRect.width(); 626 float vertexTexTranslateX = -clampRect.x() / clampRect.width();
622 float vertexTexTranslateY = -clampRect.y() / clampRect.height(); 627 float vertexTexTranslateY = -clampRect.y() / clampRect.height();
623 float vertexTexScaleX = tileRect.width() / clampRect.width(); 628 float vertexTexScaleX = tileRect.width() / clampRect.width();
624 float vertexTexScaleY = tileRect.height() / clampRect.height(); 629 float vertexTexScaleY = tileRect.height() / clampRect.height();
625 630
626 // Map to normalized texture coordinates. 631 // Map to normalized texture coordinates.
627 const IntSize& textureSize = quad->textureSize(); 632 IntSize textureSize = quad->textureSize();
628 float fragmentTexTranslateX = textureOffset.x() / textureSize.width(); 633 float fragmentTexTranslateX = textureOffset.x() / textureSize.width();
629 float fragmentTexTranslateY = textureOffset.y() / textureSize.height(); 634 float fragmentTexTranslateY = textureOffset.y() / textureSize.height();
630 float fragmentTexScaleX = clampRect.width() / textureSize.width(); 635 float fragmentTexScaleX = clampRect.width() / textureSize.width();
631 float fragmentTexScaleY = clampRect.height() / textureSize.height(); 636 float fragmentTexScaleY = clampRect.height() / textureSize.height();
632 637
633 638
634 FloatQuad localQuad; 639 FloatQuad localQuad;
635 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform(); 640 WebTransformationMatrix deviceTransform = WebTransformationMatrix(frame.wind owMatrix * frame.projectionMatrix * quad->quadTransform()).to2dTransform();
636 if (!deviceTransform.isInvertible()) 641 if (!deviceTransform.isInvertible())
637 return; 642 return;
638 643
639 bool clipped = false; 644 bool clipped = false;
640 FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(q uad->visibleContentRect()), clipped); 645 FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(s tatic_cast<IntRect>(quad->visibleContentRect())), clipped);
641 ASSERT(!clipped); 646 ASSERT(!clipped);
642 647
643 TileProgramUniforms uniforms; 648 TileProgramUniforms uniforms;
644 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens 649 // For now, we simply skip anti-aliasing with the quad is clipped. This only happens
645 // on perspective transformed layers that go partially behind the camera. 650 // on perspective transformed layers that go partially behind the camera.
646 if (quad->isAntialiased() && !clipped) { 651 if (quad->isAntialiased() && !clipped) {
647 if (quad->swizzleContents()) 652 if (quad->swizzleContents())
648 tileUniformLocation(tileProgramSwizzleAA(), uniforms); 653 tileUniformLocation(tileProgramSwizzleAA(), uniforms);
649 else 654 else
650 tileUniformLocation(tileProgramAA(), uniforms); 655 tileUniformLocation(tileProgramAA(), uniforms);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 ASSERT(!clipped); 705 ASSERT(!clipped);
701 topRight = CCMathUtil::mapPoint(deviceTransform, topRight, clipped); 706 topRight = CCMathUtil::mapPoint(deviceTransform, topRight, clipped);
702 ASSERT(!clipped); 707 ASSERT(!clipped);
703 708
704 CCLayerQuad::Edge bottomEdge(bottomRight, bottomLeft); 709 CCLayerQuad::Edge bottomEdge(bottomRight, bottomLeft);
705 CCLayerQuad::Edge leftEdge(bottomLeft, topLeft); 710 CCLayerQuad::Edge leftEdge(bottomLeft, topLeft);
706 CCLayerQuad::Edge topEdge(topLeft, topRight); 711 CCLayerQuad::Edge topEdge(topLeft, topRight);
707 CCLayerQuad::Edge rightEdge(topRight, bottomRight); 712 CCLayerQuad::Edge rightEdge(topRight, bottomRight);
708 713
709 // Only apply anti-aliasing to edges not clipped by culling or scissorin g. 714 // Only apply anti-aliasing to edges not clipped by culling or scissorin g.
710 if (quad->topEdgeAA() && tileRect.y() == quad->quadRect().y()) 715 if (quad->topEdgeAA() && tileRect.y() == quadRect.y())
711 topEdge = deviceLayerEdges.top(); 716 topEdge = deviceLayerEdges.top();
712 if (quad->leftEdgeAA() && tileRect.x() == quad->quadRect().x()) 717 if (quad->leftEdgeAA() && tileRect.x() == quadRect.x())
713 leftEdge = deviceLayerEdges.left(); 718 leftEdge = deviceLayerEdges.left();
714 if (quad->rightEdgeAA() && tileRect.maxX() == quad->quadRect().maxX()) 719 if (quad->rightEdgeAA() && tileRect.maxX() == quadRect.maxX())
715 rightEdge = deviceLayerEdges.right(); 720 rightEdge = deviceLayerEdges.right();
716 if (quad->bottomEdgeAA() && tileRect.maxY() == quad->quadRect().maxY()) 721 if (quad->bottomEdgeAA() && tileRect.maxY() == quadRect.maxY())
717 bottomEdge = deviceLayerEdges.bottom(); 722 bottomEdge = deviceLayerEdges.bottom();
718 723
719 float sign = FloatQuad(tileRect).isCounterclockwise() ? -1 : 1; 724 float sign = FloatQuad(tileRect).isCounterclockwise() ? -1 : 1;
720 bottomEdge.scale(sign); 725 bottomEdge.scale(sign);
721 leftEdge.scale(sign); 726 leftEdge.scale(sign);
722 topEdge.scale(sign); 727 topEdge.scale(sign);
723 rightEdge.scale(sign); 728 rightEdge.scale(sign);
724 729
725 // Create device space quad. 730 // Create device space quad.
726 CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); 731 CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 // initialized to that value! Therefore, premultipliedAlpha being false is the first 904 // initialized to that value! Therefore, premultipliedAlpha being false is the first
900 // situation we can generally see an alpha channel less than 1.0 coming out of the 905 // situation we can generally see an alpha channel less than 1.0 coming out of the
901 // compositor. This is causing platform differences in some layout tests (see 906 // compositor. This is causing platform differences in some layout tests (see
902 // https://bugs.webkit.org/show_bug.cgi?id=82412), so in this situation, use a separate 907 // https://bugs.webkit.org/show_bug.cgi?id=82412), so in this situation, use a separate
903 // blend function for the alpha channel to avoid modifying it. Don't use colorMask for this 908 // blend function for the alpha channel to avoid modifying it. Don't use colorMask for this
904 // as it has performance implications on some platforms. 909 // as it has performance implications on some platforms.
905 GLC(context(), context()->blendFuncSeparate(GraphicsContext3D::SRC_ALPHA , GraphicsContext3D::ONE_MINUS_SRC_ALPHA, GraphicsContext3D::ZERO, GraphicsConte xt3D::ONE)); 910 GLC(context(), context()->blendFuncSeparate(GraphicsContext3D::SRC_ALPHA , GraphicsContext3D::ONE_MINUS_SRC_ALPHA, GraphicsContext3D::ZERO, GraphicsConte xt3D::ONE));
906 } 911 }
907 912
908 setShaderOpacity(quad->opacity(), binding.alphaLocation); 913 setShaderOpacity(quad->opacity(), binding.alphaLocation);
909 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat rixLocation); 914 drawQuadGeometry(frame, quad->quadTransform(), static_cast<IntRect>(quad->qu adRect()), binding.matrixLocation);
910 915
911 if (!quad->premultipliedAlpha()) 916 if (!quad->premultipliedAlpha())
912 GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsCont ext3D::ONE_MINUS_SRC_ALPHA)); 917 GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsCont ext3D::ONE_MINUS_SRC_ALPHA));
913 } 918 }
914 919
915 void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfac eDrawQuad* quad) 920 void CCRendererGL::drawIOSurfaceQuad(const DrawingFrame& frame, const CCIOSurfac eDrawQuad* quad)
916 { 921 {
917 ASSERT(CCProxy::isImplThread()); 922 ASSERT(CCProxy::isImplThread());
918 TexTransformTextureProgramBinding binding; 923 TexTransformTextureProgramBinding binding;
919 binding.set(textureIOSurfaceProgram()); 924 binding.set(textureIOSurfaceProgram());
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 } 1523 }
1519 1524
1520 bool CCRendererGL::isContextLost() 1525 bool CCRendererGL::isContextLost()
1521 { 1526 {
1522 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO R); 1527 return (m_context->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERRO R);
1523 } 1528 }
1524 1529
1525 } // namespace cc 1530 } // namespace cc
1526 1531
1527 #endif // USE(ACCELERATED_COMPOSITING) 1532 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCRenderPassTest.cpp ('k') | cc/CCRendererGLTest.cpp » ('j') | cc/scoped_ptr_hash_map.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698