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

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

Issue 1372463002: Re-land: Make 2D canvas smarter about chosing whether or not to use GPU acceleration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed assert Created 5 years, 2 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
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 277 }
278 278
279 KURL HTMLVideoElement::posterImageURL() const 279 KURL HTMLVideoElement::posterImageURL() const
280 { 280 {
281 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL()); 281 String url = stripLeadingAndTrailingHTMLSpaces(imageSourceURL());
282 if (url.isEmpty()) 282 if (url.isEmpty())
283 return KURL(); 283 return KURL();
284 return document().completeURL(url); 284 return document().completeURL(url);
285 } 285 }
286 286
287 PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageStatus* s tatus) const 287 PassRefPtr<Image> HTMLVideoElement::getSourceImageForCanvas(SourceImageStatus* s tatus, AccelerationHint) const
288 { 288 {
289 if (!hasAvailableVideoFrame()) { 289 if (!hasAvailableVideoFrame()) {
290 *status = InvalidSourceImageStatus; 290 *status = InvalidSourceImageStatus;
291 return nullptr; 291 return nullptr;
292 } 292 }
293 293
294 IntSize intrinsicSize(videoWidth(), videoHeight()); 294 IntSize intrinsicSize(videoWidth(), videoHeight());
295 // FIXME: Not sure if we dhould we be doing anything with the AccelerationHi nt argument here?
295 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize); 296 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(intrinsicSize);
296 if (!imageBuffer) { 297 if (!imageBuffer) {
297 *status = InvalidSourceImageStatus; 298 *status = InvalidSourceImageStatus;
298 return nullptr; 299 return nullptr;
299 } 300 }
300 301
301 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi ze), nullptr); 302 paintCurrentFrame(imageBuffer->canvas(), IntRect(IntPoint(0, 0), intrinsicSi ze), nullptr);
302 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot(); 303 RefPtr<Image> snapshot = imageBuffer->newImageSnapshot();
303 if (!snapshot) { 304 if (!snapshot) {
304 *status = InvalidSourceImageStatus; 305 *status = InvalidSourceImageStatus;
305 return nullptr; 306 return nullptr;
306 } 307 }
307 308
308 *status = NormalSourceImageStatus; 309 *status = NormalSourceImageStatus;
309 return snapshot.release(); 310 return snapshot.release();
310 } 311 }
311 312
312 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const 313 bool HTMLVideoElement::wouldTaintOrigin(SecurityOrigin* destinationSecurityOrigi n) const
313 { 314 {
314 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin); 315 return !isMediaDataCORSSameOrigin(destinationSecurityOrigin);
315 } 316 }
316 317
317 FloatSize HTMLVideoElement::elementSize() const 318 FloatSize HTMLVideoElement::elementSize() const
318 { 319 {
319 return FloatSize(videoWidth(), videoHeight()); 320 return FloatSize(videoWidth(), videoHeight());
320 } 321 }
321 322
322 } // namespace blink 323 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLVideoElement.h ('k') | third_party/WebKit/Source/core/html/canvas/CanvasImageSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698