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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DImageBufferSurface.h

Issue 2290903002: Change (Pass)RefPtr<SkXxx> into sk_sp<SkXxx>. (Closed)
Patch Set: Rebasing... Created 4 years, 3 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef Canvas2DImageBufferSurface_h 31 #ifndef Canvas2DImageBufferSurface_h
32 #define Canvas2DImageBufferSurface_h 32 #define Canvas2DImageBufferSurface_h
33 33
34 #include "platform/graphics/Canvas2DLayerBridge.h" 34 #include "platform/graphics/Canvas2DLayerBridge.h"
35 #include "platform/graphics/ImageBufferSurface.h" 35 #include "platform/graphics/ImageBufferSurface.h"
36 #include "third_party/skia/include/core/SkRefCnt.h"
36 37
37 namespace blink { 38 namespace blink {
38 39
39 // This shim necessary because ImageBufferSurfaces are not allowed to be RefCoun ted 40 // This shim necessary because ImageBufferSurfaces are not allowed to be RefCoun ted
40 class Canvas2DImageBufferSurface final : public ImageBufferSurface { 41 class Canvas2DImageBufferSurface final : public ImageBufferSurface {
41 public: 42 public:
42 Canvas2DImageBufferSurface(std::unique_ptr<WebGraphicsContext3DProvider> con textProvider, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, Canvas2DLayerBridge::AccelerationMode accelerationMode, sk_sp<SkColorSpace> col orSpace) 43 Canvas2DImageBufferSurface(std::unique_ptr<WebGraphicsContext3DProvider> con textProvider, const IntSize& size, int msaaSampleCount, OpacityMode opacityMode, Canvas2DLayerBridge::AccelerationMode accelerationMode, sk_sp<SkColorSpace> col orSpace)
43 : ImageBufferSurface(size, opacityMode, colorSpace) 44 : ImageBufferSurface(size, opacityMode, colorSpace)
44 , m_layerBridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvid er), size, msaaSampleCount, opacityMode, accelerationMode, colorSpace))) 45 , m_layerBridge(adoptRef(new Canvas2DLayerBridge(std::move(contextProvid er), size, msaaSampleCount, opacityMode, accelerationMode, colorSpace)))
45 { 46 {
(...skipping 23 matching lines...) Expand all
69 bool isAccelerated() const override { return m_layerBridge->isAccelerated(); } 70 bool isAccelerated() const override { return m_layerBridge->isAccelerated(); }
70 void setFilterQuality(SkFilterQuality filterQuality) override { m_layerBridg e->setFilterQuality(filterQuality); } 71 void setFilterQuality(SkFilterQuality filterQuality) override { m_layerBridg e->setFilterQuality(filterQuality); }
71 void setIsHidden(bool hidden) override { m_layerBridge->setIsHidden(hidden); } 72 void setIsHidden(bool hidden) override { m_layerBridge->setIsHidden(hidden); }
72 void setImageBuffer(ImageBuffer* imageBuffer) override { m_layerBridge->setI mageBuffer(imageBuffer); } 73 void setImageBuffer(ImageBuffer* imageBuffer) override { m_layerBridge->setI mageBuffer(imageBuffer); }
73 void didDraw(const FloatRect& rect) override { m_layerBridge->didDraw(rect); } 74 void didDraw(const FloatRect& rect) override { m_layerBridge->didDraw(rect); }
74 void flush(FlushReason) override { m_layerBridge->flush(); } 75 void flush(FlushReason) override { m_layerBridge->flush(); }
75 void flushGpu(FlushReason) override { m_layerBridge->flushGpu(); } 76 void flushGpu(FlushReason) override { m_layerBridge->flushGpu(); }
76 void prepareSurfaceForPaintingIfNeeded() override { m_layerBridge->prepareSu rfaceForPaintingIfNeeded(); } 77 void prepareSurfaceForPaintingIfNeeded() override { m_layerBridge->prepareSu rfaceForPaintingIfNeeded(); }
77 bool writePixels(const SkImageInfo& origInfo, const void* pixels, size_t row Bytes, int x, int y) override { return m_layerBridge->writePixels(origInfo, pixe ls, rowBytes, x, y); } 78 bool writePixels(const SkImageInfo& origInfo, const void* pixels, size_t row Bytes, int x, int y) override { return m_layerBridge->writePixels(origInfo, pixe ls, rowBytes, x, y); }
78 79
79 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint hint, SnapshotReason r eason) override { return m_layerBridge->newImageSnapshot(hint, reason); } 80 sk_sp<SkImage> newImageSnapshot(AccelerationHint hint, SnapshotReason reason ) override { return m_layerBridge->newImageSnapshot(hint, reason); }
80 81
81 private: 82 private:
82 void init() 83 void init()
83 { 84 {
84 clear(); 85 clear();
85 if (isValid()) 86 if (isValid())
86 m_layerBridge->flush(); 87 m_layerBridge->flush();
87 } 88 }
88 89
89 RefPtr<Canvas2DLayerBridge> m_layerBridge; 90 RefPtr<Canvas2DLayerBridge> m_layerBridge;
90 }; 91 };
91 92
92 } // namespace blink 93 } // namespace blink
93 94
94 #endif 95 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698