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

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: Updated to ToT (past the Great Renaming) 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
« no previous file with comments | « cc/render_pass.h ('k') | cc/render_pass_unittest.cc » ('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 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 "third_party/skia/include/core/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<RenderPass> RenderPass::create(Id id, gfx::Rect outputRect, const Web Kit::WebTransformationMatrix& transformToRootTarget) 21 scoped_ptr<RenderPass> RenderPass::create(Id id, gfx::Rect outputRect, const Web Kit::WebTransformationMatrix& transformToRootTarget)
21 { 22 {
22 return make_scoped_ptr(new RenderPass(id, outputRect, transformToRootTarget) ); 23 return make_scoped_ptr(new RenderPass(id, outputRect, transformToRootTarget) );
23 } 24 }
24 25
25 RenderPass::RenderPass(Id id, gfx::Rect outputRect, const WebKit::WebTransformat ionMatrix& transformToRootTarget) 26 RenderPass::RenderPass(Id id, gfx::Rect outputRect, const WebKit::WebTransformat ionMatrix& 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 RenderPass::~RenderPass() 38 RenderPass::~RenderPass()
37 { 39 {
40 SkSafeUnref(m_filter);
38 } 41 }
39 42
40 scoped_ptr<RenderPass> RenderPass::copy(Id newId) const 43 scoped_ptr<RenderPass> RenderPass::copy(Id newId) const
41 { 44 {
42 DCHECK(newId != m_id); 45 DCHECK(newId != m_id);
43 46
44 scoped_ptr<RenderPass> copyPass(create(newId, m_outputRect, m_transformToRoo tTarget)); 47 scoped_ptr<RenderPass> copyPass(create(newId, m_outputRect, m_transformToRoo tTarget));
45 copyPass->setDamageRect(m_damageRect); 48 copyPass->setDamageRect(m_damageRect);
46 copyPass->setHasTransparentBackground(m_hasTransparentBackground); 49 copyPass->setHasTransparentBackground(m_hasTransparentBackground);
47 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface); 50 copyPass->setHasOcclusionFromOutsideTargetSurface(m_hasOcclusionFromOutsideT argetSurface);
48 copyPass->setFilters(m_filters); 51 copyPass->setFilters(m_filters);
49 copyPass->setBackgroundFilters(m_backgroundFilters); 52 copyPass->setBackgroundFilters(m_backgroundFilters);
53 copyPass->setFilter(m_filter);
50 return copyPass.Pass(); 54 return copyPass.Pass();
51 } 55 }
52 56
53 void RenderPass::appendQuadsForLayer(LayerImpl* layer, OcclusionTrackerImpl* occ lusionTracker, AppendQuadsData& appendQuadsData) 57 void RenderPass::appendQuadsForLayer(LayerImpl* layer, OcclusionTrackerImpl* occ lusionTracker, AppendQuadsData& appendQuadsData)
54 { 58 {
55 const bool forSurface = false; 59 const bool forSurface = false;
56 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTra cker, layer->hasDebugBorders(), forSurface); 60 QuadCuller quadCuller(m_quadList, m_sharedQuadStateList, layer, occlusionTra cker, layer->hasDebugBorders(), forSurface);
57 61
58 layer->appendQuads(quadCuller, appendQuadsData); 62 layer->appendQuads(quadCuller, appendQuadsData);
59 } 63 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse(); 100 WebTransformationMatrix transformToLayerSpace = rootLayer->screenSpaceTransf orm().inverse();
97 Vector<WebCore::IntRect> fillRects = fillRegion.rects(); 101 Vector<WebCore::IntRect> fillRects = fillRegion.rects();
98 for (size_t i = 0; i < fillRects.size(); ++i) { 102 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. 103 // The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient.
100 IntRect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc:: IntRect(fillRects[i])); 104 IntRect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc:: IntRect(fillRects[i]));
101 // Skip the quad culler and just append the quads directly to avoid occl usion checks. 105 // Skip the quad culler and just append the quads directly to avoid occl usion checks.
102 m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>()); 106 m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>());
103 } 107 }
104 } 108 }
105 109
110 void RenderPass::setFilter(SkImageFilter* filter) {
111 SkRefCnt_SafeAssign(m_filter, filter);
112 }
113
106 } // namespace cc 114 } // namespace cc
OLDNEW
« no previous file with comments | « cc/render_pass.h ('k') | cc/render_pass_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698