| OLD | NEW |
| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 GrPlatformTextureDesc platformTextureDescription; | 398 GrPlatformTextureDesc platformTextureDescription; |
| 399 platformTextureDescription.fWidth = sourceTexture->size().width(); | 399 platformTextureDescription.fWidth = sourceTexture->size().width(); |
| 400 platformTextureDescription.fHeight = sourceTexture->size().height(); | 400 platformTextureDescription.fHeight = sourceTexture->size().height(); |
| 401 platformTextureDescription.fConfig = kSkia8888_GrPixelConfig; | 401 platformTextureDescription.fConfig = kSkia8888_GrPixelConfig; |
| 402 platformTextureDescription.fTextureHandle = lock.textureId(); | 402 platformTextureDescription.fTextureHandle = lock.textureId(); |
| 403 SkAutoTUnref<GrTexture> texture(grContext->createPlatformTexture(platformTex
tureDescription)); | 403 SkAutoTUnref<GrTexture> texture(grContext->createPlatformTexture(platformTex
tureDescription)); |
| 404 | 404 |
| 405 // Place the platform texture inside an SkBitmap. | 405 // Place the platform texture inside an SkBitmap. |
| 406 SkBitmap source; | 406 SkBitmap source; |
| 407 source.setConfig(SkBitmap::kARGB_8888_Config, sourceTexture->size().width(),
sourceTexture->size().height()); | 407 source.setConfig(SkBitmap::kARGB_8888_Config, sourceTexture->size().width(),
sourceTexture->size().height()); |
| 408 source.setPixelRef(new SkGrPixelRef(texture.get()))->unref(); | 408 skia::RefPtr<SkGrPixelRef> pixelRef = new SkGrPixelRef(texture.get()); |
| 409 source.setPixelRef(pixelRef.get()); |
| 409 | 410 |
| 410 // Create a scratch texture for backing store. | 411 // Create a scratch texture for backing store. |
| 411 GrTextureDesc desc; | 412 GrTextureDesc desc; |
| 412 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 413 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
| 413 desc.fSampleCnt = 0; | 414 desc.fSampleCnt = 0; |
| 414 desc.fWidth = source.width(); | 415 desc.fWidth = source.width(); |
| 415 desc.fHeight = source.height(); | 416 desc.fHeight = source.height(); |
| 416 desc.fConfig = kSkia8888_GrPixelConfig; | 417 desc.fConfig = kSkia8888_GrPixelConfig; |
| 417 GrAutoScratchTexture scratchTexture(grContext, desc, GrContext::kExact_Scrat
chTexMatch); | 418 GrAutoScratchTexture scratchTexture(grContext, desc, GrContext::kExact_Scrat
chTexMatch); |
| 418 SkAutoTUnref<GrTexture> backingStore(scratchTexture.detach()); | 419 SkAutoTUnref<GrTexture> backingStore(scratchTexture.detach()); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 527 |
| 527 gfx::Transform contentsDeviceTransformInverse = MathUtil::inverse(contentsDe
viceTransform); | 528 gfx::Transform contentsDeviceTransformInverse = MathUtil::inverse(contentsDe
viceTransform); |
| 528 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( | 529 scoped_ptr<ScopedResource> backgroundTexture = drawBackgroundFilters( |
| 529 frame, quad, renderPass->background_filters, | 530 frame, quad, renderPass->background_filters, |
| 530 contentsDeviceTransform, contentsDeviceTransformInverse); | 531 contentsDeviceTransform, contentsDeviceTransformInverse); |
| 531 | 532 |
| 532 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. | 533 // FIXME: Cache this value so that we don't have to do it for both the surfa
ce and its replica. |
| 533 // Apply filters to the contents texture. | 534 // Apply filters to the contents texture. |
| 534 SkBitmap filterBitmap; | 535 SkBitmap filterBitmap; |
| 535 if (renderPass->filter) { | 536 if (renderPass->filter) { |
| 536 filterBitmap = applyImageFilter(this, renderPass->filter, contentsTextur
e, m_client->hasImplThread()); | 537 filterBitmap = applyImageFilter(this, renderPass->filter.get(), contents
Texture, m_client->hasImplThread()); |
| 537 } else { | 538 } else { |
| 538 filterBitmap = applyFilters(this, renderPass->filters, contentsTexture,
m_client->hasImplThread()); | 539 filterBitmap = applyFilters(this, renderPass->filters, contentsTexture,
m_client->hasImplThread()); |
| 539 } | 540 } |
| 540 scoped_ptr<ResourceProvider::ScopedReadLockGL> contentsResourceLock; | 541 scoped_ptr<ResourceProvider::ScopedReadLockGL> contentsResourceLock; |
| 541 unsigned contentsTextureId = 0; | 542 unsigned contentsTextureId = 0; |
| 542 if (filterBitmap.getTexture()) { | 543 if (filterBitmap.getTexture()) { |
| 543 GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTextur
e()); | 544 GrTexture* texture = reinterpret_cast<GrTexture*>(filterBitmap.getTextur
e()); |
| 544 contentsTextureId = texture->getTextureHandle(); | 545 contentsTextureId = texture->getTextureHandle(); |
| 545 } else { | 546 } else { |
| 546 contentsResourceLock = make_scoped_ptr(new ResourceProvider::ScopedReadL
ockGL(m_resourceProvider, contentsTexture->id())); | 547 contentsResourceLock = make_scoped_ptr(new ResourceProvider::ScopedReadL
ockGL(m_resourceProvider, contentsTexture->id())); |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 | 1626 |
| 1626 releaseRenderPassTextures(); | 1627 releaseRenderPassTextures(); |
| 1627 } | 1628 } |
| 1628 | 1629 |
| 1629 bool GLRenderer::isContextLost() | 1630 bool GLRenderer::isContextLost() |
| 1630 { | 1631 { |
| 1631 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1632 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| 1632 } | 1633 } |
| 1633 | 1634 |
| 1634 } // namespace cc | 1635 } // namespace cc |
| OLD | NEW |