| 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 29 matching lines...) Expand all Loading... |
| 40 // This shim is necessary because ImageBufferSurfaces are not allowed to be | 40 // This shim is necessary because ImageBufferSurfaces are not allowed to be |
| 41 // RefCounted. | 41 // RefCounted. |
| 42 class Canvas2DImageBufferSurface final : public ImageBufferSurface { | 42 class Canvas2DImageBufferSurface final : public ImageBufferSurface { |
| 43 public: | 43 public: |
| 44 Canvas2DImageBufferSurface( | 44 Canvas2DImageBufferSurface( |
| 45 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, | 45 std::unique_ptr<WebGraphicsContext3DProvider> contextProvider, |
| 46 const IntSize& size, | 46 const IntSize& size, |
| 47 int msaaSampleCount, | 47 int msaaSampleCount, |
| 48 OpacityMode opacityMode, | 48 OpacityMode opacityMode, |
| 49 Canvas2DLayerBridge::AccelerationMode accelerationMode, | 49 Canvas2DLayerBridge::AccelerationMode accelerationMode, |
| 50 sk_sp<SkColorSpace> colorSpace, | 50 const gfx::ColorSpace& colorSpace, |
| 51 sk_sp<SkColorSpace> skSurfaceColorSpace, |
| 51 SkColorType colorType) | 52 SkColorType colorType) |
| 52 : ImageBufferSurface(size, opacityMode, colorSpace, colorType), | 53 : ImageBufferSurface(size, |
| 54 opacityMode, |
| 55 colorSpace.ToSkColorSpace(), |
| 56 colorType), |
| 53 m_layerBridge( | 57 m_layerBridge( |
| 54 adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), | 58 adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), |
| 55 size, | 59 size, |
| 56 msaaSampleCount, | 60 msaaSampleCount, |
| 57 opacityMode, | 61 opacityMode, |
| 58 accelerationMode, | 62 accelerationMode, |
| 59 std::move(colorSpace), | 63 colorSpace, |
| 64 std::move(skSurfaceColorSpace), |
| 60 colorType))) { | 65 colorType))) { |
| 61 init(); | 66 init(); |
| 62 } | 67 } |
| 63 | 68 |
| 64 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, | 69 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, |
| 65 const IntSize& size) | 70 const IntSize& size) |
| 66 : ImageBufferSurface(size, | 71 : ImageBufferSurface(size, |
| 67 bridge->opacityMode(), | 72 bridge->opacityMode(), |
| 68 bridge->colorSpace(), | 73 bridge->skSurfaceColorSpace(), |
| 69 bridge->colorType()), | 74 bridge->colorType()), |
| 70 m_layerBridge(std::move(bridge)) { | 75 m_layerBridge(std::move(bridge)) { |
| 71 init(); | 76 init(); |
| 72 } | 77 } |
| 73 | 78 |
| 74 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); } | 79 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); } |
| 75 | 80 |
| 76 // ImageBufferSurface implementation | 81 // ImageBufferSurface implementation |
| 77 void finalizeFrame(const FloatRect& dirtyRect) override { | 82 void finalizeFrame(const FloatRect& dirtyRect) override { |
| 78 m_layerBridge->finalizeFrame(dirtyRect); | 83 m_layerBridge->finalizeFrame(dirtyRect); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (isValid()) | 123 if (isValid()) |
| 119 m_layerBridge->flush(); | 124 m_layerBridge->flush(); |
| 120 } | 125 } |
| 121 | 126 |
| 122 RefPtr<Canvas2DLayerBridge> m_layerBridge; | 127 RefPtr<Canvas2DLayerBridge> m_layerBridge; |
| 123 }; | 128 }; |
| 124 | 129 |
| 125 } // namespace blink | 130 } // namespace blink |
| 126 | 131 |
| 127 #endif | 132 #endif |
| OLD | NEW |