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

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

Issue 1357423009: gfx: Make conversions from Size to SizeF be explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 847 }
848 return device_background_texture.Pass(); 848 return device_background_texture.Pass();
849 } 849 }
850 850
851 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters( 851 skia::RefPtr<SkImage> GLRenderer::ApplyBackgroundFilters(
852 DrawingFrame* frame, 852 DrawingFrame* frame,
853 const RenderPassDrawQuad* quad, 853 const RenderPassDrawQuad* quad,
854 ScopedResource* background_texture) { 854 ScopedResource* background_texture) {
855 DCHECK(ShouldApplyBackgroundFilters(quad)); 855 DCHECK(ShouldApplyBackgroundFilters(quad));
856 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( 856 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
857 quad->background_filters, background_texture->size()); 857 quad->background_filters, gfx::SizeF(background_texture->size()));
858 858
859 skia::RefPtr<SkImage> background_with_filters = ApplyImageFilter( 859 skia::RefPtr<SkImage> background_with_filters = ApplyImageFilter(
860 ScopedUseGrContext::Create(this, frame), resource_provider_, quad->rect, 860 ScopedUseGrContext::Create(this, frame), resource_provider_, quad->rect,
861 quad->filters_scale, filter.get(), background_texture); 861 quad->filters_scale, filter.get(), background_texture);
862 return background_with_filters; 862 return background_with_filters;
863 } 863 }
864 864
865 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, 865 void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
866 const RenderPassDrawQuad* quad, 866 const RenderPassDrawQuad* quad,
867 const gfx::QuadF* clip_region) { 867 const gfx::QuadF* clip_region) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); 963 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode)));
964 964
965 // TODO(senorblanco): Cache this value so that we don't have to do it for both 965 // TODO(senorblanco): Cache this value so that we don't have to do it for both
966 // the surface and its replica. Apply filters to the contents texture. 966 // the surface and its replica. Apply filters to the contents texture.
967 skia::RefPtr<SkImage> filter_image; 967 skia::RefPtr<SkImage> filter_image;
968 GLuint filter_image_id = 0; 968 GLuint filter_image_id = 0;
969 SkScalar color_matrix[20]; 969 SkScalar color_matrix[20];
970 bool use_color_matrix = false; 970 bool use_color_matrix = false;
971 if (!quad->filters.IsEmpty()) { 971 if (!quad->filters.IsEmpty()) {
972 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( 972 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
973 quad->filters, contents_texture->size()); 973 quad->filters, gfx::SizeF(contents_texture->size()));
974 if (filter) { 974 if (filter) {
975 skia::RefPtr<SkColorFilter> cf; 975 skia::RefPtr<SkColorFilter> cf;
976 976
977 { 977 {
978 SkColorFilter* colorfilter_rawptr = NULL; 978 SkColorFilter* colorfilter_rawptr = NULL;
979 filter->asColorFilter(&colorfilter_rawptr); 979 filter->asColorFilter(&colorfilter_rawptr);
980 cf = skia::AdoptRef(colorfilter_rawptr); 980 cf = skia::AdoptRef(colorfilter_rawptr);
981 } 981 }
982 982
983 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) { 983 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) {
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 1591
1592 SetShaderQuadF(local_quad, uniforms.quad_location); 1592 SetShaderQuadF(local_quad, uniforms.quad_location);
1593 1593
1594 // The transform and vertex data are used to figure out the extents that the 1594 // The transform and vertex data are used to figure out the extents that the
1595 // un-antialiased quad should have and which vertex this is and the float 1595 // un-antialiased quad should have and which vertex this is and the float
1596 // quad passed in via uniform is the actual geometry that gets used to draw 1596 // quad passed in via uniform is the actual geometry that gets used to draw
1597 // it. This is why this centered rect is used and not the original 1597 // it. This is why this centered rect is used and not the original
1598 // quad_rect. 1598 // quad_rect.
1599 gfx::RectF centered_rect( 1599 gfx::RectF centered_rect(
1600 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()), 1600 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()),
1601 tile_rect.size()); 1601 gfx::SizeF(tile_rect.size()));
1602 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, 1602 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform,
1603 centered_rect, uniforms.matrix_location); 1603 centered_rect, uniforms.matrix_location);
1604 } else { 1604 } else {
1605 PrepareGeometry(SHARED_BINDING); 1605 PrepareGeometry(SHARED_BINDING);
1606 SetShaderQuadF(local_quad, uniforms.quad_location); 1606 SetShaderQuadF(local_quad, uniforms.quad_location);
1607 static float gl_matrix[16]; 1607 static float gl_matrix[16];
1608 ToGLMatrix(&gl_matrix[0], 1608 ToGLMatrix(&gl_matrix[0],
1609 frame->projection_matrix * 1609 frame->projection_matrix *
1610 quad->shared_quad_state->quad_to_target_transform); 1610 quad->shared_quad_state->quad_to_target_transform);
1611 gl_->UniformMatrix4fv(uniforms.matrix_location, 1, false, &gl_matrix[0]); 1611 gl_->UniformMatrix4fv(uniforms.matrix_location, 1, false, &gl_matrix[0]);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 1790
1791 SetShaderOpacity(quad->shared_quad_state->opacity, uniforms.alpha_location); 1791 SetShaderOpacity(quad->shared_quad_state->opacity, uniforms.alpha_location);
1792 SetShaderQuadF(local_quad, uniforms.quad_location); 1792 SetShaderQuadF(local_quad, uniforms.quad_location);
1793 1793
1794 // The transform and vertex data are used to figure out the extents that the 1794 // The transform and vertex data are used to figure out the extents that the
1795 // un-antialiased quad should have and which vertex this is and the float 1795 // un-antialiased quad should have and which vertex this is and the float
1796 // quad passed in via uniform is the actual geometry that gets used to draw 1796 // quad passed in via uniform is the actual geometry that gets used to draw
1797 // it. This is why this centered rect is used and not the original quad_rect. 1797 // it. This is why this centered rect is used and not the original quad_rect.
1798 gfx::RectF centered_rect( 1798 gfx::RectF centered_rect(
1799 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()), 1799 gfx::PointF(-0.5f * tile_rect.width(), -0.5f * tile_rect.height()),
1800 tile_rect.size()); 1800 gfx::SizeF(tile_rect.size()));
1801 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, 1801 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform,
1802 centered_rect, uniforms.matrix_location); 1802 centered_rect, uniforms.matrix_location);
1803 } 1803 }
1804 1804
1805 void GLRenderer::DrawContentQuadNoAA(const DrawingFrame* frame, 1805 void GLRenderer::DrawContentQuadNoAA(const DrawingFrame* frame,
1806 const ContentDrawQuadBase* quad, 1806 const ContentDrawQuadBase* quad,
1807 ResourceId resource_id, 1807 ResourceId resource_id,
1808 const gfx::QuadF* clip_region) { 1808 const gfx::QuadF* clip_region) {
1809 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional( 1809 gfx::RectF tex_coord_rect = MathUtil::ScaleRectProportional(
1810 quad->tex_coord_rect, gfx::RectF(quad->rect), 1810 quad->tex_coord_rect, gfx::RectF(quad->rect),
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after
3530 texture_id = pending_overlay_resources_.back()->texture_id(); 3530 texture_id = pending_overlay_resources_.back()->texture_id();
3531 } 3531 }
3532 3532
3533 context_support_->ScheduleOverlayPlane( 3533 context_support_->ScheduleOverlayPlane(
3534 overlay.plane_z_order, overlay.transform, texture_id, 3534 overlay.plane_z_order, overlay.transform, texture_id,
3535 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3535 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3536 } 3536 }
3537 } 3537 }
3538 3538
3539 } // namespace cc 3539 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698