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

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

Issue 2653933003: Make stream captures work on canvases that are not in the DOM. (Closed)
Patch Set: rebase Created 3 years, 10 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bridge->opacityMode(), 73 bridge->opacityMode(),
74 bridge->skSurfaceColorSpace(), 74 bridge->skSurfaceColorSpace(),
75 bridge->colorType()), 75 bridge->colorType()),
76 m_layerBridge(std::move(bridge)) { 76 m_layerBridge(std::move(bridge)) {
77 init(); 77 init();
78 } 78 }
79 79
80 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); } 80 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); }
81 81
82 // ImageBufferSurface implementation 82 // ImageBufferSurface implementation
83 void finalizeFrame(const FloatRect& dirtyRect) override { 83 void finalizeFrame() override { m_layerBridge->finalizeFrame(); }
84 m_layerBridge->finalizeFrame(dirtyRect); 84 void doPaintInvalidation(const FloatRect& dirtyRect) override {
85 m_layerBridge->doPaintInvalidation(dirtyRect);
85 } 86 }
86 void willOverwriteCanvas() override { m_layerBridge->willOverwriteCanvas(); } 87 void willOverwriteCanvas() override { m_layerBridge->willOverwriteCanvas(); }
87 PaintCanvas* canvas() override { return m_layerBridge->canvas(); } 88 PaintCanvas* canvas() override { return m_layerBridge->canvas(); }
88 void disableDeferral(DisableDeferralReason reason) override { 89 void disableDeferral(DisableDeferralReason reason) override {
89 m_layerBridge->disableDeferral(reason); 90 m_layerBridge->disableDeferral(reason);
90 } 91 }
91 bool isValid() const override { return m_layerBridge->checkSurfaceValid(); } 92 bool isValid() const override { return m_layerBridge->checkSurfaceValid(); }
92 bool restore() override { return m_layerBridge->restoreSurface(); } 93 bool restore() override { return m_layerBridge->restoreSurface(); }
93 WebLayer* layer() const override { return m_layerBridge->layer(); } 94 WebLayer* layer() const override { return m_layerBridge->layer(); }
94 bool isAccelerated() const override { return m_layerBridge->isAccelerated(); } 95 bool isAccelerated() const override { return m_layerBridge->isAccelerated(); }
95 void setFilterQuality(SkFilterQuality filterQuality) override { 96 void setFilterQuality(SkFilterQuality filterQuality) override {
96 m_layerBridge->setFilterQuality(filterQuality); 97 m_layerBridge->setFilterQuality(filterQuality);
97 } 98 }
98 void setIsHidden(bool hidden) override { m_layerBridge->setIsHidden(hidden); } 99 void setIsHidden(bool hidden) override { m_layerBridge->setIsHidden(hidden); }
99 void setImageBuffer(ImageBuffer* imageBuffer) override { 100 void setImageBuffer(ImageBuffer* imageBuffer) override {
100 m_layerBridge->setImageBuffer(imageBuffer); 101 m_layerBridge->setImageBuffer(imageBuffer);
101 } 102 }
102 void didDraw(const FloatRect& rect) override { m_layerBridge->didDraw(rect); } 103 void didDraw(const FloatRect& rect) override { m_layerBridge->didDraw(rect); }
103 void flush(FlushReason) override { m_layerBridge->flush(); } 104 void flush(FlushReason) override { m_layerBridge->flush(); }
104 void flushGpu(FlushReason) override { m_layerBridge->flushGpu(); } 105 void flushGpu(FlushReason) override { m_layerBridge->flushGpu(); }
105 void prepareSurfaceForPaintingIfNeeded() override {
106 m_layerBridge->prepareSurfaceForPaintingIfNeeded();
107 }
108 bool writePixels(const SkImageInfo& origInfo, 106 bool writePixels(const SkImageInfo& origInfo,
109 const void* pixels, 107 const void* pixels,
110 size_t rowBytes, 108 size_t rowBytes,
111 int x, 109 int x,
112 int y) override { 110 int y) override {
113 return m_layerBridge->writePixels(origInfo, pixels, rowBytes, x, y); 111 return m_layerBridge->writePixels(origInfo, pixels, rowBytes, x, y);
114 } 112 }
115 113
116 sk_sp<SkImage> newImageSnapshot(AccelerationHint hint, 114 sk_sp<SkImage> newImageSnapshot(AccelerationHint hint,
117 SnapshotReason reason) override { 115 SnapshotReason reason) override {
118 return m_layerBridge->newImageSnapshot(hint, reason); 116 return m_layerBridge->newImageSnapshot(hint, reason);
119 } 117 }
120 118
121 private: 119 private:
122 void init() { 120 void init() {
123 clear(); 121 clear();
124 if (isValid()) 122 if (isValid())
125 m_layerBridge->flush(); 123 m_layerBridge->flush();
126 } 124 }
127 125
128 RefPtr<Canvas2DLayerBridge> m_layerBridge; 126 RefPtr<Canvas2DLayerBridge> m_layerBridge;
129 }; 127 };
130 128
131 } // namespace blink 129 } // namespace blink
132 130
133 #endif 131 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698