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

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

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month 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) 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 return; 507 return;
508 508
509 sk_sp<SkImage> image = 509 sk_sp<SkImage> image =
510 m_surface->newImageSnapshot(PreferNoAcceleration, SnapshotReasonPaint); 510 m_surface->newImageSnapshot(PreferNoAcceleration, SnapshotReasonPaint);
511 // Using a GPU-backed image with RecordingImageBufferSurface 511 // Using a GPU-backed image with RecordingImageBufferSurface
512 // will fail at playback time. 512 // will fail at playback time.
513 image = image->makeNonTextureImage(); 513 image = image->makeNonTextureImage();
514 514
515 // Create and configure a recording (unaccelerated) surface. 515 // Create and configure a recording (unaccelerated) surface.
516 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory = 516 std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory =
517 wrapUnique(new UnacceleratedSurfaceFactory()); 517 makeUnique<UnacceleratedSurfaceFactory>();
518 std::unique_ptr<ImageBufferSurface> surface = 518 std::unique_ptr<ImageBufferSurface> surface =
519 wrapUnique(new RecordingImageBufferSurface( 519 wrapUnique(new RecordingImageBufferSurface(
520 m_surface->size(), std::move(surfaceFactory), 520 m_surface->size(), std::move(surfaceFactory),
521 m_surface->getOpacityMode(), m_surface->colorSpace())); 521 m_surface->getOpacityMode(), m_surface->colorSpace()));
522 surface->canvas()->drawImage(image.get(), 0, 0); 522 surface->canvas()->drawImage(image.get(), 0, 0);
523 surface->setImageBuffer(this); 523 surface->setImageBuffer(this);
524 if (m_client) 524 if (m_client)
525 m_client->restoreCanvasMatrixClipStack(surface->canvas()); 525 m_client->restoreCanvasMatrixClipStack(surface->canvas());
526 m_surface = std::move(surface); 526 m_surface = std::move(surface);
527 527
(...skipping 26 matching lines...) Expand all
554 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 554 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
555 555
556 Vector<unsigned char> result; 556 Vector<unsigned char> result;
557 if (!encodeImage(mimeType, quality, &result)) 557 if (!encodeImage(mimeType, quality, &result))
558 return "data:,"; 558 return "data:,";
559 559
560 return "data:" + mimeType + ";base64," + base64Encode(result); 560 return "data:" + mimeType + ";base64," + base64Encode(result);
561 } 561 }
562 562
563 } // namespace blink 563 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698