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

Side by Side Diff: sky/engine/platform/graphics/DisplayList.cpp

Issue 1017593005: Add a basic custom painting facility to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add missing files 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
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 20 matching lines...) Expand all
31 #include "sky/engine/config.h" 31 #include "sky/engine/config.h"
32 #include "sky/engine/platform/graphics/DisplayList.h" 32 #include "sky/engine/platform/graphics/DisplayList.h"
33 33
34 #include "sky/engine/platform/geometry/IntSize.h" 34 #include "sky/engine/platform/geometry/IntSize.h"
35 #include "sky/engine/wtf/PassOwnPtr.h" 35 #include "sky/engine/wtf/PassOwnPtr.h"
36 #include "third_party/skia/include/core/SkPicture.h" 36 #include "third_party/skia/include/core/SkPicture.h"
37 #include "third_party/skia/include/core/SkPictureRecorder.h" 37 #include "third_party/skia/include/core/SkPictureRecorder.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 DisplayList::DisplayList(const FloatRect& bounds) 41 DisplayList::DisplayList()
42 : m_bounds(bounds)
43 { 42 {
44 } 43 }
45 44
46 DisplayList::~DisplayList() 45 DisplayList::~DisplayList()
47 { 46 {
48 } 47 }
49 48
50 const FloatRect& DisplayList::bounds() const
51 {
52 return m_bounds;
53 }
54
55 SkPicture* DisplayList::picture() const 49 SkPicture* DisplayList::picture() const
56 { 50 {
57 return m_picture.get(); 51 return m_picture.get();
58 } 52 }
59 53
60 SkCanvas* DisplayList::beginRecording(const IntSize& size, uint32_t recordFlags) 54 SkCanvas* DisplayList::beginRecording(const IntSize& size, uint32_t recordFlags)
61 { 55 {
62 m_picture.clear(); 56 m_picture.clear();
63 if (!m_recorder) 57 if (!m_recorder)
64 m_recorder = adoptPtr(new SkPictureRecorder); 58 m_recorder = adoptPtr(new SkPictureRecorder);
65 return m_recorder->beginRecording(size.width(), size.height(), 0, recordFlag s); 59 return m_recorder->beginRecording(size.width(), size.height(), 0, recordFlag s);
66 } 60 }
67 61
68 void DisplayList::endRecording() 62 void DisplayList::endRecording()
69 { 63 {
70 if (m_recorder) { 64 if (m_recorder) {
71 m_picture = adoptRef(m_recorder->endRecording()); 65 m_picture = adoptRef(m_recorder->endRecording());
72 m_recorder.clear(); 66 m_recorder.clear();
73 } 67 }
74 } 68 }
75 69
76 } // namespace blink 70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698