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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Canvas2DImageBufferSurface.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 29 matching lines...) Expand all
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> context_provider, 45 std::unique_ptr<WebGraphicsContext3DProvider> context_provider,
46 const IntSize& size, 46 const IntSize& size,
47 int msaa_sample_count, 47 int msaa_sample_count,
48 OpacityMode opacity_mode, 48 OpacityMode opacity_mode,
49 Canvas2DLayerBridge::AccelerationMode acceleration_mode, 49 Canvas2DLayerBridge::AccelerationMode acceleration_mode,
50 const gfx::ColorSpace& color_space, 50 const CanvasColorParams& color_params)
51 bool sk_surfaces_use_color_space, 51 : ImageBufferSurface(size, opacity_mode, color_params),
52 SkColorType color_type)
53 : ImageBufferSurface(size,
54 opacity_mode,
55 sk_surfaces_use_color_space
56 ? color_space.ToSkColorSpace()
57 : nullptr,
58 color_type),
59 layer_bridge_( 52 layer_bridge_(
60 AdoptRef(new Canvas2DLayerBridge(std::move(context_provider), 53 AdoptRef(new Canvas2DLayerBridge(std::move(context_provider),
61 size, 54 size,
62 msaa_sample_count, 55 msaa_sample_count,
63 opacity_mode, 56 opacity_mode,
64 acceleration_mode, 57 acceleration_mode,
65 color_space, 58 color_params))) {
66 sk_surfaces_use_color_space,
67 color_type))) {
68 Init(); 59 Init();
69 } 60 }
70 61
71 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge, 62 Canvas2DImageBufferSurface(PassRefPtr<Canvas2DLayerBridge> bridge,
72 const IntSize& size) 63 const IntSize& size)
73 : ImageBufferSurface(size, 64 : ImageBufferSurface(size,
74 bridge->GetOpacityMode(), 65 bridge->GetOpacityMode(),
75 bridge->SkSurfaceColorSpace(), 66 bridge->color_params()),
76 bridge->ColorType()),
77 layer_bridge_(std::move(bridge)) { 67 layer_bridge_(std::move(bridge)) {
78 Init(); 68 Init();
79 } 69 }
80 70
81 ~Canvas2DImageBufferSurface() override { layer_bridge_->BeginDestruction(); } 71 ~Canvas2DImageBufferSurface() override { layer_bridge_->BeginDestruction(); }
82 72
83 // ImageBufferSurface implementation 73 // ImageBufferSurface implementation
84 void FinalizeFrame() override { layer_bridge_->FinalizeFrame(); } 74 void FinalizeFrame() override { layer_bridge_->FinalizeFrame(); }
85 void DoPaintInvalidation(const FloatRect& dirty_rect) override { 75 void DoPaintInvalidation(const FloatRect& dirty_rect) override {
86 layer_bridge_->DoPaintInvalidation(dirty_rect); 76 layer_bridge_->DoPaintInvalidation(dirty_rect);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (IsValid()) 113 if (IsValid())
124 layer_bridge_->Flush(); 114 layer_bridge_->Flush();
125 } 115 }
126 116
127 RefPtr<Canvas2DLayerBridge> layer_bridge_; 117 RefPtr<Canvas2DLayerBridge> layer_bridge_;
128 }; 118 };
129 119
130 } // namespace blink 120 } // namespace blink
131 121
132 #endif 122 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698