| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 // TODO(junov, philipj): crbug.com/456529 Pass the whole SkPaint instead of
only alpha and xfermode | 205 // TODO(junov, philipj): crbug.com/456529 Pass the whole SkPaint instead of
only alpha and xfermode |
| 206 webMediaPlayer()->paint(canvas, destRect, paint ? paint->getAlpha() : 0xFF,
mode); | 206 webMediaPlayer()->paint(canvas, destRect, paint ? paint->getAlpha() : 0xFF,
mode); |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(gpu::gles2::GLES2Interf
ace* gl, GLuint texture, GLenum internalFormat, GLenum type, bool premultiplyAlp
ha, bool flipY) | 209 bool HTMLVideoElement::copyVideoTextureToPlatformTexture(gpu::gles2::GLES2Interf
ace* gl, GLuint texture, GLenum internalFormat, GLenum type, bool premultiplyAlp
ha, bool flipY) |
| 210 { | 210 { |
| 211 if (!webMediaPlayer()) | 211 if (!webMediaPlayer()) |
| 212 return false; | 212 return false; |
| 213 | 213 |
| 214 ASSERT(Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalFo
rmat, type, 0)); | 214 DCHECK(Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalFo
rmat, type, 0)); |
| 215 return webMediaPlayer()->copyVideoTextureToPlatformTexture(gl, texture, inte
rnalFormat, type, premultiplyAlpha, flipY); | 215 return webMediaPlayer()->copyVideoTextureToPlatformTexture(gl, texture, inte
rnalFormat, type, premultiplyAlpha, flipY); |
| 216 } | 216 } |
| 217 | 217 |
| 218 bool HTMLVideoElement::hasAvailableVideoFrame() const | 218 bool HTMLVideoElement::hasAvailableVideoFrame() const |
| 219 { | 219 { |
| 220 if (!webMediaPlayer()) | 220 if (!webMediaPlayer()) |
| 221 return false; | 221 return false; |
| 222 | 222 |
| 223 return webMediaPlayer()->hasVideo() && webMediaPlayer()->getReadyState() >=
WebMediaPlayer::ReadyStateHaveCurrentData; | 223 return webMediaPlayer()->hasVideo() && webMediaPlayer()->getReadyState() >=
WebMediaPlayer::ReadyStateHaveCurrentData; |
| 224 } | 224 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 return FloatSize(videoWidth(), videoHeight()); | 320 return FloatSize(videoWidth(), videoHeight()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 IntSize HTMLVideoElement::bitmapSourceSize() const | 323 IntSize HTMLVideoElement::bitmapSourceSize() const |
| 324 { | 324 { |
| 325 return IntSize(videoWidth(), videoHeight()); | 325 return IntSize(videoWidth(), videoHeight()); |
| 326 } | 326 } |
| 327 | 327 |
| 328 ScriptPromise HTMLVideoElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) | 328 ScriptPromise HTMLVideoElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) |
| 329 { | 329 { |
| 330 ASSERT(eventTarget.toLocalDOMWindow()); | 330 DCHECK(eventTarget.toLocalDOMWindow()); |
| 331 if (getNetworkState() == HTMLMediaElement::NETWORK_EMPTY) { | 331 if (getNetworkState() == HTMLMediaElement::NETWORK_EMPTY) { |
| 332 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t has not retrieved data."); | 332 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t has not retrieved data."); |
| 333 return ScriptPromise(); | 333 return ScriptPromise(); |
| 334 } | 334 } |
| 335 if (getReadyState() <= HTMLMediaElement::HAVE_METADATA) { | 335 if (getReadyState() <= HTMLMediaElement::HAVE_METADATA) { |
| 336 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); | 336 exceptionState.throwDOMException(InvalidStateError, "The provided elemen
t's player has no current data."); |
| 337 return ScriptPromise(); | 337 return ScriptPromise(); |
| 338 } | 338 } |
| 339 if (!sw || !sh) { | 339 if (!sw || !sh) { |
| 340 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 340 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
| 341 return ScriptPromise(); | 341 return ScriptPromise(); |
| 342 } | 342 } |
| 343 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); | 343 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace blink | 346 } // namespace blink |
| OLD | NEW |