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

Side by Side Diff: media/renderers/skcanvas_video_renderer.cc

Issue 2697663002: Clean up naming of paint-related identifiers (Closed)
Patch Set: Rebase Created 3 years, 10 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 | « media/renderers/skcanvas_video_renderer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "media/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <GLES3/gl3.h> 7 #include <GLES3/gl3.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 this, 333 this,
334 &SkCanvasVideoRenderer::ResetCache) {} 334 &SkCanvasVideoRenderer::ResetCache) {}
335 335
336 SkCanvasVideoRenderer::~SkCanvasVideoRenderer() { 336 SkCanvasVideoRenderer::~SkCanvasVideoRenderer() {
337 ResetCache(); 337 ResetCache();
338 } 338 }
339 339
340 void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame, 340 void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame,
341 cc::PaintCanvas* canvas, 341 cc::PaintCanvas* canvas,
342 const gfx::RectF& dest_rect, 342 const gfx::RectF& dest_rect,
343 cc::PaintFlags& paint, 343 cc::PaintFlags& flags,
344 VideoRotation video_rotation, 344 VideoRotation video_rotation,
345 const Context3D& context_3d) { 345 const Context3D& context_3d) {
346 DCHECK(thread_checker_.CalledOnValidThread()); 346 DCHECK(thread_checker_.CalledOnValidThread());
347 if (paint.getAlpha() == 0) { 347 if (flags.getAlpha() == 0) {
348 return; 348 return;
349 } 349 }
350 350
351 SkRect dest; 351 SkRect dest;
352 dest.set(dest_rect.x(), dest_rect.y(), dest_rect.right(), dest_rect.bottom()); 352 dest.set(dest_rect.x(), dest_rect.y(), dest_rect.right(), dest_rect.bottom());
353 353
354 // Paint black rectangle if there isn't a frame available or the 354 // Paint black rectangle if there isn't a frame available or the
355 // frame has an unexpected format. 355 // frame has an unexpected format.
356 if (!video_frame.get() || video_frame->natural_size().IsEmpty() || 356 if (!video_frame.get() || video_frame->natural_size().IsEmpty() ||
357 !(media::IsYuvPlanar(video_frame->format()) || 357 !(media::IsYuvPlanar(video_frame->format()) ||
358 video_frame->format() == media::PIXEL_FORMAT_Y16 || 358 video_frame->format() == media::PIXEL_FORMAT_Y16 ||
359 video_frame->HasTextures())) { 359 video_frame->HasTextures())) {
360 cc::PaintFlags black_with_alpha_flags; 360 cc::PaintFlags black_with_alpha_flags;
361 black_with_alpha_flags.setAlpha(paint.getAlpha()); 361 black_with_alpha_flags.setAlpha(flags.getAlpha());
362 canvas->drawRect(dest, black_with_alpha_flags); 362 canvas->drawRect(dest, black_with_alpha_flags);
363 canvas->flush(); 363 canvas->flush();
364 return; 364 return;
365 } 365 }
366 366
367 gpu::gles2::GLES2Interface* gl = context_3d.gl; 367 gpu::gles2::GLES2Interface* gl = context_3d.gl;
368 if (!UpdateLastImage(video_frame, context_3d)) 368 if (!UpdateLastImage(video_frame, context_3d))
369 return; 369 return;
370 370
371 cc::PaintFlags video_flags; 371 cc::PaintFlags video_flags;
372 video_flags.setAlpha(paint.getAlpha()); 372 video_flags.setAlpha(flags.getAlpha());
373 video_flags.setBlendMode(paint.getBlendMode()); 373 video_flags.setBlendMode(flags.getBlendMode());
374 video_flags.setFilterQuality(paint.getFilterQuality()); 374 video_flags.setFilterQuality(flags.getFilterQuality());
375 375
376 const bool need_rotation = video_rotation != VIDEO_ROTATION_0; 376 const bool need_rotation = video_rotation != VIDEO_ROTATION_0;
377 const bool need_scaling = 377 const bool need_scaling =
378 dest_rect.size() != 378 dest_rect.size() !=
379 gfx::SizeF(gfx::SkISizeToSize(last_image_->dimensions())); 379 gfx::SizeF(gfx::SkISizeToSize(last_image_->dimensions()));
380 const bool need_translation = !dest_rect.origin().IsOrigin(); 380 const bool need_translation = !dest_rect.origin().IsOrigin();
381 bool need_transform = need_rotation || need_scaling || need_translation; 381 bool need_transform = need_rotation || need_scaling || need_translation;
382 if (need_transform) { 382 if (need_transform) {
383 canvas->save(); 383 canvas->save();
384 canvas->translate( 384 canvas->translate(
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 last_image_->bounds().contains(visible_rect)) { 960 last_image_->bounds().contains(visible_rect)) {
961 last_image_ = last_image_->makeSubset(visible_rect); 961 last_image_ = last_image_->makeSubset(visible_rect);
962 } 962 }
963 } 963 }
964 964
965 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { 965 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() {
966 return last_image_dimensions_for_testing_; 966 return last_image_dimensions_for_testing_;
967 } 967 }
968 968
969 } // namespace media 969 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/skcanvas_video_renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698