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

Side by Side Diff: third_party/WebKit/Source/modules/offscreencanvas2d/OffscreenCanvasRenderingContext2D.h

Issue 1748163003: Add rendering context and rendering 2D context to OffscreenCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with master and fix merge conflicts Created 4 years, 9 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef OffscreenCanvasRenderingContext2D_h
6 #define OffscreenCanvasRenderingContext2D_h
7
8 #include "core/html/canvas/CanvasContextCreationAttributes.h"
9 #include "modules/ModulesExport.h"
10 #include "modules/canvas2d/BaseRenderingContext2D.h"
11 #include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h"
12 #include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h"
13
14 namespace blink {
15
16 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public OffscreenC anvasRenderingContext, public BaseRenderingContext2D {
17 DEFINE_WRAPPERTYPEINFO();
18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D);
19 public:
20 class Factory : public OffscreenCanvasRenderingContextFactory {
21 public:
22 Factory() {}
23 ~Factory() override {}
24
25 OffscreenCanvasRenderingContext* create(OffscreenCanvas* canvas, const C anvasContextCreationAttributes& attrs) override
26 {
27 return new OffscreenCanvasRenderingContext2D(canvas, attrs);
28 }
29
30 OffscreenCanvasRenderingContext::ContextType contextType() const overrid e
31 {
32 return OffscreenCanvasRenderingContext::Context2d;
33 }
34
35 void onError(OffscreenCanvas* canvas, const String& error) override {}
36 };
37
38 // OffscreenCanvasRenderingContext implementation
39 ~OffscreenCanvasRenderingContext2D() override;
40 ContextType contextType() const override { return Context2d; }
41 bool is2d() const override { return true; }
42
43 // BaseRenderingContext2D implementation
44 bool originClean() const final;
45 void setOriginTainted() final;
46 bool wouldTaintOrigin(CanvasImageSource*) final;
47
48 int width() const final;
49 int height() const final;
50
51 bool hasImageBuffer() const final;
52 ImageBuffer* imageBuffer() const final;
53
54 bool parseColorOrCurrentColor(Color&, const String& colorString) const final ;
55
56 SkCanvas* drawingCanvas() const final;
57 SkCanvas* existingDrawingCanvas() const final;
58 void disableDeferral(DisableDeferralReason) final;
59
60 AffineTransform baseTransform() const final;
61 void didDraw(const SkIRect& dirtyRect) final;
62
63 bool stateHasFilter() final;
64 SkImageFilter* stateGetFilter() final;
65
66 void validateStateStack() final;
67
68 bool hasAlpha() const override { return m_hasAlpha; }
69 bool isContextLost() const override;
70
71 protected:
72 OffscreenCanvasRenderingContext2D(OffscreenCanvas*, const CanvasContextCreat ionAttributes& attrs);
73 DECLARE_VIRTUAL_TRACE();
74
75 private:
76 bool m_hasAlpha;
77 };
78
79 } // namespace blink
80
81 #endif // OffscreenCanvasRenderingContext2D_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698