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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 2276033002: Pass SkPaint instead of its alpha and mode in WebMediaPlayer::paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android should compile Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index bb3a4401fa4d67c7ec8ffabc4fa31367a4224c61..3c1cf551a4bf2fb748b6ca2ff902c1f74b6e2cbf 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -620,8 +620,7 @@ bool WebMediaPlayerAndroid::didLoadingProgress() {
void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas,
const blink::WebRect& rect,
- unsigned char alpha,
- SkXfermode::Mode mode) {
+ SkPaint& paint) {
DCHECK(main_thread_checker_.CalledOnValidThread());
std::unique_ptr<blink::WebGraphicsContext3DProvider> provider(
blink::Platform::current()
@@ -669,12 +668,15 @@ void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas,
// readbacked to system memory then draw onto the canvas.
SkRect dest;
dest.set(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
- SkPaint paint;
- paint.setAlpha(alpha);
- paint.setXfermodeMode(mode);
+ SkPaint video_paint;
+ video_paint.setAlpha(paint.getAlpha());
+ SkXfermode::Mode mode;
+ if (!SkXfermode::AsMode(paint.getXfermode(), &mode))
+ mode = SkXfermode::kSrcOver_Mode;
+ video_paint.setXfermodeMode(mode);
// It is not necessary to pass the dest into the drawBitmap call since all
// the context have been set up before calling paintCurrentFrameInContext.
- canvas->drawImageRect(image, dest, &paint);
+ canvas->drawImageRect(image, dest, &video_paint);
// Ensure the Skia draw of the GL texture is flushed to GL, delete the
// mailboxed texture from this context, and then signal that we're done with
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.h ('k') | content/renderer/media/html_video_element_capturer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698