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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp

Issue 1855273002: Update new Surface callsites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: software_output_device was indirectly including skia::refptr, switch to sk_sp<> Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/canvas2d/CanvasRenderingContext2D.h" 5 #include "modules/canvas2d/CanvasRenderingContext2D.h"
6 6
7 #include "core/fetch/MemoryCache.h" 7 #include "core/fetch/MemoryCache.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/ImageBitmap.h" 9 #include "core/frame/ImageBitmap.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 private: 48 private:
49 IntSize m_size; 49 IntSize m_size;
50 RefPtr<Image> m_image; 50 RefPtr<Image> m_image;
51 bool m_isOpaque; 51 bool m_isOpaque;
52 }; 52 };
53 53
54 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity) 54 FakeImageSource::FakeImageSource(IntSize size, BitmapOpacity opacity)
55 : m_size(size) 55 : m_size(size)
56 , m_isOpaque(opacity == OpaqueBitmap) 56 , m_isOpaque(opacity == OpaqueBitmap)
57 { 57 {
58 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(m_size.width() , m_size.height())); 58 sk_sp<SkSurface> surface(SkSurface::MakeRasterN32Premul(m_size.width(), m_si ze.height()));
59 surface->getCanvas()->clear(opacity == OpaqueBitmap ? SK_ColorWHITE : SK_Col orTRANSPARENT); 59 surface->getCanvas()->clear(opacity == OpaqueBitmap ? SK_ColorWHITE : SK_Col orTRANSPARENT);
60 RefPtr<SkImage> image = adoptRef(surface->newImageSnapshot()); 60 RefPtr<SkImage> image = adoptRef(surface->newImageSnapshot());
61 m_image = StaticBitmapImage::create(image); 61 m_image = StaticBitmapImage::create(image);
62 } 62 }
63 63
64 PassRefPtr<Image> FakeImageSource::getSourceImageForCanvas(SourceImageStatus* st atus, AccelerationHint, SnapshotReason, const FloatSize&) const 64 PassRefPtr<Image> FakeImageSource::getSourceImageForCanvas(SourceImageStatus* st atus, AccelerationHint, SnapshotReason, const FloatSize&) const
65 { 65 {
66 if (status) 66 if (status)
67 *status = NormalSourceImageStatus; 67 *status = NormalSourceImageStatus;
68 return m_image; 68 return m_image;
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 canvasElement().setSize(IntSize(20, 20)); 713 canvasElement().setSize(IntSize(20, 20));
714 Mock::VerifyAndClearExpectations(fakeAccelerateSurfacePtr); 714 Mock::VerifyAndClearExpectations(fakeAccelerateSurfacePtr);
715 EXPECT_EQ(400, getGlobalGPUMemoryUsage()); 715 EXPECT_EQ(400, getGlobalGPUMemoryUsage());
716 716
717 // Tear down the second image buffer 717 // Tear down the second image buffer
718 imageBuffer2.clear(); 718 imageBuffer2.clear();
719 EXPECT_EQ(0, getGlobalGPUMemoryUsage()); 719 EXPECT_EQ(0, getGlobalGPUMemoryUsage());
720 } 720 }
721 721
722 } // namespace blink 722 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698