OLD | NEW |
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 Loading... |
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 |
OLD | NEW |