OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 | 115 |
116 GraphicsContext::GraphicsContext(SkCanvas* canvas, DisabledMode disableContextOr Painting) | 116 GraphicsContext::GraphicsContext(SkCanvas* canvas, DisabledMode disableContextOr Painting) |
117 : m_canvas(canvas) | 117 : m_canvas(canvas) |
118 , m_paintStateStack() | 118 , m_paintStateStack() |
119 , m_paintStateIndex(0) | 119 , m_paintStateIndex(0) |
120 , m_pendingCanvasSave(false) | 120 , m_pendingCanvasSave(false) |
121 , m_annotationMode(0) | 121 , m_annotationMode(0) |
122 #if !ASSERT_DISABLED | 122 #if !ASSERT_DISABLED |
123 , m_annotationCount(0) | 123 , m_annotationCount(0) |
124 , m_layerCount(0) | 124 , m_layerCount(0) |
125 , m_disableDestructionChecks(false) | |
125 #endif | 126 #endif |
126 , m_disabledState(disableContextOrPainting) | 127 , m_disabledState(disableContextOrPainting) |
127 , m_trackOpaqueRegion(false) | 128 , m_trackOpaqueRegion(false) |
128 , m_trackTextRegion(false) | 129 , m_trackTextRegion(false) |
129 , m_useHighResMarker(false) | 130 , m_useHighResMarker(false) |
130 , m_updatingControlTints(false) | 131 , m_updatingControlTints(false) |
131 , m_accelerated(false) | 132 , m_accelerated(false) |
132 , m_isCertainlyOpaque(true) | 133 , m_isCertainlyOpaque(true) |
133 , m_printing(false) | 134 , m_printing(false) |
134 , m_antialiasHairlineImages(false) | 135 , m_antialiasHairlineImages(false) |
135 { | 136 { |
136 if (!canvas) | 137 if (!canvas) |
137 m_disabledState |= PaintingDisabled; | 138 m_disabledState |= PaintingDisabled; |
138 | 139 |
139 // FIXME: Do some tests to determine how many states are typically used, and allocate | 140 // FIXME: Do some tests to determine how many states are typically used, and allocate |
140 // several here. | 141 // several here. |
141 m_paintStateStack.append(GraphicsContextState::create()); | 142 m_paintStateStack.append(GraphicsContextState::create()); |
142 m_paintState = m_paintStateStack.last().get(); | 143 m_paintState = m_paintStateStack.last().get(); |
143 } | 144 } |
144 | 145 |
145 GraphicsContext::~GraphicsContext() | 146 GraphicsContext::~GraphicsContext() |
146 { | 147 { |
147 #if !ENABLE(OILPAN) | 148 #if !ASSERT_DISABLED |
Stephen White
2014/05/28 13:23:34
UberNit: isn't this unnecessary, strictly speaking
Justin Novosad
2014/05/28 15:39:07
You would think. But m_disableDestructionChecks is
| |
148 // FIXME: Oilpan: These asserts are not true for | 149 if (!m_disableDestructionChecks) { |
149 // CanvasRenderingContext2D. Therefore, there is debug mode code | 150 ASSERT(!m_paintStateIndex); |
150 // in the CanvasRenderingContext2D that forces this to be true so | 151 ASSERT(!m_paintState->saveCount()); |
151 // that the assertions can be here for all the other cases. With | 152 ASSERT(!m_annotationCount); |
152 // Oilpan we cannot run that code in the CanvasRenderingContext2D | 153 ASSERT(!m_layerCount); |
153 // destructor because it touches other objects that are already | 154 ASSERT(m_recordingStateStack.isEmpty()); |
154 // dead. We need to find another way of doing these asserts when | 155 ASSERT(m_canvasStateStack.isEmpty()); |
155 // Oilpan is enabled. | 156 } |
156 ASSERT(!m_paintStateIndex); | |
157 ASSERT(!m_paintState->saveCount()); | |
158 ASSERT(!m_annotationCount); | |
159 ASSERT(!m_layerCount); | |
160 ASSERT(m_recordingStateStack.isEmpty()); | |
161 #endif | 157 #endif |
162 } | 158 } |
163 | 159 |
164 void GraphicsContext::save() | 160 void GraphicsContext::save() |
165 { | 161 { |
166 if (contextDisabled()) | 162 if (contextDisabled()) |
167 return; | 163 return; |
168 | 164 |
169 m_paintState->incrementSaveCount(); | 165 m_paintState->incrementSaveCount(); |
170 | 166 |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1846 | 1842 |
1847 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) | 1843 void GraphicsContext::didDrawTextInRect(const SkRect& textRect) |
1848 { | 1844 { |
1849 if (m_trackTextRegion) { | 1845 if (m_trackTextRegion) { |
1850 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); | 1846 TRACE_EVENT0("skia", "PlatformContextSkia::trackTextRegion"); |
1851 m_textRegion.join(textRect); | 1847 m_textRegion.join(textRect); |
1852 } | 1848 } |
1853 } | 1849 } |
1854 | 1850 |
1855 } | 1851 } |
OLD | NEW |