| OLD | NEW |
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 bridge->opacityMode(), | 67 bridge->opacityMode(), |
| 68 bridge->colorSpace(), | 68 bridge->colorSpace(), |
| 69 bridge->colorType()), | 69 bridge->colorType()), |
| 70 m_layerBridge(std::move(bridge)) { | 70 m_layerBridge(std::move(bridge)) { |
| 71 init(); | 71 init(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); } | 74 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); } |
| 75 | 75 |
| 76 // ImageBufferSurface implementation | 76 // ImageBufferSurface implementation |
| 77 void finalizeFrame(const FloatRect& dirtyRect) override { | 77 void finalizeFrame() override { m_layerBridge->finalizeFrame(); } |
| 78 m_layerBridge->finalizeFrame(dirtyRect); | 78 void doPaintInvalidation(const FloatRect& dirtyRect) override { |
| 79 m_layerBridge->doPaintInvalidation(dirtyRect); |
| 79 } | 80 } |
| 80 void willOverwriteCanvas() override { m_layerBridge->willOverwriteCanvas(); } | 81 void willOverwriteCanvas() override { m_layerBridge->willOverwriteCanvas(); } |
| 81 SkCanvas* canvas() override { return m_layerBridge->canvas(); } | 82 SkCanvas* canvas() override { return m_layerBridge->canvas(); } |
| 82 void disableDeferral(DisableDeferralReason reason) override { | 83 void disableDeferral(DisableDeferralReason reason) override { |
| 83 m_layerBridge->disableDeferral(reason); | 84 m_layerBridge->disableDeferral(reason); |
| 84 } | 85 } |
| 85 bool isValid() const override { return m_layerBridge->checkSurfaceValid(); } | 86 bool isValid() const override { return m_layerBridge->checkSurfaceValid(); } |
| 86 bool restore() override { return m_layerBridge->restoreSurface(); } | 87 bool restore() override { return m_layerBridge->restoreSurface(); } |
| 87 WebLayer* layer() const override { return m_layerBridge->layer(); } | 88 WebLayer* layer() const override { return m_layerBridge->layer(); } |
| 88 bool isAccelerated() const override { return m_layerBridge->isAccelerated(); } | 89 bool isAccelerated() const override { return m_layerBridge->isAccelerated(); } |
| 89 void setFilterQuality(SkFilterQuality filterQuality) override { | 90 void setFilterQuality(SkFilterQuality filterQuality) override { |
| 90 m_layerBridge->setFilterQuality(filterQuality); | 91 m_layerBridge->setFilterQuality(filterQuality); |
| 91 } | 92 } |
| 92 void setIsHidden(bool hidden) override { m_layerBridge->setIsHidden(hidden); } | 93 void setIsHidden(bool hidden) override { m_layerBridge->setIsHidden(hidden); } |
| 93 void setImageBuffer(ImageBuffer* imageBuffer) override { | 94 void setImageBuffer(ImageBuffer* imageBuffer) override { |
| 94 m_layerBridge->setImageBuffer(imageBuffer); | 95 m_layerBridge->setImageBuffer(imageBuffer); |
| 95 } | 96 } |
| 96 void didDraw(const FloatRect& rect) override { m_layerBridge->didDraw(rect); } | 97 void didDraw(const FloatRect& rect) override { m_layerBridge->didDraw(rect); } |
| 97 void flush(FlushReason) override { m_layerBridge->flush(); } | 98 void flush(FlushReason) override { m_layerBridge->flush(); } |
| 98 void flushGpu(FlushReason) override { m_layerBridge->flushGpu(); } | 99 void flushGpu(FlushReason) override { m_layerBridge->flushGpu(); } |
| 99 void prepareSurfaceForPaintingIfNeeded() override { | |
| 100 m_layerBridge->prepareSurfaceForPaintingIfNeeded(); | |
| 101 } | |
| 102 bool writePixels(const SkImageInfo& origInfo, | 100 bool writePixels(const SkImageInfo& origInfo, |
| 103 const void* pixels, | 101 const void* pixels, |
| 104 size_t rowBytes, | 102 size_t rowBytes, |
| 105 int x, | 103 int x, |
| 106 int y) override { | 104 int y) override { |
| 107 return m_layerBridge->writePixels(origInfo, pixels, rowBytes, x, y); | 105 return m_layerBridge->writePixels(origInfo, pixels, rowBytes, x, y); |
| 108 } | 106 } |
| 109 | 107 |
| 110 sk_sp<SkImage> newImageSnapshot(AccelerationHint hint, | 108 sk_sp<SkImage> newImageSnapshot(AccelerationHint hint, |
| 111 SnapshotReason reason) override { | 109 SnapshotReason reason) override { |
| 112 return m_layerBridge->newImageSnapshot(hint, reason); | 110 return m_layerBridge->newImageSnapshot(hint, reason); |
| 113 } | 111 } |
| 114 | 112 |
| 115 private: | 113 private: |
| 116 void init() { | 114 void init() { |
| 117 clear(); | 115 clear(); |
| 118 if (isValid()) | 116 if (isValid()) |
| 119 m_layerBridge->flush(); | 117 m_layerBridge->flush(); |
| 120 } | 118 } |
| 121 | 119 |
| 122 RefPtr<Canvas2DLayerBridge> m_layerBridge; | 120 RefPtr<Canvas2DLayerBridge> m_layerBridge; |
| 123 }; | 121 }; |
| 124 | 122 |
| 125 } // namespace blink | 123 } // namespace blink |
| 126 | 124 |
| 127 #endif | 125 #endif |
| OLD | NEW |