Chromium Code Reviews| 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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 519 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass _id); | 519 const RenderPass* renderPass = frame.renderPassesById->get(quad->render_pass _id); |
| 520 DCHECK(renderPass); | 520 DCHECK(renderPass); |
| 521 if (!renderPass) | 521 if (!renderPass) |
| 522 return; | 522 return; |
| 523 | 523 |
| 524 gfx::Transform quadRectMatrix; | 524 gfx::Transform quadRectMatrix; |
| 525 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect); | 525 quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect); |
| 526 gfx::Transform contentsDeviceTransform = MathUtil::to2dTransform(frame.windo wMatrix * frame.projectionMatrix * quadRectMatrix); | 526 gfx::Transform contentsDeviceTransform = MathUtil::to2dTransform(frame.windo wMatrix * frame.projectionMatrix * quadRectMatrix); |
| 527 | 527 |
| 528 // Can only draw surface if device matrix is invertible. | 528 // Can only draw surface if device matrix is invertible. |
| 529 if (!contentsDeviceTransform.IsInvertible()) | 529 gfx::Transform contentsDeviceTransformInverse(gfx::Transform::kSkipInitializ ation); |
| 530 if (!contentsDeviceTransform.GetInverse(&contentsDeviceTransformInverse)) | |
| 530 return; | 531 return; |
| 531 | 532 |
| 532 gfx::Transform contentsDeviceTransformInverse = MathUtil::inverse(contentsDe viceTransform); | |
| 533 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( | 533 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( |
| 534 frame, quad, renderPass->background_filters, | 534 frame, quad, renderPass->background_filters, |
| 535 contentsDeviceTransform, contentsDeviceTransformInverse); | 535 contentsDeviceTransform, contentsDeviceTransformInverse); |
| 536 | 536 |
| 537 // FIXME: Cache this value so that we don't have to do it for both the surfa ce and its replica. | 537 // FIXME: Cache this value so that we don't have to do it for both the surfa ce and its replica. |
| 538 // Apply filters to the contents texture. | 538 // Apply filters to the contents texture. |
| 539 SkBitmap filterBitmap; | 539 SkBitmap filterBitmap; |
| 540 if (renderPass->filter) { | 540 if (renderPass->filter) { |
| 541 filterBitmap = applyImageFilter(this, renderPass->filter.get(), contents Texture, m_client->hasImplThread()); | 541 filterBitmap = applyImageFilter(this, renderPass->filter.get(), contents Texture, m_client->hasImplThread()); |
| 542 } else { | 542 } else { |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1; | 860 float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1; |
| 861 bottomEdge.scale(sign); | 861 bottomEdge.scale(sign); |
| 862 leftEdge.scale(sign); | 862 leftEdge.scale(sign); |
| 863 topEdge.scale(sign); | 863 topEdge.scale(sign); |
| 864 rightEdge.scale(sign); | 864 rightEdge.scale(sign); |
| 865 | 865 |
| 866 // Create device space quad. | 866 // Create device space quad. |
| 867 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); | 867 LayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); |
| 868 | 868 |
| 869 // 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. | 869 // 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. |
| 870 gfx::Transform deviceTransformInverse = MathUtil::inverse(deviceTransfor m); | 870 gfx::Transform inverseDeviceTransform(gfx::Transform::kSkipInitializatio n); |
| 871 localQuad = MathUtil::mapQuad(deviceTransformInverse, deviceQuad.ToQuadF (), clipped); | 871 deviceTransform.GetInverse(&inverseDeviceTransform); |
|
danakj
2012/12/19 05:23:06
We checked deviceTransform.IsInvertible way up nea
| |
| 872 localQuad = MathUtil::mapQuad(inverseDeviceTransform, deviceQuad.ToQuadF (), clipped); | |
| 872 | 873 |
| 873 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become | 874 // We should not DCHECK(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become |
| 874 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case. | 875 // clipped. To our knowledge this scenario does not need to be handled d ifferently than the unclipped case. |
| 875 } else { | 876 } else { |
| 876 // Move fragment shader transform to vertex shader. We can do this while | 877 // Move fragment shader transform to vertex shader. We can do this while |
| 877 // still producing correct results as fragmentTexTransformLocation | 878 // still producing correct results as fragmentTexTransformLocation |
| 878 // should always be non-negative when tiles are transformed in a way | 879 // should always be non-negative when tiles are transformed in a way |
| 879 // that could result in sampling outside the layer. | 880 // that could result in sampling outside the layer. |
| 880 vertexTexScaleX *= fragmentTexScaleX; | 881 vertexTexScaleX *= fragmentTexScaleX; |
| 881 vertexTexScaleY *= fragmentTexScaleY; | 882 vertexTexScaleY *= fragmentTexScaleY; |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1796 | 1797 |
| 1797 releaseRenderPassTextures(); | 1798 releaseRenderPassTextures(); |
| 1798 } | 1799 } |
| 1799 | 1800 |
| 1800 bool GLRenderer::isContextLost() | 1801 bool GLRenderer::isContextLost() |
| 1801 { | 1802 { |
| 1802 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1803 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1803 } | 1804 } |
| 1804 | 1805 |
| 1805 } // namespace cc | 1806 } // namespace cc |
| OLD | NEW |