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

Side by Side Diff: cc/gl_renderer.cc

Issue 11578019: Remove the pools from the ResourceProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-resolve against HEAD Created 8 years 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.cc ('k') | cc/heads_up_display_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 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 "cc/gl_renderer.h" 5 #include "cc/gl_renderer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 return scoped_ptr<ScopedResource>(); 477 return scoped_ptr<ScopedResource>();
478 478
479 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get(), m_client->hasImplThread()); 479 SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgr oundTexture.get(), m_client->hasImplThread());
480 if (!filteredDeviceBackground.getTexture()) 480 if (!filteredDeviceBackground.getTexture())
481 return scoped_ptr<ScopedResource>(); 481 return scoped_ptr<ScopedResource>();
482 482
483 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture()); 483 GrTexture* texture = reinterpret_cast<GrTexture*>(filteredDeviceBackground.g etTexture());
484 int filteredDeviceBackgroundTextureId = texture->getTextureHandle(); 484 int filteredDeviceBackgroundTextureId = texture->getTextureHandle();
485 485
486 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso urceProvider); 486 scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_reso urceProvider);
487 if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect.size(), GL_R GBA, ResourceProvider::TextureUsageFramebuffer)) 487 if (!backgroundTexture->Allocate(quad->rect.size(), GL_RGBA, ResourceProvide r::TextureUsageFramebuffer))
488 return scoped_ptr<ScopedResource>(); 488 return scoped_ptr<ScopedResource>();
489 489
490 const RenderPass* targetRenderPass = frame.currentRenderPass; 490 const RenderPass* targetRenderPass = frame.currentRenderPass;
491 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quad->rect); 491 bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get( ), quad->rect);
492 492
493 if (usingBackgroundTexture) { 493 if (usingBackgroundTexture) {
494 // Copy the readback pixels from device to the background texture for th e surface. 494 // Copy the readback pixels from device to the background texture for th e surface.
495 gfx::Transform deviceToFramebufferTransform; 495 gfx::Transform deviceToFramebufferTransform;
496 deviceToFramebufferTransform.Translate(quad->rect.width() / 2.0, quad->r ect.height() / 2.0); 496 deviceToFramebufferTransform.Translate(quad->rect.width() / 2.0, quad->r ect.height() / 2.0);
497 deviceToFramebufferTransform.Scale(quad->rect.width(), quad->rect.height ()); 497 deviceToFramebufferTransform.Scale(quad->rect.width(), quad->rect.height ());
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 GLC(m_context, m_context->deleteTexture(temporaryTexture)); 1448 GLC(m_context, m_context->deleteTexture(temporaryTexture));
1449 } 1449 }
1450 1450
1451 enforceMemoryPolicy(); 1451 enforceMemoryPolicy();
1452 } 1452 }
1453 1453
1454 bool GLRenderer::getFramebufferTexture(ScopedResource* texture, const gfx::Rect& deviceRect) 1454 bool GLRenderer::getFramebufferTexture(ScopedResource* texture, const gfx::Rect& deviceRect)
1455 { 1455 {
1456 DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->f ormat() == GL_RGB)); 1456 DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->f ormat() == GL_RGB));
1457 1457
1458 if (!texture->id() && !texture->Allocate(Renderer::ImplPool, deviceRect.size (), GL_RGB, ResourceProvider::TextureUsageAny)) 1458 if (!texture->id() && !texture->Allocate(deviceRect.size(), GL_RGB, Resource Provider::TextureUsageAny))
1459 return false; 1459 return false;
1460 1460
1461 ResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id()); 1461 ResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id());
1462 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, lock.textureId())); 1462 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, lock.textureId()));
1463 GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, texture->format() , 1463 GLC(m_context, m_context->copyTexImage2D(GL_TEXTURE_2D, 0, texture->format() ,
1464 deviceRect.x(), deviceRect.y(), dev iceRect.width(), deviceRect.height(), 0)); 1464 deviceRect.x(), deviceRect.y(), dev iceRect.width(), deviceRect.height(), 0));
1465 return true; 1465 return true;
1466 } 1466 }
1467 1467
1468 bool GLRenderer::useScopedTexture(DrawingFrame& frame, const ScopedResource* tex ture, const gfx::Rect& viewportRect) 1468 bool GLRenderer::useScopedTexture(DrawingFrame& frame, const ScopedResource* tex ture, const gfx::Rect& viewportRect)
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 1775
1776 releaseRenderPassTextures(); 1776 releaseRenderPassTextures();
1777 } 1777 }
1778 1778
1779 bool GLRenderer::isContextLost() 1779 bool GLRenderer::isContextLost()
1780 { 1780 {
1781 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1781 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1782 } 1782 }
1783 1783
1784 } // namespace cc 1784 } // namespace cc
OLDNEW
« no previous file with comments | « cc/direct_renderer.cc ('k') | cc/heads_up_display_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698