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

Side by Side Diff: Source/core/html/HTMLVideoElement.cpp

Issue 1093673002: Removing the dependency on GraphicsContext for drawing images in 2D canvas (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: apllied senorblanco feedback Created 5 years, 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 199
200 void HTMLVideoElement::updateDisplayState() 200 void HTMLVideoElement::updateDisplayState()
201 { 201 {
202 if (posterImageURL().isEmpty()) 202 if (posterImageURL().isEmpty())
203 setDisplayMode(Video); 203 setDisplayMode(Video);
204 else if (displayMode() < Poster) 204 else if (displayMode() < Poster)
205 setDisplayMode(Poster); 205 setDisplayMode(Poster);
206 } 206 }
207 207
208 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons t IntRect& destRect) const 208 void HTMLVideoElement::paintCurrentFrame(SkCanvas* canvas, const IntRect& destRe ct, const SkPaint* paint) const
209 { 209 {
210 if (!webMediaPlayer()) 210 if (!webMediaPlayer())
211 return; 211 return;
212 212
213 WebCanvas* canvas = context->canvas(); 213 SkXfermode::Mode mode;
214 SkXfermode::Mode mode = context->compositeOperation(); 214 if (!paint || !SkXfermode::AsMode(paint->getXfermode(), &mode))
215 webMediaPlayer()->paint(canvas, destRect, context->getNormalizedAlpha(), mod e); 215 mode = SkXfermode::kSrcOver_Mode;
216
217 // TODO(junov, philipj): crbug.com/456529 Pass the whole SkPaint instead of only alpha and xfermode
218 webMediaPlayer()->paint(canvas, destRect, paint ? paint->getAlpha() : 0xFF, mode);
216 } 219 }
217 220
218 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(WebGraphicsContext3D* c ontext, Platform3DObject texture, GLint level, GLenum internalFormat, GLenum typ e, bool premultiplyAlpha, bool flipY) 221 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(WebGraphicsContext3D* c ontext, Platform3DObject texture, GLint level, GLenum internalFormat, GLenum typ e, bool premultiplyAlpha, bool flipY)
219 { 222 {
220 if (!webMediaPlayer()) 223 if (!webMediaPlayer())
221 return false; 224 return false;
222 225
223 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, type, level )) 226 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, type, level ))
224 return false; 227 return false;
225 228
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 return nullptr; 309 return nullptr;
307 } 310 }
308 311
309 IntSize intrinsicSize(videoWidth(), videoHeight()); 312 IntSize intrinsicSize(videoWidth(), videoHeight());
310 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); 313 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize);
311 if (!imageBuffer) { 314 if (!imageBuffer) {
312 *status = InvalidSourceImageStatus; 315 *status = InvalidSourceImageStatus;
313 return nullptr; 316 return nullptr;
314 } 317 }
315 318
316 paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), i ntrinsicSize)); 319 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi ze), nullptr);
317 320
318 *status = (mode == CopySourceImageIfVolatile) ? NormalSourceImageStatus : Ex ternalSourceImageStatus; 321 *status = (mode == CopySourceImageIfVolatile) ? NormalSourceImageStatus : Ex ternalSourceImageStatus;
319 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled); 322 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled);
320 } 323 }
321 324
322 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const 325 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const
323 { 326 {
324 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); 327 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin);
325 } 328 }
326 329
327 FloatSize HTMLVideoElement::elementSize() const 330 FloatSize HTMLVideoElement::elementSize() const
328 { 331 {
329 return FloatSize(videoWidth(), videoHeight()); 332 return FloatSize(videoWidth(), videoHeight());
330 } 333 }
331 334
332 } // namespace blink 335 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698