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

Unified Diff: sky/engine/core/painting/Canvas.h

Issue 1122423009: Make it possible to custom-paint without an Element. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Comment tweak Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/dom/Document.idl ('k') | sky/engine/core/painting/Canvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/painting/Canvas.h
diff --git a/sky/engine/core/painting/PaintingContext.h b/sky/engine/core/painting/Canvas.h
similarity index 60%
copy from sky/engine/core/painting/PaintingContext.h
copy to sky/engine/core/painting/Canvas.h
index 2c082522213f507a79707e6c1bb73e0b4388426c..8cb0b21ba530138306c792e5f647e223f0ca4e04 100644
--- a/sky/engine/core/painting/PaintingContext.h
+++ b/sky/engine/core/painting/Canvas.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_
-#define SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_
+#ifndef SKY_ENGINE_CORE_PAINTING_CANVAS_H_
+#define SKY_ENGINE_CORE_PAINTING_CANVAS_H_
#include "sky/engine/core/painting/Paint.h"
#include "sky/engine/platform/graphics/DisplayList.h"
@@ -14,22 +14,25 @@
namespace blink {
class Element;
-class PaintingContext : public RefCounted<PaintingContext>, public DartWrappable {
+class Canvas : public RefCounted<Canvas>, public DartWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
- ~PaintingContext() override;
- static PassRefPtr<PaintingContext> create(PassRefPtr<Element> element, const FloatSize& size);
+ Canvas(const FloatSize& size);
+ ~Canvas() override;
- double height() const { return m_size.height(); }
+ // Width/Height define a culling rect which Skia may use for optimizing
+ // out draw calls issued outside the rect.
double width() const { return m_size.width(); }
+ double height() const { return m_size.height(); }
void drawCircle(double x, double y, double radius, Paint* paint);
Matt Perry 2015/05/13 18:33:21 Skia takes these params as SkScalars, which are fl
- void commit();
-private:
- PaintingContext(PassRefPtr<Element> element, const FloatSize& size);
+protected:
+ PassRefPtr<DisplayList> finishRecording();
- RefPtr<Element> m_element;
+ bool isRecording() const { return m_canvas; }
+
+private:
FloatSize m_size;
RefPtr<DisplayList> m_displayList;
SkCanvas* m_canvas;
@@ -37,4 +40,4 @@ private:
} // namespace blink
-#endif // SKY_ENGINE_CORE_PAINTING_PAINTINGCONTEXT_H_
+#endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_
« no previous file with comments | « sky/engine/core/dom/Document.idl ('k') | sky/engine/core/painting/Canvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698