Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/render_pass.h" | 7 #include "cc/render_pass.h" |
| 8 | 8 |
| 9 #include "CCLayerImpl.h" | 9 #include "CCLayerImpl.h" |
| 10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
| 11 #include "cc/occlusion_tracker.h" | 11 #include "cc/occlusion_tracker.h" |
| 12 #include "cc/quad_culler.h" | 12 #include "cc/quad_culler.h" |
| 13 #include "cc/shared_quad_state.h" | 13 #include "cc/shared_quad_state.h" |
| 14 #include "cc/solid_color_draw_quad.h" | 14 #include "cc/solid_color_draw_quad.h" |
| 15 #include "SkImageFilter.h" | |
|
danakj
2012/10/22 18:00:43
nit: sorting after rebase
| |
| 16 #include "cc/shared_quad_state.h" | |
| 17 #include "cc/solid_color_draw_quad.h" | |
| 15 | 18 |
| 16 using WebKit::WebTransformationMatrix; | 19 using WebKit::WebTransformationMatrix; |
| 17 | 20 |
| 18 namespace cc { | 21 namespace cc { |
| 19 | 22 |
| 20 scoped_ptr<CCRenderPass> CCRenderPass::create(Id id, gfx::Rect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) | 23 scoped_ptr<CCRenderPass> CCRenderPass::create(Id id, gfx::Rect outputRect, const WebKit::WebTransformationMatrix& transformToRootTarget) |
| 21 { | 24 { |
| 22 return make_scoped_ptr(new CCRenderPass(id, outputRect, transformToRootTarge t)); | 25 return make_scoped_ptr(new CCRenderPass(id, outputRect, transformToRootTarge t)); |
| 23 } | 26 } |
| 24 | 27 |
| 25 CCRenderPass::CCRenderPass(Id id, gfx::Rect outputRect, const WebKit::WebTransfo rmationMatrix& transformToRootTarget) | 28 CCRenderPass::CCRenderPass(Id id, gfx::Rect outputRect, const WebKit::WebTransfo rmationMatrix& transformToRootTarget) |
| 26 : m_id(id) | 29 : m_id(id) |
| 27 , m_transformToRootTarget(transformToRootTarget) | 30 , m_transformToRootTarget(transformToRootTarget) |
| 28 , m_outputRect(outputRect) | 31 , m_outputRect(outputRect) |
| 29 , m_hasTransparentBackground(true) | 32 , m_hasTransparentBackground(true) |
| 30 , m_hasOcclusionFromOutsideTargetSurface(false) | 33 , m_hasOcclusionFromOutsideTargetSurface(false) |
| 34 , m_filter(0) | |
| 31 { | 35 { |
| 32 DCHECK(id.layerId > 0); | 36 DCHECK(id.layerId > 0); |
| 33 DCHECK(id.index >= 0); | 37 DCHECK(id.index >= 0); |
| 34 } | 38 } |
| 35 | 39 |
| 36 CCRenderPass::~CCRenderPass() | 40 CCRenderPass::~CCRenderPass() |
| 37 { | 41 { |
| 42 SkSafeUnref(m_filter); | |
| 38 } | 43 } |
| 39 | 44 |
| 40 scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const | 45 scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const |
| 41 { | 46 { |
| 42 DCHECK(newId != m_id); | 47 DCHECK(newId != m_id); |
| 43 | 48 |
| 44 scoped_ptr<CCRenderPass> copyPass(create(newId, m_outputRect, m_transformToR ootTarget)); | 49 scoped_ptr<CCRenderPass> copyPass(create(newId, m_outputRect, m_transformToR ootTarget)); |
| 45 copyPass->setDamageRect(m_damageRect); | 50 copyPass->setDamageRect(m_damageRect); |
| 46 copyPass->setHasTransparentBackground(m_hasTransparentBackground); | 51 copyPass->setHasTransparentBackground(m_hasTransparentBackground); |
| 47 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface); | 52 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface); |
| 48 copyPass->setFilters(m_filters); | 53 copyPass->setFilters(m_filters); |
| 49 copyPass->setBackgroundFilters(m_backgroundFilters); | 54 copyPass->setBackgroundFilters(m_backgroundFilters); |
| 55 copyPass->setFilter(m_filter); | |
| 50 return copyPass.Pass(); | 56 return copyPass.Pass(); |
| 51 } | 57 } |
| 52 | 58 |
| 53 void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImp l* occlusionTracker, CCAppendQuadsData& appendQuadsData) | 59 void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImp l* occlusionTracker, CCAppendQuadsData& appendQuadsData) |
| 54 { | 60 { |
| 55 const bool forSurface = false; | 61 const bool forSurface = false; |
| 56 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT racker, layer->hasDebugBorders(), forSurface); | 62 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT racker, layer->hasDebugBorders(), forSurface); |
| 57 | 63 |
| 58 layer->appendQuads(quadCuller, appendQuadsData); | 64 layer->appendQuads(quadCuller, appendQuadsData); |
| 59 } | 65 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse(); | 102 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse(); |
| 97 Vector<WebCore::IntRect> fillRects = fillRegion.rects(); | 103 Vector<WebCore::IntRect> fillRects = fillRegion.rects(); |
| 98 for (size_t i = 0; i < fillRects.size(); ++i) { | 104 for (size_t i = 0; i < fillRects.size(); ++i) { |
| 99 // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient. | 105 // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient. |
| 100 IntRect layerRect = CCMathUtil::mapClippedRect(transformToLayerSpace, cc ::IntRect(fillRects[i])); | 106 IntRect layerRect = CCMathUtil::mapClippedRect(transformToLayerSpace, cc ::IntRect(fillRects[i])); |
| 101 // Skip the quad culler and just append the quads directly to avoid occl usion checks. | 107 // Skip the quad culler and just append the quads directly to avoid occl usion checks. |
| 102 m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRec t, screenBackgroundColor).PassAs<CCDrawQuad>()); | 108 m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRec t, screenBackgroundColor).PassAs<CCDrawQuad>()); |
| 103 } | 109 } |
| 104 } | 110 } |
| 105 | 111 |
| 112 void CCRenderPass::setFilter(SkImageFilter* filter) { | |
| 113 SkRefCnt_SafeAssign(m_filter, filter); | |
| 114 } | |
| 115 | |
| 106 } // namespace cc | 116 } // namespace cc |
| OLD | NEW |