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

Side by Side Diff: cc/layers/ui_resource_layer_impl.cc

Issue 558083002: [cc] Add nearest neighbor filtering for TextureLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and rebase Created 6 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
« no previous file with comments | « cc/layers/texture_layer_unittest.cc ('k') | cc/layers/video_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/ui_resource_layer_impl.h" 5 #include "cc/layers/ui_resource_layer_impl.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "cc/base/math_util.h" 9 #include "cc/base/math_util.h"
10 #include "cc/quads/texture_draw_quad.h" 10 #include "cc/quads/texture_draw_quad.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (!ui_resource_id_) 105 if (!ui_resource_id_)
106 return; 106 return;
107 107
108 ResourceProvider::ResourceId resource = 108 ResourceProvider::ResourceId resource =
109 layer_tree_impl()->ResourceIdForUIResource(ui_resource_id_); 109 layer_tree_impl()->ResourceIdForUIResource(ui_resource_id_);
110 110
111 if (!resource) 111 if (!resource)
112 return; 112 return;
113 113
114 static const bool flipped = false; 114 static const bool flipped = false;
115 static const bool nearest_neighbor = false;
115 static const bool premultiplied_alpha = true; 116 static const bool premultiplied_alpha = true;
116 117
117 DCHECK(!bounds().IsEmpty()); 118 DCHECK(!bounds().IsEmpty());
118 119
119 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) || 120 bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_) ||
120 contents_opaque(); 121 contents_opaque();
121 122
122 gfx::Rect quad_rect(bounds()); 123 gfx::Rect quad_rect(bounds());
123 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); 124 gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect());
124 gfx::Rect visible_quad_rect = 125 gfx::Rect visible_quad_rect =
125 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect); 126 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect);
126 if (visible_quad_rect.IsEmpty()) 127 if (visible_quad_rect.IsEmpty())
127 return; 128 return;
128 129
129 TextureDrawQuad* quad = 130 TextureDrawQuad* quad =
130 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); 131 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>();
131 quad->SetNew(shared_quad_state, 132 quad->SetNew(shared_quad_state,
132 quad_rect, 133 quad_rect,
133 opaque_rect, 134 opaque_rect,
134 visible_quad_rect, 135 visible_quad_rect,
135 resource, 136 resource,
136 premultiplied_alpha, 137 premultiplied_alpha,
137 uv_top_left_, 138 uv_top_left_,
138 uv_bottom_right_, 139 uv_bottom_right_,
139 SK_ColorTRANSPARENT, 140 SK_ColorTRANSPARENT,
140 vertex_opacity_, 141 vertex_opacity_,
141 flipped); 142 flipped,
143 nearest_neighbor);
142 } 144 }
143 145
144 const char* UIResourceLayerImpl::LayerTypeAsString() const { 146 const char* UIResourceLayerImpl::LayerTypeAsString() const {
145 return "cc::UIResourceLayerImpl"; 147 return "cc::UIResourceLayerImpl";
146 } 148 }
147 149
148 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const { 150 base::DictionaryValue* UIResourceLayerImpl::LayerTreeAsJson() const {
149 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson(); 151 base::DictionaryValue* result = LayerImpl::LayerTreeAsJson();
150 152
151 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release()); 153 result->Set("ImageBounds", MathUtil::AsValue(image_bounds_).release());
152 154
153 base::ListValue* list = new base::ListValue; 155 base::ListValue* list = new base::ListValue;
154 list->AppendDouble(vertex_opacity_[0]); 156 list->AppendDouble(vertex_opacity_[0]);
155 list->AppendDouble(vertex_opacity_[1]); 157 list->AppendDouble(vertex_opacity_[1]);
156 list->AppendDouble(vertex_opacity_[2]); 158 list->AppendDouble(vertex_opacity_[2]);
157 list->AppendDouble(vertex_opacity_[3]); 159 list->AppendDouble(vertex_opacity_[3]);
158 result->Set("VertexOpacity", list); 160 result->Set("VertexOpacity", list);
159 161
160 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release()); 162 result->Set("UVTopLeft", MathUtil::AsValue(uv_top_left_).release());
161 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release()); 163 result->Set("UVBottomRight", MathUtil::AsValue(uv_bottom_right_).release());
162 164
163 return result; 165 return result;
164 } 166 }
165 167
166 } // namespace cc 168 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_unittest.cc ('k') | cc/layers/video_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698