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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp

Issue 2873003002: Add stable id to PaintImage. (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Image.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Image.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698