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

Side by Side Diff: cc/render_surface_impl.cc

Issue 11411050: cc: Make the DrawQuad subclasses into struct-like classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 1 month 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_unittest.cc ('k') | cc/scrollbar_layer_impl.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 "cc/render_surface_impl.h" 5 #include "cc/render_surface_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 { 196 {
197 DCHECK(!forReplica || m_owningLayer->hasReplica()); 197 DCHECK(!forReplica || m_owningLayer->hasReplica());
198 198
199 gfx::Rect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer); 199 gfx::Rect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
200 const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTra nsform : m_drawTransform; 200 const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTra nsform : m_drawTransform;
201 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadSta te::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity).Pas s()); 201 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadSta te::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity).Pas s());
202 202
203 if (m_owningLayer->showDebugBorders()) { 203 if (m_owningLayer->showDebugBorders()) {
204 SkColor color = forReplica ? DebugColors::SurfaceReplicaBorderColor() : DebugColors::SurfaceBorderColor(); 204 SkColor color = forReplica ? DebugColors::SurfaceReplicaBorderColor() : DebugColors::SurfaceBorderColor();
205 float width = forReplica ? DebugColors::SurfaceReplicaBorderWidth(m_owni ngLayer->layerTreeHostImpl()) : DebugColors::SurfaceBorderWidth(m_owningLayer->l ayerTreeHostImpl()); 205 float width = forReplica ? DebugColors::SurfaceReplicaBorderWidth(m_owni ngLayer->layerTreeHostImpl()) : DebugColors::SurfaceBorderWidth(m_owningLayer->l ayerTreeHostImpl());
206 quadSink.append(DebugBorderDrawQuad::create(sharedQuadState, contentRect (), color, width).PassAs<DrawQuad>(), appendQuadsData); 206 scoped_ptr<DebugBorderDrawQuad> debugBorderQuad = DebugBorderDrawQuad::C reate();
207 debugBorderQuad->SetNew(sharedQuadState, contentRect(), color, width);
208 quadSink.append(debugBorderQuad.PassAs<DrawQuad>(), appendQuadsData);
207 } 209 }
208 210
209 // FIXME: By using the same RenderSurfaceImpl for both the content and its r eflection, 211 // FIXME: By using the same RenderSurfaceImpl for both the content and its r eflection,
210 // it's currently not possible to apply a separate mask to the reflection la yer 212 // it's currently not possible to apply a separate mask to the reflection la yer
211 // or correctly handle opacity in reflections (opacity must be applied after drawing 213 // or correctly handle opacity in reflections (opacity must be applied after drawing
212 // both the layer and its reflection). The solution is to introduce yet anot her RenderSurfaceImpl 214 // both the layer and its reflection). The solution is to introduce yet anot her RenderSurfaceImpl
213 // to draw the layer and its reflection in. For now we only apply a separate reflection 215 // to draw the layer and its reflection in. For now we only apply a separate reflection
214 // mask if the contents don't have a mask of their own. 216 // mask if the contents don't have a mask of their own.
215 LayerImpl* maskLayer = m_owningLayer->maskLayer(); 217 LayerImpl* maskLayer = m_owningLayer->maskLayer();
216 if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().IsEmpty( ))) 218 if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().IsEmpty( )))
(...skipping 12 matching lines...) Expand all
229 if (maskLayer) { 231 if (maskLayer) {
230 maskTexCoordScaleX = contentRect().width() / maskLayer->contentsScaleX() / maskLayer->bounds().width(); 232 maskTexCoordScaleX = contentRect().width() / maskLayer->contentsScaleX() / maskLayer->bounds().width();
231 maskTexCoordScaleY = contentRect().height() / maskLayer->contentsScaleY( ) / maskLayer->bounds().height(); 233 maskTexCoordScaleY = contentRect().height() / maskLayer->contentsScaleY( ) / maskLayer->bounds().height();
232 maskTexCoordOffsetX = static_cast<float>(contentRect().x()) / contentRec t().width() * maskTexCoordScaleX; 234 maskTexCoordOffsetX = static_cast<float>(contentRect().x()) / contentRec t().width() * maskTexCoordScaleX;
233 maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRec t().height() * maskTexCoordScaleY; 235 maskTexCoordOffsetY = static_cast<float>(contentRect().y()) / contentRec t().height() * maskTexCoordScaleY;
234 } 236 }
235 237
236 ResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->content sResourceId() : 0; 238 ResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->content sResourceId() : 0;
237 gfx::Rect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : gfx::Rect(); 239 gfx::Rect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : gfx::Rect();
238 240
239 quadSink.append(RenderPassDrawQuad::create(sharedQuadState, contentRect(), r enderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame, 241 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create();
240 maskTexCoordScaleX, maskTexCoordS caleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<DrawQuad>(), appendQuads Data); 242 quad->SetNew(sharedQuadState, contentRect(), renderPassId, forReplica, maskR esourceId, contentsChangedSinceLastFrame,
243 maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, ma skTexCoordOffsetY);
244 quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData);
241 } 245 }
242 246
243 } // namespace cc 247 } // namespace cc
OLDNEW
« no previous file with comments | « cc/render_pass_unittest.cc ('k') | cc/scrollbar_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698