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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/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: Remove CanvasRenderingContextBase 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 #include "core/html/canvas/CanvasContextCreationAttributes.h"
6 #include "core/html/canvas/OffscreenCanvasRenderingContext.h"
7 #include "core/html/canvas/OffscreenCanvasRenderingContextFactory.h"
8 #include "modules/canvas2d/BaseRenderingContext2D.h"
9
10 namespace blink {
11
12 class OffscreenCanvasRenderingContext2D final : public OffscreenCanvasRenderingC ontext, public BaseRenderingContext2D {
Justin Novosad 2016/03/02 15:41:50 This should go into yet another module 'offscreenc
13 DEFINE_WRAPPERTYPEINFO();
14 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D);
15 public:
16 class Factory : public OffscreenCanvasRenderingContextFactory {
17 WTF_MAKE_NONCOPYABLE(Factory);
18
19 public:
20 Factory() {}
21 ~Factory() override {}
22
23 PassOwnPtrWillBeRawPtr<OffscreenCanvasRenderingContext> create(Offscreen Canvas* canvas, const CanvasContextCreationAttributes& attrs) override
24 {
25 return adoptPtrWillBeNoop(new OffscreenCanvasRenderingContext2D(canv as, attrs));
26 }
27
28 OffscreenCanvasRenderingContext::ContextType contextType() const overrid e
29 {
30 return OffscreenCanvasRenderingContext::Context2d;
31 }
32
33 void onError(OffscreenCanvas* canvas, const String& error) override {}
34 };
35
36 ~OffscreenCanvasRenderingContext2D() override;
37
38 // BaseRenderingContext2D implementation
39 bool originClean() const final;
Justin Novosad 2016/03/02 15:41:50 For a future CL, stuff that is shared between OCRC
40 void setOriginTainted() final;
41 bool wouldTaintOrigin(CanvasImageSource*) final;
42
43 int width() const final;
44 int height() const final;
45
46 bool hasImageBuffer() const final;
47 ImageBuffer* imageBuffer() const final;
48
49 bool parseColorOrCurrentColor(Color&, const String& colorString) const final ;
50
51 SkCanvas* drawingCanvas() const final;
52 SkCanvas* existingDrawingCanvas() const final;
53 void disableDeferral(DisableDeferralReason) final;
54
55 AffineTransform baseTransform() const final;
56 void didDraw(const SkIRect& dirtyRect) final;
57
58 bool stateHasFilter() final;
59 SkImageFilter* stateGetFilter() final;
60
61 void validateStateStack() final;
62
63 bool hasAlpha() const override { return m_hasAlpha; }
64 bool isContextLost() const override;
65
66 protected:
67 OffscreenCanvasRenderingContext2D(OffscreenCanvas*, const CanvasContextCreat ionAttributes& attrs);
68 DECLARE_VIRTUAL_TRACE();
69
70 private:
71 bool m_hasAlpha;
72 };
73
74 } // namespace blink
75
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698