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

Side by Side Diff: sky/engine/core/painting/PaintingContext.cpp

Issue 1017373003: Introduce PaintingContext, which will be used for custom painting (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 2015 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 "sky/engine/config.h"
6 #include "sky/engine/core/painting/PaintingContext.h"
7
8 #include "sky/engine/platform/geometry/IntRect.h"
9 #include "third_party/skia/include/core/SkCanvas.h"
10
11 namespace blink {
12
13 PaintingContext::PaintingContext(const FloatRect& bounds)
14 {
15 m_displayList = adoptRef(new DisplayList(bounds));
16 m_canvas = m_displayList->beginRecording(enclosingIntRect(bounds).size());
17 }
18
19 PaintingContext::~PaintingContext()
20 {
21 }
22
23 void PaintingContext::drawCircle(double x, double y, double radius, Paint* paint )
24 {
25 if (!m_canvas)
26 return;
27 ASSERT(paint);
28 ASSERT(m_displayList->isRecording());
29 m_canvas->drawCircle(x, y, radius, paint->paint());
30 }
31
32 void PaintingContext::commit()
33 {
34 m_displayList->endRecording();
35 m_canvas = nullptr;
36 }
37
38 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/painting/PaintingContext.h ('k') | sky/engine/core/painting/PaintingContext.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698