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

Side by Side Diff: cc/gl_renderer.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes 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
« no previous file with comments | « cc/draw_quad.cc ('k') | cc/software_renderer.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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/gl_renderer.h" 7 #include "cc/gl_renderer.h"
8 8
9 #include "CCDamageTracker.h" 9 #include "CCDamageTracker.h"
10 #include "CCLayerQuad.h" 10 #include "CCLayerQuad.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 return scoped_ptr<ScopedTexture>(); 376 return scoped_ptr<ScopedTexture>();
377 DCHECK(!frame.currentTexture); 377 DCHECK(!frame.currentTexture);
378 378
379 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused). 379 // FIXME: Do a single readback for both the surface and replica and cache th e filtered results (once filter textures are not reused).
380 gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(content sDeviceTransform, sharedGeometryQuad().boundingBox())); 380 gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(content sDeviceTransform, sharedGeometryQuad().boundingBox()));
381 381
382 int top, right, bottom, left; 382 int top, right, bottom, left;
383 filters.getOutsets(top, right, bottom, left); 383 filters.getOutsets(top, right, bottom, left);
384 deviceRect.Inset(-left, -top, -right, -bottom); 384 deviceRect.Inset(-left, -top, -right, -bottom);
385 385
386 deviceRect = deviceRect.Intersect(frame.currentRenderPass->outputRect()); 386 deviceRect.Intersect(frame.currentRenderPass->outputRect());
387 387
388 scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_ resourceProvider); 388 scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_ resourceProvider);
389 if (!getFramebufferTexture(deviceBackgroundTexture.get(), cc::IntRect(device Rect))) 389 if (!getFramebufferTexture(deviceBackgroundTexture.get(), cc::IntRect(device Rect)))
390 return scoped_ptr<ScopedTexture>(); 390 return scoped_ptr<ScopedTexture>();
391 391
392 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get()); 392 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get());
393 if (!filteredDeviceBackground.getTexture()) 393 if (!filteredDeviceBackground.getTexture())
394 return scoped_ptr<ScopedTexture>(); 394 return scoped_ptr<ScopedTexture>();
395 395
396 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture()); 396 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture());
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 931
932 setShaderOpacity(quad->opacity(), binding.alphaLocation); 932 setShaderOpacity(quad->opacity(), binding.alphaLocation);
933 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat rixLocation); 933 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat rixLocation);
934 934
935 GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); 935 GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0));
936 } 936 }
937 937
938 void GLRenderer::finishDrawingFrame(DrawingFrame& frame) 938 void GLRenderer::finishDrawingFrame(DrawingFrame& frame)
939 { 939 {
940 m_currentFramebufferLock.reset(); 940 m_currentFramebufferLock.reset();
941 m_swapBufferRect = m_swapBufferRect.Union(gfx::ToEnclosingRect(frame.rootDam ageRect)); 941 m_swapBufferRect.Union(gfx::ToEnclosingRect(frame.rootDamageRect));
942 942
943 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); 943 GLC(m_context, m_context->disable(GL_SCISSOR_TEST));
944 GLC(m_context, m_context->disable(GL_BLEND)); 944 GLC(m_context, m_context->disable(GL_BLEND));
945 } 945 }
946 946
947 bool GLRenderer::flippedFramebuffer() const 947 bool GLRenderer::flippedFramebuffer() const
948 { 948 {
949 return true; 949 return true;
950 } 950 }
951 951
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 bool GLRenderer::swapBuffers() 1029 bool GLRenderer::swapBuffers()
1030 { 1030 {
1031 DCHECK(m_visible); 1031 DCHECK(m_visible);
1032 DCHECK(!m_isFramebufferDiscarded); 1032 DCHECK(!m_isFramebufferDiscarded);
1033 1033
1034 TRACE_EVENT0("cc", "GLRenderer::swapBuffers"); 1034 TRACE_EVENT0("cc", "GLRenderer::swapBuffers");
1035 // We're done! Time to swapbuffers! 1035 // We're done! Time to swapbuffers!
1036 1036
1037 if (m_capabilities.usingPartialSwap) { 1037 if (m_capabilities.usingPartialSwap) {
1038 // If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport) 1038 // If supported, we can save significant bandwidth by only swapping the damaged/scissored region (clamped to the viewport)
1039 m_swapBufferRect = m_swapBufferRect.Intersect(gfx::Rect(gfx::Point(), vi ewportSize())); 1039 m_swapBufferRect.Intersect(gfx::Rect(gfx::Point(), viewportSize()));
1040 int flippedYPosOfRectBottom = viewportHeight() - m_swapBufferRect.y() - m_swapBufferRect.height(); 1040 int flippedYPosOfRectBottom = viewportHeight() - m_swapBufferRect.y() - m_swapBufferRect.height();
1041 m_context->postSubBufferCHROMIUM(m_swapBufferRect.x(), flippedYPosOfRect Bottom, m_swapBufferRect.width(), m_swapBufferRect.height()); 1041 m_context->postSubBufferCHROMIUM(m_swapBufferRect.x(), flippedYPosOfRect Bottom, m_swapBufferRect.width(), m_swapBufferRect.height());
1042 } else { 1042 } else {
1043 // Note that currently this has the same effect as swapBuffers; we shoul d 1043 // Note that currently this has the same effect as swapBuffers; we shoul d
1044 // consider exposing a different entry point on WebGraphicsContext3D. 1044 // consider exposing a different entry point on WebGraphicsContext3D.
1045 m_context->prepareTexture(); 1045 m_context->prepareTexture();
1046 } 1046 }
1047 1047
1048 m_swapBufferRect = gfx::Rect(); 1048 m_swapBufferRect = gfx::Rect();
1049 1049
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 1513
1514 releaseRenderPassTextures(); 1514 releaseRenderPassTextures();
1515 } 1515 }
1516 1516
1517 bool GLRenderer::isContextLost() 1517 bool GLRenderer::isContextLost()
1518 { 1518 {
1519 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1519 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1520 } 1520 }
1521 1521
1522 } // namespace cc 1522 } // namespace cc
OLDNEW
« no previous file with comments | « cc/draw_quad.cc ('k') | cc/software_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698