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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 1455023002: cc: Replace Pass() with std::move() in some subdirs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-cc
Patch Set: pass-cc2: . Created 5 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
« no previous file with comments | « cc/output/direct_renderer.cc ('k') | cc/output/gl_renderer_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 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/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 ScopedResource::Create(resource_provider_); 840 ScopedResource::Create(resource_provider_);
841 // CopyTexImage2D fails when called on a texture having immutable storage. 841 // CopyTexImage2D fails when called on a texture having immutable storage.
842 device_background_texture->Allocate( 842 device_background_texture->Allocate(
843 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, 843 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT,
844 resource_provider_->best_texture_format()); 844 resource_provider_->best_texture_format());
845 { 845 {
846 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, 846 ResourceProvider::ScopedWriteLockGL lock(resource_provider_,
847 device_background_texture->id()); 847 device_background_texture->id());
848 GetFramebufferTexture(lock.texture_id(), RGBA_8888, bounding_rect); 848 GetFramebufferTexture(lock.texture_id(), RGBA_8888, bounding_rect);
849 } 849 }
850 return device_background_texture.Pass(); 850 return device_background_texture;
851 } 851 }
852 852
853 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters( 853 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters(
854 DrawingFrame* frame, 854 DrawingFrame* frame,
855 const RenderPassDrawQuad* quad, 855 const RenderPassDrawQuad* quad,
856 ScopedResource* background_texture) { 856 ScopedResource* background_texture) {
857 DCHECK(ShouldApplyBackgroundFilters(quad)); 857 DCHECK(ShouldApplyBackgroundFilters(quad));
858 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( 858 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
859 quad->background_filters, gfx::SizeF(background_texture->size())); 859 quad->background_filters, gfx::SizeF(background_texture->size()));
860 860
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2437 gfx::RectF(quad->rect), *clip_region, binding.matrix_location, uvs); 2437 gfx::RectF(quad->rect), *clip_region, binding.matrix_location, uvs);
2438 } 2438 }
2439 2439
2440 gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); 2440 gl_->BindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
2441 } 2441 }
2442 2442
2443 void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) { 2443 void GLRenderer::FinishDrawingFrame(DrawingFrame* frame) {
2444 if (use_sync_query_) { 2444 if (use_sync_query_) {
2445 DCHECK(current_sync_query_); 2445 DCHECK(current_sync_query_);
2446 current_sync_query_->End(); 2446 current_sync_query_->End();
2447 pending_sync_queries_.push_back(current_sync_query_.Pass()); 2447 pending_sync_queries_.push_back(std::move(current_sync_query_));
2448 } 2448 }
2449 2449
2450 current_framebuffer_lock_ = nullptr; 2450 current_framebuffer_lock_ = nullptr;
2451 swap_buffer_rect_.Union(frame->root_damage_rect); 2451 swap_buffer_rect_.Union(frame->root_damage_rect);
2452 2452
2453 gl_->Disable(GL_BLEND); 2453 gl_->Disable(GL_BLEND);
2454 blend_shadow_ = false; 2454 blend_shadow_ = false;
2455 2455
2456 ScheduleCALayers(frame); 2456 ScheduleCALayers(frame);
2457 ScheduleOverlays(frame); 2457 ScheduleOverlays(frame);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2490 is_scissor_enabled_ = false; 2490 is_scissor_enabled_ = false;
2491 } 2491 }
2492 2492
2493 void GLRenderer::CopyCurrentRenderPassToBitmap( 2493 void GLRenderer::CopyCurrentRenderPassToBitmap(
2494 DrawingFrame* frame, 2494 DrawingFrame* frame,
2495 scoped_ptr<CopyOutputRequest> request) { 2495 scoped_ptr<CopyOutputRequest> request) {
2496 TRACE_EVENT0("cc", "GLRenderer::CopyCurrentRenderPassToBitmap"); 2496 TRACE_EVENT0("cc", "GLRenderer::CopyCurrentRenderPassToBitmap");
2497 gfx::Rect copy_rect = frame->current_render_pass->output_rect; 2497 gfx::Rect copy_rect = frame->current_render_pass->output_rect;
2498 if (request->has_area()) 2498 if (request->has_area())
2499 copy_rect.Intersect(request->area()); 2499 copy_rect.Intersect(request->area());
2500 GetFramebufferPixelsAsync(frame, copy_rect, request.Pass()); 2500 GetFramebufferPixelsAsync(frame, copy_rect, std::move(request));
2501 } 2501 }
2502 2502
2503 void GLRenderer::ToGLMatrix(float* gl_matrix, const gfx::Transform& transform) { 2503 void GLRenderer::ToGLMatrix(float* gl_matrix, const gfx::Transform& transform) {
2504 transform.matrix().asColMajorf(gl_matrix); 2504 transform.matrix().asColMajorf(gl_matrix);
2505 } 2505 }
2506 2506
2507 void GLRenderer::SetShaderQuadF(const gfx::QuadF& quad, int quad_location) { 2507 void GLRenderer::SetShaderQuadF(const gfx::QuadF& quad, int quad_location) {
2508 if (quad_location == -1) 2508 if (quad_location == -1)
2509 return; 2509 return;
2510 2510
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2719 2719
2720 scoped_ptr<SingleReleaseCallback> release_callback; 2720 scoped_ptr<SingleReleaseCallback> release_callback;
2721 if (own_mailbox) { 2721 if (own_mailbox) {
2722 gl_->BindTexture(GL_TEXTURE_2D, 0); 2722 gl_->BindTexture(GL_TEXTURE_2D, 0);
2723 release_callback = texture_mailbox_deleter_->GetReleaseCallback( 2723 release_callback = texture_mailbox_deleter_->GetReleaseCallback(
2724 output_surface_->context_provider(), texture_id); 2724 output_surface_->context_provider(), texture_id);
2725 } else { 2725 } else {
2726 gl_->DeleteTextures(1, &texture_id); 2726 gl_->DeleteTextures(1, &texture_id);
2727 } 2727 }
2728 2728
2729 request->SendTextureResult( 2729 request->SendTextureResult(window_rect.size(), texture_mailbox,
2730 window_rect.size(), texture_mailbox, release_callback.Pass()); 2730 std::move(release_callback));
2731 return; 2731 return;
2732 } 2732 }
2733 2733
2734 DCHECK(request->force_bitmap_result()); 2734 DCHECK(request->force_bitmap_result());
2735 2735
2736 scoped_ptr<PendingAsyncReadPixels> pending_read(new PendingAsyncReadPixels); 2736 scoped_ptr<PendingAsyncReadPixels> pending_read(new PendingAsyncReadPixels);
2737 pending_read->copy_request = request.Pass(); 2737 pending_read->copy_request = std::move(request);
2738 pending_async_read_pixels_.insert(pending_async_read_pixels_.begin(), 2738 pending_async_read_pixels_.insert(pending_async_read_pixels_.begin(),
2739 pending_read.Pass()); 2739 std::move(pending_read));
2740 2740
2741 bool do_workaround = NeedsIOSurfaceReadbackWorkaround(); 2741 bool do_workaround = NeedsIOSurfaceReadbackWorkaround();
2742 2742
2743 unsigned temporary_texture = 0; 2743 unsigned temporary_texture = 0;
2744 unsigned temporary_fbo = 0; 2744 unsigned temporary_fbo = 0;
2745 2745
2746 if (do_workaround) { 2746 if (do_workaround) {
2747 // On Mac OS X, calling glReadPixels() against an FBO whose color attachment 2747 // On Mac OS X, calling glReadPixels() against an FBO whose color attachment
2748 // is an IOSurface-backed texture causes corruption of future glReadPixels() 2748 // is an IOSurface-backed texture causes corruption of future glReadPixels()
2749 // calls, even those on different OpenGL contexts. It is believed that this 2749 // calls, even those on different OpenGL contexts. It is believed that this
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 } 2869 }
2870 } 2870 }
2871 2871
2872 gl_->UnmapBufferCHROMIUM(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM); 2872 gl_->UnmapBufferCHROMIUM(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM);
2873 } 2873 }
2874 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0); 2874 gl_->BindBuffer(GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM, 0);
2875 gl_->DeleteBuffers(1, &source_buffer); 2875 gl_->DeleteBuffers(1, &source_buffer);
2876 } 2876 }
2877 2877
2878 if (bitmap) 2878 if (bitmap)
2879 current_read->copy_request->SendBitmapResult(bitmap.Pass()); 2879 current_read->copy_request->SendBitmapResult(std::move(bitmap));
2880 2880
2881 // Conversion from reverse iterator to iterator: 2881 // Conversion from reverse iterator to iterator:
2882 // Iterator |iter.base() - 1| points to the same element with reverse iterator 2882 // Iterator |iter.base() - 1| points to the same element with reverse iterator
2883 // |iter|. The difference |-1| is due to the fact of correspondence of end() 2883 // |iter|. The difference |-1| is due to the fact of correspondence of end()
2884 // with rbegin(). 2884 // with rbegin().
2885 pending_async_read_pixels_.erase(iter.base() - 1); 2885 pending_async_read_pixels_.erase(iter.base() - 1);
2886 } 2886 }
2887 2887
2888 void GLRenderer::GetFramebufferTexture(unsigned texture_id, 2888 void GLRenderer::GetFramebufferTexture(unsigned texture_id,
2889 ResourceFormat texture_format, 2889 ResourceFormat texture_format,
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
3572 texture_id = pending_overlay_resources_.back()->texture_id(); 3572 texture_id = pending_overlay_resources_.back()->texture_id();
3573 } 3573 }
3574 3574
3575 context_support_->ScheduleOverlayPlane( 3575 context_support_->ScheduleOverlayPlane(
3576 overlay.plane_z_order, overlay.transform, texture_id, 3576 overlay.plane_z_order, overlay.transform, texture_id,
3577 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3577 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3578 } 3578 }
3579 } 3579 }
3580 3580
3581 } // namespace cc 3581 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.cc ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698