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

Side by Side Diff: content/browser/compositor/gl_helper.cc

Issue 1690013002: Remove --tab-capture-upscale/downscale-quality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Addressed Yuri's comments. Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/compositor/gl_helper.h" 5 #include "content/browser/compositor/gl_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ReadbackSwizzle swizzle, 175 ReadbackSwizzle swizzle,
176 const base::Callback<void(bool)>& callback); 176 const base::Callback<void(bool)>& callback);
177 177
178 GLuint CopyAndScaleTexture(GLuint texture, 178 GLuint CopyAndScaleTexture(GLuint texture,
179 const gfx::Size& src_size, 179 const gfx::Size& src_size,
180 const gfx::Size& dst_size, 180 const gfx::Size& dst_size,
181 bool vertically_flip_texture, 181 bool vertically_flip_texture,
182 GLHelper::ScalerQuality quality); 182 GLHelper::ScalerQuality quality);
183 183
184 ReadbackYUVInterface* CreateReadbackPipelineYUV( 184 ReadbackYUVInterface* CreateReadbackPipelineYUV(
185 GLHelper::ScalerQuality quality,
186 const gfx::Size& src_size, 185 const gfx::Size& src_size,
187 const gfx::Rect& src_subrect, 186 const gfx::Rect& src_subrect,
188 const gfx::Size& dst_size, 187 const gfx::Size& dst_size,
189 bool flip_vertically, 188 bool flip_vertically,
190 bool use_mrt); 189 bool use_mrt);
191 190
192 // Returns the maximum number of draw buffers available, 191 // Returns the maximum number of draw buffers available,
193 // 0 if GL_EXT_draw_buffers is not available. 192 // 0 if GL_EXT_draw_buffers is not available.
194 GLint MaxDrawBuffers() const { return max_draw_buffers_; } 193 GLint MaxDrawBuffers() const { return max_draw_buffers_; }
195 194
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 DCHECK(readback_support_.get()); 1173 DCHECK(readback_support_.get());
1175 GLenum format, type; 1174 GLenum format, type;
1176 size_t bytes_per_pixel; 1175 size_t bytes_per_pixel;
1177 FormatSupport support = readback_support_->GetReadbackConfig( 1176 FormatSupport support = readback_support_->GetReadbackConfig(
1178 color_type, false, &format, &type, &bytes_per_pixel); 1177 color_type, false, &format, &type, &bytes_per_pixel);
1179 1178
1180 return (support == GLHelperReadbackSupport::SUPPORTED); 1179 return (support == GLHelperReadbackSupport::SUPPORTED);
1181 } 1180 }
1182 1181
1183 ReadbackYUVInterface* GLHelper::CopyTextureToImpl::CreateReadbackPipelineYUV( 1182 ReadbackYUVInterface* GLHelper::CopyTextureToImpl::CreateReadbackPipelineYUV(
1184 GLHelper::ScalerQuality quality,
1185 const gfx::Size& src_size, 1183 const gfx::Size& src_size,
1186 const gfx::Rect& src_subrect, 1184 const gfx::Rect& src_subrect,
1187 const gfx::Size& dst_size, 1185 const gfx::Size& dst_size,
1188 bool flip_vertically, 1186 bool flip_vertically,
1189 bool use_mrt) { 1187 bool use_mrt) {
1190 helper_->InitScalerImpl(); 1188 helper_->InitScalerImpl();
1191 // Just query if the best readback configuration needs a swizzle In 1189 // Just query if the best readback configuration needs a swizzle In
1192 // ReadbackPlane() we will choose GL_RGBA/GL_BGRA_EXT based on swizzle 1190 // ReadbackPlane() we will choose GL_RGBA/GL_BGRA_EXT based on swizzle
1193 GLenum format, type; 1191 GLenum format, type;
1194 size_t bytes_per_pixel; 1192 size_t bytes_per_pixel;
1195 FormatSupport supported = GetReadbackConfig(kRGBA_8888_SkColorType, true, 1193 FormatSupport supported = GetReadbackConfig(kRGBA_8888_SkColorType, true,
1196 &format, &type, &bytes_per_pixel); 1194 &format, &type, &bytes_per_pixel);
1197 DCHECK((format == GL_RGBA || format == GL_BGRA_EXT) && 1195 DCHECK((format == GL_RGBA || format == GL_BGRA_EXT) &&
1198 type == GL_UNSIGNED_BYTE); 1196 type == GL_UNSIGNED_BYTE);
1199 1197
1200 ReadbackSwizzle swizzle = kSwizzleNone; 1198 ReadbackSwizzle swizzle = kSwizzleNone;
1201 if (supported == GLHelperReadbackSupport::SWIZZLE) 1199 if (supported == GLHelperReadbackSupport::SWIZZLE)
1202 swizzle = kSwizzleBGRA; 1200 swizzle = kSwizzleBGRA;
1203 1201
1202 // Tests show that the two up-scaling methods perform comparable speeds on the
miu 2016/03/29 20:08:52 This comment should provide a little more context
xjz 2016/03/29 21:14:50 Yuri: Thanks for the suggestion. But do you want t
miu 2016/03/31 21:44:05 Ah, no. :) Actually, we should just leave out th
xjz 2016/03/31 23:03:39 Done.
1203 // tested machines. So we choose "best" up-scaling method by default to get
1204 // the best quality.
1205 // The three down-scaling methods perform close speeds on high end machines,
1206 // but not on other machines. The "best" method could be up to 96% slower than
1207 // the "good" one, and the "good" method could be up to 250% slower than the
1208 // "fast" one. As we don't have criteria to determine the proper scaling
1209 // method in flight, and generally the down-scaling is more often needed on
1210 // low end machines, we choose the "fast" down-scaling method by default.
1211 GLHelper::ScalerQuality quality = ((src_size.width() < dst_size.width()) &&
miu 2016/03/29 20:08:52 Should this be: GLHelper::ScalerQuality quality
xjz 2016/03/29 21:14:50 The scaling is done in two separate dimensions. My
miu 2016/03/31 21:44:05 Sounds good.
1212 (src_size.height() < dst_size.height()))
1213 ? GLHelper::SCALER_QUALITY_BEST
1214 : GLHelper::SCALER_QUALITY_FAST;
1204 if (max_draw_buffers_ >= 2 && use_mrt) { 1215 if (max_draw_buffers_ >= 2 && use_mrt) {
1205 return new ReadbackYUV_MRT(gl_, this, helper_->scaler_impl_.get(), quality, 1216 return new ReadbackYUV_MRT(gl_, this, helper_->scaler_impl_.get(), quality,
1206 src_size, src_subrect, dst_size, flip_vertically, 1217 src_size, src_subrect, dst_size, flip_vertically,
1207 swizzle); 1218 swizzle);
1208 } 1219 }
1209 return new ReadbackYUVImpl(gl_, this, helper_->scaler_impl_.get(), quality, 1220 return new ReadbackYUVImpl(gl_, this, helper_->scaler_impl_.get(), quality,
1210 src_size, src_subrect, dst_size, flip_vertically, 1221 src_size, src_subrect, dst_size, flip_vertically,
1211 swizzle); 1222 swizzle);
1212 } 1223 }
1213 1224
1214 ReadbackYUVInterface* GLHelper::CreateReadbackPipelineYUV( 1225 ReadbackYUVInterface* GLHelper::CreateReadbackPipelineYUV(
1215 ScalerQuality quality,
1216 const gfx::Size& src_size, 1226 const gfx::Size& src_size,
1217 const gfx::Rect& src_subrect, 1227 const gfx::Rect& src_subrect,
1218 const gfx::Size& dst_size, 1228 const gfx::Size& dst_size,
1219 bool flip_vertically, 1229 bool flip_vertically,
1220 bool use_mrt) { 1230 bool use_mrt) {
1221 InitCopyTextToImpl(); 1231 InitCopyTextToImpl();
1222 return copy_texture_to_impl_->CreateReadbackPipelineYUV( 1232 return copy_texture_to_impl_->CreateReadbackPipelineYUV(
1223 quality, src_size, src_subrect, dst_size, flip_vertically, use_mrt); 1233 src_size, src_subrect, dst_size, flip_vertically, use_mrt);
1224 } 1234 }
1225 1235
1226 } // namespace content 1236 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gl_helper.h ('k') | content/browser/compositor/gl_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698