Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 } | 193 } |
| 194 | 194 |
| 195 void HTMLVideoElement::updateDisplayState() | 195 void HTMLVideoElement::updateDisplayState() |
| 196 { | 196 { |
| 197 if (posterImageURL().isEmpty()) | 197 if (posterImageURL().isEmpty()) |
| 198 setDisplayMode(Video); | 198 setDisplayMode(Video); |
| 199 else if (displayMode() < Poster) | 199 else if (displayMode() < Poster) |
| 200 setDisplayMode(Poster); | 200 setDisplayMode(Poster); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, cons t IntRect& destRect) const | 203 void HTMLVideoElement::paintCurrentFrame(SkCanvas* canvas, const IntRect& destRe ct, const SkPaint* paint) const |
| 204 { | 204 { |
| 205 if (!webMediaPlayer()) | 205 if (!webMediaPlayer()) |
| 206 return; | 206 return; |
| 207 | 207 |
| 208 WebCanvas* canvas = context->canvas(); | 208 SkXfermode::Mode mode; |
| 209 SkXfermode::Mode mode = context->compositeOperation(); | 209 if (!paint || !SkXfermode::AsMode(paint->getXfermode(), &mode)) |
| 210 webMediaPlayer()->paint(canvas, destRect, context->getNormalizedAlpha(), mod e); | 210 mode = SkXfermode::kSrcOver_Mode; |
| 211 | |
| 212 // TODO(junov, philipj): pass the whole SkPaint instead of only alpha and xf ermode | |
|
Stephen White
2015/04/17 15:14:56
Please add a reference in the comment to the video
| |
| 213 webMediaPlayer()->paint(canvas, destRect, paint ? paint->getAlpha() : 0xFF, mode); | |
| 211 } | 214 } |
| 212 | 215 |
| 213 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(WebGraphicsContext3D* c ontext, Platform3DObject texture, GLint level, GLenum internalFormat, GLenum typ e, bool premultiplyAlpha, bool flipY) | 216 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(WebGraphicsContext3D* c ontext, Platform3DObject texture, GLint level, GLenum internalFormat, GLenum typ e, bool premultiplyAlpha, bool flipY) |
| 214 { | 217 { |
| 215 if (!webMediaPlayer()) | 218 if (!webMediaPlayer()) |
| 216 return false; | 219 return false; |
| 217 | 220 |
| 218 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, type, level )) | 221 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, type, level )) |
| 219 return false; | 222 return false; |
| 220 | 223 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 return nullptr; | 304 return nullptr; |
| 302 } | 305 } |
| 303 | 306 |
| 304 IntSize intrinsicSize(videoWidth(), videoHeight()); | 307 IntSize intrinsicSize(videoWidth(), videoHeight()); |
| 305 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); | 308 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); |
| 306 if (!imageBuffer) { | 309 if (!imageBuffer) { |
| 307 *status = InvalidSourceImageStatus; | 310 *status = InvalidSourceImageStatus; |
| 308 return nullptr; | 311 return nullptr; |
| 309 } | 312 } |
| 310 | 313 |
| 311 paintCurrentFrameInContext(imageBuffer->context(), IntRect(IntPoint(0, 0), i ntrinsicSize)); | 314 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi ze), nullptr); |
| 312 | 315 |
| 313 *status = (mode == CopySourceImageIfVolatile) ? NormalSourceImageStatus : Ex ternalSourceImageStatus; | 316 *status = (mode == CopySourceImageIfVolatile) ? NormalSourceImageStatus : Ex ternalSourceImageStatus; |
| 314 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled); | 317 return imageBuffer->copyImage(mode == CopySourceImageIfVolatile ? CopyBackin gStore : DontCopyBackingStore, Unscaled); |
| 315 } | 318 } |
| 316 | 319 |
| 317 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const | 320 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const |
| 318 { | 321 { |
| 319 return hasAvailableVideoFrame() && !isMediaDataCORSSameOrigin(destinationSec urityOrigin); | 322 return hasAvailableVideoFrame() && !isMediaDataCORSSameOrigin(destinationSec urityOrigin); |
| 320 } | 323 } |
| 321 | 324 |
| 322 FloatSize HTMLVideoElement::elementSize() const | 325 FloatSize HTMLVideoElement::elementSize() const |
| 323 { | 326 { |
| 324 return FloatSize(videoWidth(), videoHeight()); | 327 return FloatSize(videoWidth(), videoHeight()); |
| 325 } | 328 } |
| 326 | 329 |
| 327 } | 330 } |
| OLD | NEW |