OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 , m_transformMode(KeepTransform) | 150 , m_transformMode(KeepTransform) |
151 , m_drawContext(0) | 151 , m_drawContext(0) |
152 , m_savedOnDrawContext(false) | 152 , m_savedOnDrawContext(false) |
153 , m_layerBuffer(0) | 153 , m_layerBuffer(0) |
154 , m_referenceBitmap(0) | 154 , m_referenceBitmap(0) |
155 { | 155 { |
156 } | 156 } |
157 | 157 |
158 TransparencyWin::~TransparencyWin() | 158 TransparencyWin::~TransparencyWin() |
159 { | 159 { |
| 160 // This should be false, since calling composite() is mandatory. |
| 161 ASSERT(!m_savedOnDrawContext); |
| 162 } |
| 163 |
| 164 void TransparencyWin::composite() |
| 165 { |
160 // Matches the save() in initializeNewTextContext (or the constructor for | 166 // Matches the save() in initializeNewTextContext (or the constructor for |
161 // SCALE) to put the context back into the same state we found it. | 167 // SCALE) to put the context back into the same state we found it. |
162 if (m_savedOnDrawContext) | 168 if (m_savedOnDrawContext) { |
163 m_drawContext->restore(); | 169 m_drawContext->restore(); |
| 170 m_savedOnDrawContext = false; |
| 171 } |
164 | 172 |
165 switch (m_layerMode) { | 173 switch (m_layerMode) { |
166 case NoLayer: | 174 case NoLayer: |
167 break; | 175 break; |
168 case OpaqueCompositeLayer: | 176 case OpaqueCompositeLayer: |
169 case WhiteLayer: | 177 case WhiteLayer: |
170 compositeOpaqueComposite(); | 178 compositeOpaqueComposite(); |
171 break; | 179 break; |
172 case TextComposite: | 180 case TextComposite: |
173 compositeTextComposite(); | 181 compositeTextComposite(); |
174 break; | 182 break; |
175 } | 183 } |
176 } | 184 } |
177 | 185 |
178 void TransparencyWin::init(GraphicsContext* dest, | 186 void TransparencyWin::init(GraphicsContext* dest, |
179 LayerMode layerMode, | 187 LayerMode layerMode, |
180 TransformMode transformMode, | 188 TransformMode transformMode, |
181 const IntRect& region) { | 189 const IntRect& region) |
| 190 { |
182 m_destContext = dest; | 191 m_destContext = dest; |
183 m_orgTransform = dest->getCTM(); | 192 m_orgTransform = dest->getCTM(); |
184 m_layerMode = layerMode; | 193 m_layerMode = layerMode; |
185 m_transformMode = transformMode; | 194 m_transformMode = transformMode; |
186 m_sourceRect = region; | 195 m_sourceRect = region; |
187 | 196 |
188 computeLayerSize(); | 197 computeLayerSize(); |
189 setupLayer(); | 198 setupLayer(); |
190 setupTransform(region); | 199 setupTransform(region); |
191 } | 200 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 canvas()->getTopPlatformDevice().accessBitmap(true)); | 471 canvas()->getTopPlatformDevice().accessBitmap(true)); |
463 for (int y = 0; y < m_layerSize.height(); y++) { | 472 for (int y = 0; y < m_layerSize.height(); y++) { |
464 uint32_t* row = bitmap.getAddr32(0, y); | 473 uint32_t* row = bitmap.getAddr32(0, y); |
465 for (int x = 0; x < m_layerSize.width(); x++) | 474 for (int x = 0; x < m_layerSize.width(); x++) |
466 row[x] |= 0xFF000000; | 475 row[x] |= 0xFF000000; |
467 } | 476 } |
468 } | 477 } |
469 | 478 |
470 } // namespace WebCore | 479 } // namespace WebCore |
471 | 480 |
OLD | NEW |