OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 554 |
555 String encodingMimeType = toEncodingMimeType(mimeType); | 555 String encodingMimeType = toEncodingMimeType(mimeType); |
556 | 556 |
557 ImageData* imageData = toImageData(BackBuffer); | 557 ImageData* imageData = toImageData(BackBuffer); |
558 // imageData unref its data, which we still keep alive for the async toBlob
thread | 558 // imageData unref its data, which we still keep alive for the async toBlob
thread |
559 ScopedDisposal<ImageData> disposer(imageData); | 559 ScopedDisposal<ImageData> disposer(imageData); |
560 // Add a ref to keep image data alive until completion of encoding | 560 // Add a ref to keep image data alive until completion of encoding |
561 RefPtr<DOMUint8ClampedArray> imageDataRef(imageData->data()); | 561 RefPtr<DOMUint8ClampedArray> imageDataRef(imageData->data()); |
562 | 562 |
563 RefPtr<CanvasAsyncBlobCreator> asyncCreatorRef = CanvasAsyncBlobCreator::cre
ate(imageDataRef.release(), encodingMimeType, imageData->size(), callback); | 563 RefPtr<CanvasAsyncBlobCreator> asyncCreatorRef = CanvasAsyncBlobCreator::cre
ate(imageDataRef.release(), encodingMimeType, imageData->size(), callback); |
564 if (Platform::current()->isThreadedCompositingEnabled() && (encodingMimeType
== DefaultMimeType)) { | 564 |
565 asyncCreatorRef->scheduleAsyncBlobCreation(true); | 565 // TODO(xlai): Remove idle-periods version of implementation completely, htt
p://crbug.com/564218 |
566 } else { | 566 asyncCreatorRef->scheduleAsyncBlobCreation(false, quality); |
567 asyncCreatorRef->scheduleAsyncBlobCreation(false, quality); | |
568 } | |
569 } | 567 } |
570 | 568 |
571 SecurityOrigin* HTMLCanvasElement::securityOrigin() const | 569 SecurityOrigin* HTMLCanvasElement::securityOrigin() const |
572 { | 570 { |
573 return document().securityOrigin(); | 571 return document().securityOrigin(); |
574 } | 572 } |
575 | 573 |
576 bool HTMLCanvasElement::originClean() const | 574 bool HTMLCanvasElement::originClean() const |
577 { | 575 { |
578 if (document().settings() && document().settings()->disableReadingFromCanvas
()) | 576 if (document().settings() && document().settings()->disableReadingFromCanvas
()) |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } | 950 } |
953 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr); | 951 return ImageBitmapSource::fulfillImageBitmap(scriptState, isPaintable() ? Im
ageBitmap::create(this, IntRect(sx, sy, sw, sh)) : nullptr); |
954 } | 952 } |
955 | 953 |
956 bool HTMLCanvasElement::isOpaque() const | 954 bool HTMLCanvasElement::isOpaque() const |
957 { | 955 { |
958 return m_context && !m_context->hasAlpha(); | 956 return m_context && !m_context->hasAlpha(); |
959 } | 957 } |
960 | 958 |
961 } // blink | 959 } // blink |
OLD | NEW |