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

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

Issue 2235623003: cc: Add gfx::ColorSpace to cc::ResourceProvider resource creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 4 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/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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 backdrop_rect.Intersect(MoveFromDrawToWindowSpace( 886 backdrop_rect.Intersect(MoveFromDrawToWindowSpace(
887 frame, frame->current_render_pass->output_rect)); 887 frame, frame->current_render_pass->output_rect));
888 return backdrop_rect; 888 return backdrop_rect;
889 } 889 }
890 890
891 std::unique_ptr<ScopedResource> GLRenderer::GetBackdropTexture( 891 std::unique_ptr<ScopedResource> GLRenderer::GetBackdropTexture(
892 const gfx::Rect& bounding_rect) { 892 const gfx::Rect& bounding_rect) {
893 std::unique_ptr<ScopedResource> device_background_texture = 893 std::unique_ptr<ScopedResource> device_background_texture =
894 ScopedResource::Create(resource_provider_); 894 ScopedResource::Create(resource_provider_);
895 // CopyTexImage2D fails when called on a texture having immutable storage. 895 // CopyTexImage2D fails when called on a texture having immutable storage.
896 device_background_texture->Allocate( 896 device_background_texture->Allocate(bounding_rect.size(),
897 bounding_rect.size(), ResourceProvider::TEXTURE_HINT_DEFAULT, 897 ResourceProvider::TEXTURE_HINT_DEFAULT,
898 resource_provider_->best_texture_format()); 898 resource_provider_->best_texture_format(),
899 output_surface_->device_color_space());
899 { 900 {
900 ResourceProvider::ScopedWriteLockGL lock( 901 ResourceProvider::ScopedWriteLockGL lock(
901 resource_provider_, device_background_texture->id(), false); 902 resource_provider_, device_background_texture->id(), false);
902 GetFramebufferTexture(lock.texture_id(), bounding_rect); 903 GetFramebufferTexture(lock.texture_id(), bounding_rect);
903 } 904 }
904 return device_background_texture; 905 return device_background_texture;
905 } 906 }
906 907
907 sk_sp<SkImage> GLRenderer::ApplyBackgroundFilters( 908 sk_sp<SkImage> GLRenderer::ApplyBackgroundFilters(
908 const RenderPassDrawQuad* quad, 909 const RenderPassDrawQuad* quad,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 DrawRenderPassDrawQuadParams params; 1033 DrawRenderPassDrawQuadParams params;
1033 params.quad = quad; 1034 params.quad = quad;
1034 params.frame = frame; 1035 params.frame = frame;
1035 params.clip_region = clip_region; 1036 params.clip_region = clip_region;
1036 params.window_matrix = frame->window_matrix; 1037 params.window_matrix = frame->window_matrix;
1037 params.projection_matrix = frame->projection_matrix; 1038 params.projection_matrix = frame->projection_matrix;
1038 if (bypass != render_pass_bypass_quads_.end()) { 1039 if (bypass != render_pass_bypass_quads_.end()) {
1039 TileDrawQuad* tile_quad = &bypass->second; 1040 TileDrawQuad* tile_quad = &bypass->second;
1040 // RGBA_8888 here is arbitrary and unused. 1041 // RGBA_8888 here is arbitrary and unused.
1041 Resource tile_resource(tile_quad->resource_id(), tile_quad->texture_size, 1042 Resource tile_resource(tile_quad->resource_id(), tile_quad->texture_size,
1042 ResourceFormat::RGBA_8888); 1043 ResourceFormat::RGBA_8888,
1044 output_surface_->device_color_space());
1043 // The projection matrix used by GLRenderer has a flip. As tile texture 1045 // The projection matrix used by GLRenderer has a flip. As tile texture
1044 // inputs are oriented opposite to framebuffer outputs, don't flip via 1046 // inputs are oriented opposite to framebuffer outputs, don't flip via
1045 // texture coords and let the projection matrix naturallyd o it. 1047 // texture coords and let the projection matrix naturallyd o it.
1046 params.flip_texture = false; 1048 params.flip_texture = false;
1047 params.contents_texture = &tile_resource; 1049 params.contents_texture = &tile_resource;
1048 DrawRenderPassQuadInternal(&params); 1050 DrawRenderPassQuadInternal(&params);
1049 } else { 1051 } else {
1050 ScopedResource* contents_texture = 1052 ScopedResource* contents_texture =
1051 render_pass_textures_[quad->render_pass_id].get(); 1053 render_pass_textures_[quad->render_pass_id].get();
1052 DCHECK(contents_texture); 1054 DCHECK(contents_texture);
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier; 2393 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier;
2392 2394
2393 for (int i = 0; i < 3; ++i) { 2395 for (int i = 0; i < 3; ++i) {
2394 yuv_adjust_with_offset[i] = 2396 yuv_adjust_with_offset[i] =
2395 yuv_adjust[i] * adjustment_multiplier / quad->resource_multiplier - 2397 yuv_adjust[i] * adjustment_multiplier / quad->resource_multiplier -
2396 quad->resource_offset; 2398 quad->resource_offset;
2397 } 2399 }
2398 2400
2399 if (lut_texture_location != -1) { 2401 if (lut_texture_location != -1) {
2400 unsigned int lut_texture = color_lut_cache_.GetLUT( 2402 unsigned int lut_texture = color_lut_cache_.GetLUT(
2401 quad->video_color_space, output_surface_->color_space(), 32); 2403 quad->video_color_space, output_surface_->device_color_space(), 32);
2402 gl_->ActiveTexture(GL_TEXTURE5); 2404 gl_->ActiveTexture(GL_TEXTURE5);
2403 gl_->BindTexture(GL_TEXTURE_2D, lut_texture); 2405 gl_->BindTexture(GL_TEXTURE_2D, lut_texture);
2404 gl_->Uniform1i(lut_texture_location, 5); 2406 gl_->Uniform1i(lut_texture_location, 5);
2405 gl_->ActiveTexture(GL_TEXTURE0); 2407 gl_->ActiveTexture(GL_TEXTURE0);
2406 } 2408 }
2407 2409
2408 if (resource_multiplier_location != -1) { 2410 if (resource_multiplier_location != -1) {
2409 gl_->Uniform1f(resource_multiplier_location, quad->resource_multiplier); 2411 gl_->Uniform1f(resource_multiplier_location, quad->resource_multiplier);
2410 } 2412 }
2411 2413
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after
3976 gfx::QuadF device_layer_quad = MathUtil::MapQuad( 3978 gfx::QuadF device_layer_quad = MathUtil::MapQuad(
3977 params.contents_device_transform, SharedGeometryQuad(), &clipped); 3979 params.contents_device_transform, SharedGeometryQuad(), &clipped);
3978 LayerQuad device_layer_edges(device_layer_quad); 3980 LayerQuad device_layer_edges(device_layer_quad);
3979 InflateAntiAliasingDistances(device_layer_quad, &device_layer_edges, 3981 InflateAntiAliasingDistances(device_layer_quad, &device_layer_edges,
3980 params.edge); 3982 params.edge);
3981 } 3983 }
3982 3984
3983 // Establish destination texture. 3985 // Establish destination texture.
3984 *resource = overlay_resource_pool_->AcquireResource( 3986 *resource = overlay_resource_pool_->AcquireResource(
3985 gfx::Size(updated_dst_rect.width(), updated_dst_rect.height()), 3987 gfx::Size(updated_dst_rect.width(), updated_dst_rect.height()),
3986 ResourceFormat::RGBA_8888); 3988 ResourceFormat::RGBA_8888, output_surface_->device_color_space());
3987 ResourceProvider::ScopedWriteLockGL destination(resource_provider_, 3989 ResourceProvider::ScopedWriteLockGL destination(resource_provider_,
3988 (*resource)->id(), false); 3990 (*resource)->id(), false);
3989 GLuint temp_fbo; 3991 GLuint temp_fbo;
3990 3992
3991 gl_->GenFramebuffers(1, &temp_fbo); 3993 gl_->GenFramebuffers(1, &temp_fbo);
3992 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo); 3994 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo);
3993 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 3995 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
3994 destination.target(), destination.texture_id(), 0); 3996 destination.target(), destination.texture_id(), 0);
3995 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) == 3997 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) ==
3996 GL_FRAMEBUFFER_COMPLETE); 3998 GL_FRAMEBUFFER_COMPLETE);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4060 4062
4061 gl_->ScheduleCALayerSharedStateCHROMIUM( 4063 gl_->ScheduleCALayerSharedStateCHROMIUM(
4062 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, 4064 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect,
4063 sorting_context_id, gl_transform); 4065 sorting_context_id, gl_transform);
4064 gl_->ScheduleCALayerCHROMIUM( 4066 gl_->ScheduleCALayerCHROMIUM(
4065 texture_id, contents_rect, ca_layer_overlay->background_color, 4067 texture_id, contents_rect, ca_layer_overlay->background_color,
4066 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); 4068 ca_layer_overlay->edge_aa_mask, bounds_rect, filter);
4067 } 4069 }
4068 4070
4069 } // namespace cc 4071 } // 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