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

Side by Side Diff: cc/render_pass.cc

Issue 11175009: Implement SkImageFilter support in the compositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add TODOs; comment out OVERRIDE. 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 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 "CCRenderPass.h" 7 #include "CCRenderPass.h"
8 8
9 #include "CCLayerImpl.h" 9 #include "CCLayerImpl.h"
10 #include "CCMathUtil.h" 10 #include "CCMathUtil.h"
11 #include "CCOcclusionTracker.h" 11 #include "CCOcclusionTracker.h"
12 #include "CCQuadCuller.h" 12 #include "CCQuadCuller.h"
13 #include "CCSharedQuadState.h" 13 #include "CCSharedQuadState.h"
14 #include "CCSolidColorDrawQuad.h" 14 #include "CCSolidColorDrawQuad.h"
15 #include "SkImageFilter.h"
15 16
16 using WebKit::WebTransformationMatrix; 17 using WebKit::WebTransformationMatrix;
17 18
18 namespace cc { 19 namespace cc {
19 20
20 scoped_ptr<CCRenderPass> CCRenderPass::create(Id id, IntRect outputRect, const W ebKit::WebTransformationMatrix& transformToRootTarget) 21 scoped_ptr<CCRenderPass> CCRenderPass::create(Id id, IntRect outputRect, const W ebKit::WebTransformationMatrix& transformToRootTarget)
21 { 22 {
22 return make_scoped_ptr(new CCRenderPass(id, outputRect, transformToRootTarge t)); 23 return make_scoped_ptr(new CCRenderPass(id, outputRect, transformToRootTarge t));
23 } 24 }
24 25
25 CCRenderPass::CCRenderPass(Id id, IntRect outputRect, const WebKit::WebTransform ationMatrix& transformToRootTarget) 26 CCRenderPass::CCRenderPass(Id id, IntRect outputRect, const WebKit::WebTransform ationMatrix& transformToRootTarget)
26 : m_id(id) 27 : m_id(id)
27 , m_transformToRootTarget(transformToRootTarget) 28 , m_transformToRootTarget(transformToRootTarget)
28 , m_outputRect(outputRect) 29 , m_outputRect(outputRect)
29 , m_hasTransparentBackground(true) 30 , m_hasTransparentBackground(true)
30 , m_hasOcclusionFromOutsideTargetSurface(false) 31 , m_hasOcclusionFromOutsideTargetSurface(false)
32 , m_filter(0)
31 { 33 {
32 DCHECK(id.layerId > 0); 34 DCHECK(id.layerId > 0);
33 DCHECK(id.index >= 0); 35 DCHECK(id.index >= 0);
34 } 36 }
35 37
36 CCRenderPass::~CCRenderPass() 38 CCRenderPass::~CCRenderPass()
37 { 39 {
38 } 40 }
39 41
40 scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const 42 scoped_ptr<CCRenderPass> CCRenderPass::copy(Id newId) const
41 { 43 {
42 DCHECK(newId != m_id); 44 DCHECK(newId != m_id);
43 45
44 scoped_ptr<CCRenderPass> copyPass(create(newId, m_outputRect, m_transformToR ootTarget)); 46 scoped_ptr<CCRenderPass> copyPass(create(newId, m_outputRect, m_transformToR ootTarget));
45 copyPass->setDamageRect(m_damageRect); 47 copyPass->setDamageRect(m_damageRect);
46 copyPass->setHasTransparentBackground(m_hasTransparentBackground); 48 copyPass->setHasTransparentBackground(m_hasTransparentBackground);
47 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface); 49 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface);
48 copyPass->setFilters(m_filters); 50 copyPass->setFilters(m_filters);
49 copyPass->setBackgroundFilters(m_backgroundFilters); 51 copyPass->setBackgroundFilters(m_backgroundFilters);
52 copyPass->setFilter(m_filter);
50 return copyPass.Pass(); 53 return copyPass.Pass();
51 } 54 }
52 55
53 void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImp l* occlusionTracker, CCAppendQuadsData& appendQuadsData) 56 void CCRenderPass::appendQuadsForLayer(CCLayerImpl* layer, CCOcclusionTrackerImp l* occlusionTracker, CCAppendQuadsData& appendQuadsData)
54 { 57 {
55 const bool forSurface = false; 58 const bool forSurface = false;
56 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT racker, layer->hasDebugBorders(), forSurface); 59 CCQuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionT racker, layer->hasDebugBorders(), forSurface);
57 60
58 layer->appendQuads(quadCuller, appendQuadsData); 61 layer->appendQuads(quadCuller, appendQuadsData);
59 } 62 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse(); 99 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse();
97 Vector<WebCore::IntRect> fillRects = fillRegion.rects(); 100 Vector<WebCore::IntRect> fillRects = fillRegion.rects();
98 for (size_t i = 0; i < fillRects.size(); ++i) { 101 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. 102 // 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])); 103 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. 104 // 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>()); 105 m_quadList.append(CCSolidColorDrawQuad::create(sharedQuadState, layerRec t, screenBackgroundColor).PassAs<CCDrawQuad>());
103 } 106 }
104 } 107 }
105 108
109 void CCRenderPass::setFilter(SkImageFilter* filter) {
110 SkRefCnt_SafeAssign(m_filter, filter);
111 }
danakj 2012/10/19 19:34:24 Same question as james, who frees this one?
Stephen White 2012/10/19 21:34:50 Done.
112
106 } // namespace cc 113 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698