OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, Google Inc. All rights reserved. |
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
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 are | 7 * modification, are permitted provided that the following conditions are |
8 * met: | 8 * met: |
9 * | 9 * |
10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 // abort the surface switch to reatain the old surface which is still | 563 // abort the surface switch to reatain the old surface which is still |
564 // functional. | 564 // functional. |
565 if (!image) | 565 if (!image) |
566 return; | 566 return; |
567 | 567 |
568 if (surface->isRecording()) { | 568 if (surface->isRecording()) { |
569 // Using a GPU-backed image with RecordingImageBufferSurface | 569 // Using a GPU-backed image with RecordingImageBufferSurface |
570 // will fail at playback time. | 570 // will fail at playback time. |
571 image = image->makeNonTextureImage(); | 571 image = image->makeNonTextureImage(); |
572 } | 572 } |
573 surface->canvas()->drawImage(image.get(), 0, 0); | 573 surface->canvas()->drawImage(std::move(image), 0, 0); |
574 | 574 |
575 surface->setImageBuffer(this); | 575 surface->setImageBuffer(this); |
576 if (m_client) | 576 if (m_client) |
577 m_client->restoreCanvasMatrixClipStack(surface->canvas()); | 577 m_client->restoreCanvasMatrixClipStack(surface->canvas()); |
578 m_surface = std::move(surface); | 578 m_surface = std::move(surface); |
579 | 579 |
580 updateGPUMemoryUsage(); | 580 updateGPUMemoryUsage(); |
581 } | 581 } |
582 | 582 |
583 bool ImageDataBuffer::encodeImage(const String& mimeType, | 583 bool ImageDataBuffer::encodeImage(const String& mimeType, |
(...skipping 22 matching lines...) Expand all Loading... |
606 DCHECK(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); | 606 DCHECK(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); |
607 | 607 |
608 Vector<unsigned char> result; | 608 Vector<unsigned char> result; |
609 if (!encodeImage(mimeType, quality, &result)) | 609 if (!encodeImage(mimeType, quality, &result)) |
610 return "data:,"; | 610 return "data:,"; |
611 | 611 |
612 return "data:" + mimeType + ";base64," + base64Encode(result); | 612 return "data:" + mimeType + ";base64," + base64Encode(result); |
613 } | 613 } |
614 | 614 |
615 } // namespace blink | 615 } // namespace blink |
OLD | NEW |