| 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 bool skSurfacesUseColorSpace, |
| 51 SkColorType colorType) | 52 SkColorType colorType) |
| 52 : ImageBufferSurface(size, opacityMode, colorSpace, colorType), | 53 : ImageBufferSurface( |
| 54 size, |
| 55 opacityMode, |
| 56 skSurfacesUseColorSpace ? colorSpace.ToSkColorSpace() : nullptr, |
| 57 colorType), |
| 53 m_layerBridge( | 58 m_layerBridge( |
| 54 adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), | 59 adoptRef(new Canvas2DLayerBridge(std::move(contextProvider), |
| 55 size, | 60 size, |
| 56 msaaSampleCount, | 61 msaaSampleCount, |
| 57 opacityMode, | 62 opacityMode, |
| 58 accelerationMode, | 63 accelerationMode, |
| 59 std::move(colorSpace), | 64 colorSpace, |
| 65 skSurfacesUseColorSpace, |
| 60 colorType))) { | 66 colorType))) { |
| 61 init(); | 67 init(); |
| 62 } | 68 } |
| 63 | 69 |
| 64 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, | 70 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, |
| 65 const IntSize& size) | 71 const IntSize& size) |
| 66 : ImageBufferSurface(size, | 72 : ImageBufferSurface(size, |
| 67 bridge->opacityMode(), | 73 bridge->opacityMode(), |
| 68 bridge->colorSpace(), | 74 bridge->skSurfaceColorSpace(), |
| 69 bridge->colorType()), | 75 bridge->colorType()), |
| 70 m_layerBridge(std::move(bridge)) { | 76 m_layerBridge(std::move(bridge)) { |
| 71 init(); | 77 init(); |
| 72 } | 78 } |
| 73 | 79 |
| 74 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); } | 80 ~Canvas2DImageBufferSurface() override { m_layerBridge->beginDestruction(); } |
| 75 | 81 |
| 76 // ImageBufferSurface implementation | 82 // ImageBufferSurface implementation |
| 77 void finalizeFrame(const FloatRect& dirtyRect) override { | 83 void finalizeFrame(const FloatRect& dirtyRect) override { |
| 78 m_layerBridge->finalizeFrame(dirtyRect); | 84 m_layerBridge->finalizeFrame(dirtyRect); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (isValid()) | 124 if (isValid()) |
| 119 m_layerBridge->flush(); | 125 m_layerBridge->flush(); |
| 120 } | 126 } |
| 121 | 127 |
| 122 RefPtr<Canvas2DLayerBridge> m_layerBridge; | 128 RefPtr<Canvas2DLayerBridge> m_layerBridge; |
| 123 }; | 129 }; |
| 124 | 130 |
| 125 } // namespace blink | 131 } // namespace blink |
| 126 | 132 |
| 127 #endif | 133 #endif |
| OLD | NEW |