summaryrefslogtreecommitdiffstats
path: root/webkit/glue/media
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/media')
-rw-r--r--webkit/glue/media/video_renderer_impl.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/webkit/glue/media/video_renderer_impl.cc b/webkit/glue/media/video_renderer_impl.cc
index d1a4fdc..1ba51f2 100644
--- a/webkit/glue/media/video_renderer_impl.cc
+++ b/webkit/glue/media/video_renderer_impl.cc
@@ -95,6 +95,24 @@ void VideoRendererImpl::Paint(skia::PlatformCanvas* canvas,
// Disable the flipping and mirroring checks once we have it.
bool VideoRendererImpl::CanFastPaint(skia::PlatformCanvas* canvas,
const gfx::Rect& dest_rect) {
+ // Fast paint does not handle opacity value other than 1.0. Hence use slow
+ // paint if opacity is not 1.0. Since alpha = opacity * 0xFF, we check that
+ // alpha != 0xFF.
+ //
+ // Additonal notes: If opacity = 0.0, the chrome dispaly engine does not try
+ // to render the video. So, this method is never called. However, if the
+ // opacity = 0.0001, alpha is again 0, but the display engine tries to render
+ // the video. If we use Fast paint, the video shows up with opacity = 1.0.
+ // Hence we use slow paint also in the case where alpha = 0. It would be ideal
+ // if rendering was never called even for cases where alpha is 0. Created
+ // bug 48090 for this.
+ SkCanvas::LayerIter layer_iter(canvas, true);
+ SkColor sk_color = layer_iter.paint().getColor();
+ SkAlpha sk_alpha = SkColorGetA(sk_color);
+ if (sk_alpha != 0xFF) {
+ return false;
+ }
+
const SkMatrix& total_matrix = canvas->getTotalMatrix();
// Perform the following checks here:
// 1. Check for skewing factors of the transformation matrix. They should be
@@ -124,6 +142,7 @@ bool VideoRendererImpl::CanFastPaint(skia::PlatformCanvas* canvas,
return true;
}
}
+
return false;
}