OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 bool newHiddenValue = hidden || m_destructionInProgress; | 159 bool newHiddenValue = hidden || m_destructionInProgress; |
160 if (m_isHidden == newHiddenValue) | 160 if (m_isHidden == newHiddenValue) |
161 return; | 161 return; |
162 | 162 |
163 m_isHidden = newHiddenValue; | 163 m_isHidden = newHiddenValue; |
164 if (isHidden()) { | 164 if (isHidden()) { |
165 freeTransientResources(); | 165 freeTransientResources(); |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 void Canvas2DLayerBridge::willReadback() | 169 void Canvas2DLayerBridge::willAccessPixels() |
170 { | 170 { |
171 // A readback operation may alter the texture parameters, which may affect | 171 // A readback operation may alter the texture parameters, which may affect |
172 // the compositor's behavior. Therefore, we must trigger copy-on-write | 172 // the compositor's behavior. Therefore, we must trigger copy-on-write |
173 // even though we are not technically writing to the texture, only to its | 173 // even though we are not technically writing to the texture, only to its |
174 // parameters. | 174 // parameters. |
175 m_surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMode); | 175 m_surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMode); |
176 } | 176 } |
177 | 177 |
178 void Canvas2DLayerBridge::freeTransientResources() | 178 void Canvas2DLayerBridge::freeTransientResources() |
179 { | 179 { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { | 570 Canvas2DLayerBridge::MailboxInfo::MailboxInfo(const MailboxInfo& other) { |
571 // This copy constructor should only be used for Vector reallocation | 571 // This copy constructor should only be used for Vector reallocation |
572 // Assuming 'other' is to be destroyed, we transfer m_image ownership | 572 // Assuming 'other' is to be destroyed, we transfer m_image ownership |
573 // rather than do a refcount dance. | 573 // rather than do a refcount dance. |
574 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); | 574 memcpy(&m_mailbox, &other.m_mailbox, sizeof(m_mailbox)); |
575 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); | 575 m_image = const_cast<MailboxInfo*>(&other)->m_image.release(); |
576 m_status = other.m_status; | 576 m_status = other.m_status; |
577 } | 577 } |
578 | 578 |
579 } | 579 } |
OLD | NEW |