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

Side by Side Diff: cc/direct_renderer.cc

Issue 11275113: Remove most remaining references to IntRect and FloatRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compositor bindings 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/direct_renderer.h ('k') | cc/float_quad_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/direct_renderer.h" 7 #include "cc/direct_renderer.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 , flippedY(false) 59 , flippedY(false)
60 { 60 {
61 } 61 }
62 62
63 DirectRenderer::DrawingFrame::~DrawingFrame() 63 DirectRenderer::DrawingFrame::~DrawingFrame()
64 { 64 {
65 } 65 }
66 66
67 // 67 //
68 // static 68 // static
69 FloatRect DirectRenderer::quadVertexRect() 69 gfx::RectF DirectRenderer::quadVertexRect()
70 { 70 {
71 return FloatRect(-0.5, -0.5, 1, 1); 71 return gfx::RectF(-0.5, -0.5, 1, 1);
72 } 72 }
73 73
74 // static 74 // static
75 void DirectRenderer::quadRectTransform(WebKit::WebTransformationMatrix* quadRect Transform, const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect F& quadRect) 75 void DirectRenderer::quadRectTransform(WebKit::WebTransformationMatrix* quadRect Transform, const WebKit::WebTransformationMatrix& quadTransform, const gfx::Rect F& quadRect)
76 { 76 {
77 *quadRectTransform = quadTransform; 77 *quadRectTransform = quadTransform;
78 quadRectTransform->translate(0.5 * quadRect.width() + quadRect.x(), 0.5 * qu adRect.height() + quadRect.y()); 78 quadRectTransform->translate(0.5 * quadRect.width() + quadRect.x(), 0.5 * qu adRect.height() + quadRect.y());
79 quadRectTransform->scaleNonUniform(quadRect.width(), quadRect.height()); 79 quadRectTransform->scaleNonUniform(quadRect.width(), quadRect.height());
80 } 80 }
81 81
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 std::vector<RenderPass::Id> passesToDelete; 124 std::vector<RenderPass::Id> passesToDelete;
125 ScopedPtrHashMap<RenderPass::Id, CachedTexture>::const_iterator passIterator ; 125 ScopedPtrHashMap<RenderPass::Id, CachedTexture>::const_iterator passIterator ;
126 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa ssTextures.end(); ++passIterator) { 126 for (passIterator = m_renderPassTextures.begin(); passIterator != m_renderPa ssTextures.end(); ++passIterator) {
127 base::hash_map<RenderPass::Id, const RenderPass*>::const_iterator it = r enderPassesInFrame.find(passIterator->first); 127 base::hash_map<RenderPass::Id, const RenderPass*>::const_iterator it = r enderPassesInFrame.find(passIterator->first);
128 if (it == renderPassesInFrame.end()) { 128 if (it == renderPassesInFrame.end()) {
129 passesToDelete.push_back(passIterator->first); 129 passesToDelete.push_back(passIterator->first);
130 continue; 130 continue;
131 } 131 }
132 132
133 const RenderPass* renderPassInFrame = it->second; 133 const RenderPass* renderPassInFrame = it->second;
134 const IntSize& requiredSize = renderPassTextureSize(renderPassInFrame); 134 const gfx::Size& requiredSize = renderPassTextureSize(renderPassInFrame) ;
135 GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame); 135 GLenum requiredFormat = renderPassTextureFormat(renderPassInFrame);
136 CachedTexture* texture = passIterator->second; 136 CachedTexture* texture = passIterator->second;
137 DCHECK(texture); 137 DCHECK(texture);
138 138
139 if (texture->id() && (texture->size() != requiredSize || texture->format () != requiredFormat)) 139 if (texture->id() && (texture->size() != requiredSize || texture->format () != requiredFormat))
140 texture->free(); 140 texture->free();
141 } 141 }
142 142
143 // Delete RenderPass textures from the previous frame that will not be used again. 143 // Delete RenderPass textures from the previous frame that will not be used again.
144 for (size_t i = 0; i < passesToDelete.size(); ++i) 144 for (size_t i = 0; i < passesToDelete.size(); ++i)
(...skipping 25 matching lines...) Expand all
170 } 170 }
171 171
172 void DirectRenderer::drawRenderPass(DrawingFrame& frame, const RenderPass* rende rPass) 172 void DirectRenderer::drawRenderPass(DrawingFrame& frame, const RenderPass* rende rPass)
173 { 173 {
174 if (!useRenderPass(frame, renderPass)) 174 if (!useRenderPass(frame, renderPass))
175 return; 175 return;
176 176
177 frame.scissorRectInRenderPassSpace = frame.currentRenderPass->outputRect(); 177 frame.scissorRectInRenderPassSpace = frame.currentRenderPass->outputRect();
178 if (frame.rootDamageRect != frame.rootRenderPass->outputRect()) { 178 if (frame.rootDamageRect != frame.rootRenderPass->outputRect()) {
179 WebTransformationMatrix inverseTransformToRoot = frame.currentRenderPass ->transformToRootTarget().inverse(); 179 WebTransformationMatrix inverseTransformToRoot = frame.currentRenderPass ->transformToRootTarget().inverse();
180 gfx::RectF damageRectInRenderPassSpace = MathUtil::projectClippedRect(in verseTransformToRoot, cc::FloatRect(frame.rootDamageRect)); 180 gfx::RectF damageRectInRenderPassSpace = MathUtil::projectClippedRect(in verseTransformToRoot, frame.rootDamageRect);
181 frame.scissorRectInRenderPassSpace.Intersect(damageRectInRenderPassSpace ); 181 frame.scissorRectInRenderPassSpace.Intersect(damageRectInRenderPassSpace );
182 } 182 }
183 183
184 enableScissorTestRect(moveScissorToWindowSpace(frame, frame.scissorRectInRen derPassSpace)); 184 enableScissorTestRect(moveScissorToWindowSpace(frame, frame.scissorRectInRen derPassSpace));
185 clearFramebuffer(frame); 185 clearFramebuffer(frame);
186 186
187 const QuadList& quadList = renderPass->quadList(); 187 const QuadList& quadList = renderPass->quadList();
188 for (QuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it) { 188 for (QuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it) {
189 gfx::RectF quadScissorRect = gfx::IntersectRects(frame.scissorRectInRend erPassSpace, (*it)->clippedRectInTarget()); 189 gfx::RectF quadScissorRect = gfx::IntersectRects(frame.scissorRectInRend erPassSpace, (*it)->clippedRectInTarget());
190 if (!quadScissorRect.IsEmpty()) { 190 if (!quadScissorRect.IsEmpty()) {
(...skipping 27 matching lines...) Expand all
218 return bindFramebufferToTexture(frame, texture, renderPass->outputRect()); 218 return bindFramebufferToTexture(frame, texture, renderPass->outputRect());
219 } 219 }
220 220
221 bool DirectRenderer::haveCachedResourcesForRenderPassId(RenderPass::Id id) const 221 bool DirectRenderer::haveCachedResourcesForRenderPassId(RenderPass::Id id) const
222 { 222 {
223 CachedTexture* texture = m_renderPassTextures.get(id); 223 CachedTexture* texture = m_renderPassTextures.get(id);
224 return texture && texture->id() && texture->isComplete(); 224 return texture && texture->id() && texture->isComplete();
225 } 225 }
226 226
227 // static 227 // static
228 IntSize DirectRenderer::renderPassTextureSize(const RenderPass* pass) 228 gfx::Size DirectRenderer::renderPassTextureSize(const RenderPass* pass)
229 { 229 {
230 return cc::IntSize(pass->outputRect().size()); 230 return pass->outputRect().size();
231 } 231 }
232 232
233 // static 233 // static
234 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*) 234 GLenum DirectRenderer::renderPassTextureFormat(const RenderPass*)
235 { 235 {
236 return GL_RGBA; 236 return GL_RGBA;
237 } 237 }
238 238
239 } 239 }
OLDNEW
« no previous file with comments | « cc/direct_renderer.h ('k') | cc/float_quad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698