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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 GraphicsContext* GraphicsContextRecorder::record(const IntSize& size, bool isCer
tainlyOpaque) | 51 GraphicsContext* GraphicsContextRecorder::record(const IntSize& size, bool isCer
tainlyOpaque) |
52 { | 52 { |
53 ASSERT(!m_picture); | 53 ASSERT(!m_picture); |
54 ASSERT(!m_recorder); | 54 ASSERT(!m_recorder); |
55 ASSERT(!m_context); | 55 ASSERT(!m_context); |
56 m_isCertainlyOpaque = isCertainlyOpaque; | 56 m_isCertainlyOpaque = isCertainlyOpaque; |
57 m_recorder = adoptPtr(new SkPictureRecorder); | 57 m_recorder = adoptPtr(new SkPictureRecorder); |
58 SkCanvas* canvas = m_recorder->beginRecording(size.width(), size.height(), 0
, 0); | 58 SkCanvas* canvas = m_recorder->beginRecording(size.width(), size.height(), 0
, 0); |
59 m_context = adoptPtr(new GraphicsContext(canvas)); | 59 m_context = adoptPtr(new GraphicsContext(canvas)); |
60 m_context->setTrackOpaqueRegion(isCertainlyOpaque); | 60 m_context->setRegionTrackingMode(isCertainlyOpaque ? GraphicsContext::Region
TrackingOpaque : GraphicsContext::RegionTrackingDisabled); |
61 m_context->setCertainlyOpaque(isCertainlyOpaque); | 61 m_context->setCertainlyOpaque(isCertainlyOpaque); |
62 return m_context.get(); | 62 return m_context.get(); |
63 } | 63 } |
64 | 64 |
65 PassRefPtr<GraphicsContextSnapshot> GraphicsContextRecorder::stop() | 65 PassRefPtr<GraphicsContextSnapshot> GraphicsContextRecorder::stop() |
66 { | 66 { |
67 m_context.clear(); | 67 m_context.clear(); |
68 m_picture = adoptRef(m_recorder->endRecording()); | 68 m_picture = adoptRef(m_recorder->endRecording()); |
69 m_recorder.clear(); | 69 m_recorder.clear(); |
70 return adoptRef(new GraphicsContextSnapshot(m_picture.release(), m_isCertain
lyOpaque)); | 70 return adoptRef(new GraphicsContextSnapshot(m_picture.release(), m_isCertain
lyOpaque)); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 | 146 |
147 PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const | 147 PassRefPtr<JSONArray> GraphicsContextSnapshot::snapshotCommandLog() const |
148 { | 148 { |
149 LoggingCanvas canvas(m_picture->width(), m_picture->height()); | 149 LoggingCanvas canvas(m_picture->width(), m_picture->height()); |
150 m_picture->draw(&canvas); | 150 m_picture->draw(&canvas); |
151 return canvas.log(); | 151 return canvas.log(); |
152 } | 152 } |
153 | 153 |
154 } | 154 } |
OLD | NEW |