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

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

Issue 2123623002: Reland: Make 2D canvas disable gpu acceleration when getImageData is called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 5 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 25 matching lines...) Expand all
36 36
37 namespace blink { 37 namespace blink {
38 38
39 // This shim necessary because ImageBufferSurfaces are not allowed to be RefCoun ted 39 // This shim necessary because ImageBufferSurfaces are not allowed to be RefCoun ted
40 class Canvas2DImageBufferSurface final : public ImageBufferSurface { 40 class Canvas2DImageBufferSurface final : public ImageBufferSurface {
41 public: 41 public:
42 Canvas2DImageBufferSurface(const IntSize& size, int msaaSampleCount, Opacity Mode opacityMode, Canvas2DLayerBridge::AccelerationMode accelerationMode) 42 Canvas2DImageBufferSurface(const IntSize& size, int msaaSampleCount, Opacity Mode opacityMode, Canvas2DLayerBridge::AccelerationMode accelerationMode)
43 : ImageBufferSurface(size, opacityMode) 43 : ImageBufferSurface(size, opacityMode)
44 , m_layerBridge(Canvas2DLayerBridge::create(size, msaaSampleCount, opaci tyMode, accelerationMode)) 44 , m_layerBridge(Canvas2DLayerBridge::create(size, msaaSampleCount, opaci tyMode, accelerationMode))
45 { 45 {
46 init();
47 }
48
49 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, const Int Size& size)
50 : ImageBufferSurface(size, bridge->opacityMode())
51 , m_layerBridge(std::move(bridge))
52 {
53 init();
54 }
55
56 void init()
57 {
46 clear(); 58 clear();
47 if (isValid()) 59 if (isValid())
48 m_layerBridge->flush(); 60 m_layerBridge->flush();
49 } 61 }
50 62
51 ~Canvas2DImageBufferSurface() override 63 ~Canvas2DImageBufferSurface() override
52 { 64 {
53 if (m_layerBridge) 65 if (m_layerBridge)
54 m_layerBridge->beginDestruction(); 66 m_layerBridge->beginDestruction();
55 } 67 }
(...skipping 17 matching lines...) Expand all
73 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); } 85 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); }
74 86
75 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint hint, SnapshotReason r eason) override { return m_layerBridge->newImageSnapshot(hint, reason); } 87 PassRefPtr<SkImage> newImageSnapshot(AccelerationHint hint, SnapshotReason r eason) override { return m_layerBridge->newImageSnapshot(hint, reason); }
76 private: 88 private:
77 RefPtr<Canvas2DLayerBridge> m_layerBridge; 89 RefPtr<Canvas2DLayerBridge> m_layerBridge;
78 }; 90 };
79 91
80 } // namespace blink 92 } // namespace blink
81 93
82 #endif 94 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698