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

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

Issue 2825183002: Plumb CanvasColorParams to canvas image classes (Closed)
Patch Set: Require both runtime flags Created 3 years, 8 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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef ImageBufferSurface_h 31 #ifndef ImageBufferSurface_h
32 #define ImageBufferSurface_h 32 #define ImageBufferSurface_h
33 33
34 #include "platform/PlatformExport.h" 34 #include "platform/PlatformExport.h"
35 #include "platform/geometry/IntSize.h" 35 #include "platform/geometry/IntSize.h"
36 #include "platform/graphics/CanvasColorParams.h"
36 #include "platform/graphics/GraphicsTypes.h" 37 #include "platform/graphics/GraphicsTypes.h"
37 #include "platform/graphics/paint/PaintCanvas.h" 38 #include "platform/graphics/paint/PaintCanvas.h"
38 #include "platform/graphics/paint/PaintFlags.h" 39 #include "platform/graphics/paint/PaintFlags.h"
39 #include "platform/graphics/paint/PaintRecord.h" 40 #include "platform/graphics/paint/PaintRecord.h"
40 #include "platform/wtf/Allocator.h" 41 #include "platform/wtf/Allocator.h"
41 #include "platform/wtf/Noncopyable.h" 42 #include "platform/wtf/Noncopyable.h"
42 #include "third_party/khronos/GLES2/gl2.h" 43 #include "third_party/khronos/GLES2/gl2.h"
43 #include "third_party/skia/include/core/SkImageInfo.h" 44 #include "third_party/skia/include/core/SkImageInfo.h"
44 #include "third_party/skia/include/core/SkRefCnt.h" 45 #include "third_party/skia/include/core/SkRefCnt.h"
45 46
46 class SkColorSpace;
47 class SkImage; 47 class SkImage;
48 struct SkImageInfo; 48 struct SkImageInfo;
49 49
50 namespace blink { 50 namespace blink {
51 51
52 class ImageBuffer; 52 class ImageBuffer;
53 class WebLayer; 53 class WebLayer;
54 class FloatRect; 54 class FloatRect;
55 class GraphicsContext; 55 class GraphicsContext;
56 56
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 size_t row_bytes, 97 size_t row_bytes,
98 int x, 98 int x,
99 int y); 99 int y);
100 100
101 // May return nullptr if the surface is GPU-backed and the GPU context was 101 // May return nullptr if the surface is GPU-backed and the GPU context was
102 // lost. 102 // lost.
103 virtual sk_sp<SkImage> NewImageSnapshot(AccelerationHint, SnapshotReason) = 0; 103 virtual sk_sp<SkImage> NewImageSnapshot(AccelerationHint, SnapshotReason) = 0;
104 104
105 OpacityMode GetOpacityMode() const { return opacity_mode_; } 105 OpacityMode GetOpacityMode() const { return opacity_mode_; }
106 const IntSize& size() const { return size_; } 106 const IntSize& size() const { return size_; }
107 const sk_sp<SkColorSpace> ColorSpace() const { return color_space_; } 107 const CanvasColorParams& color_params() const { return color_params_; }
108 SkColorType ColorType() const { return color_type_; }
109 void NotifyIsValidChanged(bool is_valid) const; 108 void NotifyIsValidChanged(bool is_valid) const;
110 109
111 protected: 110 protected:
112 ImageBufferSurface(const IntSize&, 111 ImageBufferSurface(const IntSize&, OpacityMode, const CanvasColorParams&);
113 OpacityMode,
114 sk_sp<SkColorSpace>,
115 SkColorType);
116 void Clear(); 112 void Clear();
117 113
118 private: 114 private:
119 OpacityMode opacity_mode_; 115 OpacityMode opacity_mode_;
120 IntSize size_; 116 IntSize size_;
121 sk_sp<SkColorSpace> color_space_; 117 CanvasColorParams color_params_;
122 SkColorType color_type_;
123 }; 118 };
124 119
125 } // namespace blink 120 } // namespace blink
126 121
127 #endif 122 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698