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

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

Issue 2212163002: Add some plumbing for the color management of canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 21 matching lines...) Expand all
32 #define Canvas2DImageBufferSurface_h 32 #define Canvas2DImageBufferSurface_h
33 33
34 #include "platform/graphics/Canvas2DLayerBridge.h" 34 #include "platform/graphics/Canvas2DLayerBridge.h"
35 #include "platform/graphics/ImageBufferSurface.h" 35 #include "platform/graphics/ImageBufferSurface.h"
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, sk_sp< SkColorSpace> colorSpace)
43 : ImageBufferSurface(size, opacityMode) 43 : ImageBufferSurface(size, opacityMode, colorSpace)
44 , m_layerBridge(Canvas2DLayerBridge::create(size, msaaSampleCount, opaci tyMode, accelerationMode)) 44 , m_layerBridge(Canvas2DLayerBridge::create(size, msaaSampleCount, opaci tyMode, accelerationMode, colorSpace))
45 { 45 {
46 init(); 46 init();
47 } 47 }
48 48
49 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, const Int Size& size) 49 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, const Int Size& size)
50 : ImageBufferSurface(size, bridge->opacityMode()) 50 : ImageBufferSurface(size, bridge->opacityMode(), bridge->colorSpace())
51 , m_layerBridge(std::move(bridge)) 51 , m_layerBridge(std::move(bridge))
52 { 52 {
53 init(); 53 init();
54 } 54 }
55 55
56 void init() 56 void init()
57 { 57 {
58 clear(); 58 clear();
59 if (isValid()) 59 if (isValid())
60 m_layerBridge->flush(); 60 m_layerBridge->flush();
(...skipping 24 matching lines...) Expand all
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); } 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); }
86 86
87 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); }
88 private: 88 private:
89 RefPtr<Canvas2DLayerBridge> m_layerBridge; 89 RefPtr<Canvas2DLayerBridge> m_layerBridge;
90 }; 90 };
91 91
92 } // namespace blink 92 } // namespace blink
93 93
94 #endif 94 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698