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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 return; | 517 return; |
518 | 518 |
519 if (surface->IsRecording()) { | 519 if (surface->IsRecording()) { |
520 // Using a GPU-backed image with RecordingImageBufferSurface | 520 // Using a GPU-backed image with RecordingImageBufferSurface |
521 // will fail at playback time. | 521 // will fail at playback time. |
522 image = image->makeNonTextureImage(); | 522 image = image->makeNonTextureImage(); |
523 } | 523 } |
524 // TODO(vmpstr): Figure out actual values for this. | 524 // TODO(vmpstr): Figure out actual values for this. |
525 auto animation_type = PaintImage::AnimationType::UNKNOWN; | 525 auto animation_type = PaintImage::AnimationType::UNKNOWN; |
526 auto completion_state = PaintImage::CompletionState::UNKNOWN; | 526 auto completion_state = PaintImage::CompletionState::UNKNOWN; |
527 surface->Canvas()->drawImage( | 527 static PaintImage::Id unknown_stable_id = PaintImage::GetNextId(); |
528 PaintImage(std::move(image), animation_type, completion_state), 0, 0); | 528 surface->Canvas()->drawImage(PaintImage(unknown_stable_id, std::move(image), |
| 529 animation_type, completion_state), |
| 530 0, 0); |
529 | 531 |
530 surface->SetImageBuffer(this); | 532 surface->SetImageBuffer(this); |
531 if (client_) | 533 if (client_) |
532 client_->RestoreCanvasMatrixClipStack(surface->Canvas()); | 534 client_->RestoreCanvasMatrixClipStack(surface->Canvas()); |
533 surface_ = std::move(surface); | 535 surface_ = std::move(surface); |
534 | 536 |
535 UpdateGPUMemoryUsage(); | 537 UpdateGPUMemoryUsage(); |
536 } | 538 } |
537 | 539 |
538 void ImageBuffer::SetNeedsCompositingUpdate() { | 540 void ImageBuffer::SetNeedsCompositingUpdate() { |
(...skipping 27 matching lines...) Expand all Loading... |
566 DCHECK(MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding(mime_type)); | 568 DCHECK(MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding(mime_type)); |
567 | 569 |
568 Vector<unsigned char> result; | 570 Vector<unsigned char> result; |
569 if (!EncodeImage(mime_type, quality, &result)) | 571 if (!EncodeImage(mime_type, quality, &result)) |
570 return "data:,"; | 572 return "data:,"; |
571 | 573 |
572 return "data:" + mime_type + ";base64," + Base64Encode(result); | 574 return "data:" + mime_type + ";base64," + Base64Encode(result); |
573 } | 575 } |
574 | 576 |
575 } // namespace blink | 577 } // namespace blink |
OLD | NEW |