blob: a5ca49847bb6dbaf8fbf4e42b0c2bc465d8b3859 [file] [log] [blame]
Jeff Brown5541de92011-04-11 11:54:25 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "Sprites"
Jeff Brown5541de92011-04-11 11:54:25 -070018//#define LOG_NDEBUG 0
19
20#include "SpriteController.h"
21
Mark Salyzyn52eb4e02016-09-28 16:15:30 -070022#include <log/log.h>
Jeff Brown5541de92011-04-11 11:54:25 -070023#include <utils/String8.h>
Mathias Agopian52800612013-02-14 17:11:20 -080024#include <gui/Surface.h>
Jeff Brown5541de92011-04-11 11:54:25 -070025
Jeff Brown5541de92011-04-11 11:54:25 -070026namespace android {
27
28// --- SpriteController ---
29
Prabir Pradhanfef0c612021-11-04 14:08:50 -070030SpriteController::SpriteController(const sp<Looper>& looper, int32_t overlayLayer,
31 ParentSurfaceProvider parentSurfaceProvider)
32 : mLooper(looper),
33 mOverlayLayer(overlayLayer),
34 mParentSurfaceProvider(std::move(parentSurfaceProvider)) {
Jeff Brown5541de92011-04-11 11:54:25 -070035 mHandler = new WeakMessageHandler(this);
Jeff Brown2352b972011-04-12 22:39:53 -070036 mLocked.transactionNestingCount = 0;
37 mLocked.deferredSpriteUpdate = false;
Jeff Brown5541de92011-04-11 11:54:25 -070038}
39
40SpriteController::~SpriteController() {
41 mLooper->removeMessages(mHandler);
42
43 if (mSurfaceComposerClient != NULL) {
44 mSurfaceComposerClient->dispose();
45 mSurfaceComposerClient.clear();
46 }
47}
48
49sp<Sprite> SpriteController::createSprite() {
50 return new SpriteImpl(this);
51}
52
Jeff Brown2352b972011-04-12 22:39:53 -070053void SpriteController::openTransaction() {
54 AutoMutex _l(mLock);
55
56 mLocked.transactionNestingCount += 1;
57}
58
59void SpriteController::closeTransaction() {
60 AutoMutex _l(mLock);
61
62 LOG_ALWAYS_FATAL_IF(mLocked.transactionNestingCount == 0,
63 "Sprite closeTransaction() called but there is no open sprite transaction");
64
65 mLocked.transactionNestingCount -= 1;
66 if (mLocked.transactionNestingCount == 0 && mLocked.deferredSpriteUpdate) {
67 mLocked.deferredSpriteUpdate = false;
Jeff Brown5541de92011-04-11 11:54:25 -070068 mLooper->sendMessage(mHandler, Message(MSG_UPDATE_SPRITES));
69 }
70}
71
Jeff Brown2352b972011-04-12 22:39:53 -070072void SpriteController::invalidateSpriteLocked(const sp<SpriteImpl>& sprite) {
Prabir Pradhan3f8b2892021-11-18 08:55:02 -080073 bool wasEmpty = mLocked.invalidatedSprites.empty();
74 mLocked.invalidatedSprites.push_back(sprite);
Jeff Brown2352b972011-04-12 22:39:53 -070075 if (wasEmpty) {
76 if (mLocked.transactionNestingCount != 0) {
77 mLocked.deferredSpriteUpdate = true;
78 } else {
79 mLooper->sendMessage(mHandler, Message(MSG_UPDATE_SPRITES));
80 }
81 }
82}
83
Jeff Brown5541de92011-04-11 11:54:25 -070084void SpriteController::disposeSurfaceLocked(const sp<SurfaceControl>& surfaceControl) {
Prabir Pradhan3f8b2892021-11-18 08:55:02 -080085 bool wasEmpty = mLocked.disposedSurfaces.empty();
86 mLocked.disposedSurfaces.push_back(surfaceControl);
Jeff Brown5541de92011-04-11 11:54:25 -070087 if (wasEmpty) {
88 mLooper->sendMessage(mHandler, Message(MSG_DISPOSE_SURFACES));
89 }
90}
91
92void SpriteController::handleMessage(const Message& message) {
93 switch (message.what) {
94 case MSG_UPDATE_SPRITES:
95 doUpdateSprites();
96 break;
97 case MSG_DISPOSE_SURFACES:
98 doDisposeSurfaces();
99 break;
100 }
101}
102
103void SpriteController::doUpdateSprites() {
104 // Collect information about sprite updates.
105 // Each sprite update record includes a reference to its associated sprite so we can
106 // be certain the sprites will not be deleted while this function runs. Sprites
107 // may invalidate themselves again during this time but we will handle those changes
108 // in the next iteration.
109 Vector<SpriteUpdate> updates;
110 size_t numSprites;
111 { // acquire lock
112 AutoMutex _l(mLock);
113
Jeff Brown2352b972011-04-12 22:39:53 -0700114 numSprites = mLocked.invalidatedSprites.size();
Jeff Brown5541de92011-04-11 11:54:25 -0700115 for (size_t i = 0; i < numSprites; i++) {
Prabir Pradhan3f8b2892021-11-18 08:55:02 -0800116 const sp<SpriteImpl>& sprite = mLocked.invalidatedSprites[i];
Jeff Brown5541de92011-04-11 11:54:25 -0700117
118 updates.push(SpriteUpdate(sprite, sprite->getStateLocked()));
119 sprite->resetDirtyLocked();
120 }
Jeff Brown2352b972011-04-12 22:39:53 -0700121 mLocked.invalidatedSprites.clear();
Jeff Brown5541de92011-04-11 11:54:25 -0700122 } // release lock
123
124 // Create missing surfaces.
125 bool surfaceChanged = false;
126 for (size_t i = 0; i < numSprites; i++) {
127 SpriteUpdate& update = updates.editItemAt(i);
128
129 if (update.state.surfaceControl == NULL && update.state.wantSurfaceVisible()) {
Garfield Tan7e3457e2020-05-28 14:31:29 -0700130 update.state.surfaceWidth = update.state.icon.width();
131 update.state.surfaceHeight = update.state.icon.height();
Jeff Brown5541de92011-04-11 11:54:25 -0700132 update.state.surfaceDrawn = false;
133 update.state.surfaceVisible = false;
134 update.state.surfaceControl = obtainSurface(
135 update.state.surfaceWidth, update.state.surfaceHeight);
136 if (update.state.surfaceControl != NULL) {
137 update.surfaceChanged = surfaceChanged = true;
138 }
139 }
140 }
141
Arthur Hungb9b32002018-12-18 17:39:43 +0800142 // Resize and/or reparent sprites if needed.
Robert Carre13b58e2017-08-31 14:50:44 -0700143 SurfaceComposerClient::Transaction t;
144 bool needApplyTransaction = false;
Jeff Brown5541de92011-04-11 11:54:25 -0700145 for (size_t i = 0; i < numSprites; i++) {
146 SpriteUpdate& update = updates.editItemAt(i);
Arthur Hungb9b32002018-12-18 17:39:43 +0800147 if (update.state.surfaceControl == nullptr) {
148 continue;
149 }
Jeff Brown5541de92011-04-11 11:54:25 -0700150
Arthur Hungb9b32002018-12-18 17:39:43 +0800151 if (update.state.wantSurfaceVisible()) {
Garfield Tan7e3457e2020-05-28 14:31:29 -0700152 int32_t desiredWidth = update.state.icon.width();
153 int32_t desiredHeight = update.state.icon.height();
Jeff Brown5541de92011-04-11 11:54:25 -0700154 if (update.state.surfaceWidth < desiredWidth
155 || update.state.surfaceHeight < desiredHeight) {
Robert Carre13b58e2017-08-31 14:50:44 -0700156 needApplyTransaction = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700157
Prabir Pradhan62726592021-08-09 15:51:25 +0000158 update.state.surfaceControl->updateDefaultBufferSize(desiredWidth, desiredHeight);
Robert Carre13b58e2017-08-31 14:50:44 -0700159 update.state.surfaceWidth = desiredWidth;
160 update.state.surfaceHeight = desiredHeight;
161 update.state.surfaceDrawn = false;
162 update.surfaceChanged = surfaceChanged = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700163
Robert Carre13b58e2017-08-31 14:50:44 -0700164 if (update.state.surfaceVisible) {
165 t.hide(update.state.surfaceControl);
166 update.state.surfaceVisible = false;
Jeff Brown5541de92011-04-11 11:54:25 -0700167 }
168 }
169 }
Arthur Hungb9b32002018-12-18 17:39:43 +0800170
171 // If surface is a new one, we have to set right layer stack.
172 if (update.surfaceChanged || update.state.dirty & DIRTY_DISPLAY_ID) {
Prabir Pradhanfef0c612021-11-04 14:08:50 -0700173 t.reparent(update.state.surfaceControl, mParentSurfaceProvider(update.state.displayId));
Arthur Hungb9b32002018-12-18 17:39:43 +0800174 needApplyTransaction = true;
175 }
Jeff Brown5541de92011-04-11 11:54:25 -0700176 }
Robert Carre13b58e2017-08-31 14:50:44 -0700177 if (needApplyTransaction) {
178 t.apply();
Jeff Brown5541de92011-04-11 11:54:25 -0700179 }
180
181 // Redraw sprites if needed.
182 for (size_t i = 0; i < numSprites; i++) {
183 SpriteUpdate& update = updates.editItemAt(i);
184
185 if ((update.state.dirty & DIRTY_BITMAP) && update.state.surfaceDrawn) {
186 update.state.surfaceDrawn = false;
187 update.surfaceChanged = surfaceChanged = true;
188 }
189
190 if (update.state.surfaceControl != NULL && !update.state.surfaceDrawn
191 && update.state.wantSurfaceVisible()) {
192 sp<Surface> surface = update.state.surfaceControl->getSurface();
Garfield Tan7e3457e2020-05-28 14:31:29 -0700193 if (update.state.icon.draw(surface)) {
194 update.state.surfaceDrawn = true;
195 update.surfaceChanged = surfaceChanged = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700196 }
197 }
198 }
199
Robert Carre13b58e2017-08-31 14:50:44 -0700200 needApplyTransaction = false;
Jeff Brown5541de92011-04-11 11:54:25 -0700201 for (size_t i = 0; i < numSprites; i++) {
202 SpriteUpdate& update = updates.editItemAt(i);
203
204 bool wantSurfaceVisibleAndDrawn = update.state.wantSurfaceVisible()
205 && update.state.surfaceDrawn;
206 bool becomingVisible = wantSurfaceVisibleAndDrawn && !update.state.surfaceVisible;
207 bool becomingHidden = !wantSurfaceVisibleAndDrawn && update.state.surfaceVisible;
208 if (update.state.surfaceControl != NULL && (becomingVisible || becomingHidden
209 || (wantSurfaceVisibleAndDrawn && (update.state.dirty & (DIRTY_ALPHA
210 | DIRTY_POSITION | DIRTY_TRANSFORMATION_MATRIX | DIRTY_LAYER
Garfield Tan67e479a2019-08-05 16:47:40 -0700211 | DIRTY_VISIBILITY | DIRTY_HOTSPOT | DIRTY_DISPLAY_ID
212 | DIRTY_ICON_STYLE))))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700213 needApplyTransaction = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700214
215 if (wantSurfaceVisibleAndDrawn
216 && (becomingVisible || (update.state.dirty & DIRTY_ALPHA))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700217 t.setAlpha(update.state.surfaceControl,
218 update.state.alpha);
Jeff Brown5541de92011-04-11 11:54:25 -0700219 }
220
221 if (wantSurfaceVisibleAndDrawn
222 && (becomingVisible || (update.state.dirty & (DIRTY_POSITION
223 | DIRTY_HOTSPOT)))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700224 t.setPosition(
225 update.state.surfaceControl,
Jeff Brown2352b972011-04-12 22:39:53 -0700226 update.state.positionX - update.state.icon.hotSpotX,
227 update.state.positionY - update.state.icon.hotSpotY);
Jeff Brown5541de92011-04-11 11:54:25 -0700228 }
229
230 if (wantSurfaceVisibleAndDrawn
231 && (becomingVisible
232 || (update.state.dirty & DIRTY_TRANSFORMATION_MATRIX))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700233 t.setMatrix(
234 update.state.surfaceControl,
Jeff Brown5541de92011-04-11 11:54:25 -0700235 update.state.transformationMatrix.dsdx,
236 update.state.transformationMatrix.dtdx,
237 update.state.transformationMatrix.dsdy,
238 update.state.transformationMatrix.dtdy);
Jeff Brown5541de92011-04-11 11:54:25 -0700239 }
240
Garfield Tan67e479a2019-08-05 16:47:40 -0700241 if (wantSurfaceVisibleAndDrawn
242 && (becomingVisible
243 || (update.state.dirty & (DIRTY_HOTSPOT | DIRTY_ICON_STYLE)))) {
244 Parcel p;
245 p.writeInt32(update.state.icon.style);
246 p.writeFloat(update.state.icon.hotSpotX);
247 p.writeFloat(update.state.icon.hotSpotY);
248
249 // Pass cursor metadata in the sprite surface so that when Android is running as a
250 // client OS (e.g. ARC++) the host OS can get the requested cursor metadata and
251 // update mouse cursor in the host OS.
Huihong Luo36b55bc2022-03-08 14:50:45 -0800252 t.setMetadata(update.state.surfaceControl, gui::METADATA_MOUSE_CURSOR, p);
Garfield Tan67e479a2019-08-05 16:47:40 -0700253 }
254
Jeff Brown5541de92011-04-11 11:54:25 -0700255 int32_t surfaceLayer = mOverlayLayer + update.state.layer;
256 if (wantSurfaceVisibleAndDrawn
257 && (becomingVisible || (update.state.dirty & DIRTY_LAYER))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700258 t.setLayer(update.state.surfaceControl, surfaceLayer);
Jeff Brown5541de92011-04-11 11:54:25 -0700259 }
260
261 if (becomingVisible) {
Robert Carre13b58e2017-08-31 14:50:44 -0700262 t.show(update.state.surfaceControl);
263
264 update.state.surfaceVisible = true;
265 update.surfaceChanged = surfaceChanged = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700266 } else if (becomingHidden) {
Robert Carre13b58e2017-08-31 14:50:44 -0700267 t.hide(update.state.surfaceControl);
268
269 update.state.surfaceVisible = false;
270 update.surfaceChanged = surfaceChanged = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700271 }
272 }
273 }
274
Robert Carre13b58e2017-08-31 14:50:44 -0700275 if (needApplyTransaction) {
276 status_t status = t.apply();
277 if (status) {
278 ALOGE("Error applying Surface transaction");
279 }
Jeff Brown5541de92011-04-11 11:54:25 -0700280 }
281
282 // If any surfaces were changed, write back the new surface properties to the sprites.
283 if (surfaceChanged) { // acquire lock
284 AutoMutex _l(mLock);
285
286 for (size_t i = 0; i < numSprites; i++) {
287 const SpriteUpdate& update = updates.itemAt(i);
288
289 if (update.surfaceChanged) {
290 update.sprite->setSurfaceLocked(update.state.surfaceControl,
291 update.state.surfaceWidth, update.state.surfaceHeight,
292 update.state.surfaceDrawn, update.state.surfaceVisible);
293 }
294 }
295 } // release lock
296
297 // Clear the sprite update vector outside the lock. It is very important that
298 // we do not clear sprite references inside the lock since we could be releasing
299 // the last remaining reference to the sprite here which would result in the
300 // sprite being deleted and the lock being reacquired by the sprite destructor
301 // while already held.
302 updates.clear();
303}
304
305void SpriteController::doDisposeSurfaces() {
306 // Collect disposed surfaces.
Prabir Pradhan3f8b2892021-11-18 08:55:02 -0800307 std::vector<sp<SurfaceControl>> disposedSurfaces;
Jeff Brown5541de92011-04-11 11:54:25 -0700308 { // acquire lock
Jeff Brown2352b972011-04-12 22:39:53 -0700309 AutoMutex _l(mLock);
310
311 disposedSurfaces = mLocked.disposedSurfaces;
312 mLocked.disposedSurfaces.clear();
Jeff Brown5541de92011-04-11 11:54:25 -0700313 } // release lock
314
Prabir Pradhan3f8b2892021-11-18 08:55:02 -0800315 // Remove the parent from all surfaces.
316 SurfaceComposerClient::Transaction t;
317 for (const sp<SurfaceControl>& sc : disposedSurfaces) {
318 t.reparent(sc, nullptr);
319 }
320 t.apply();
321
Jeff Brown5541de92011-04-11 11:54:25 -0700322 // Release the last reference to each surface outside of the lock.
323 // We don't want the surfaces to be deleted while we are holding our lock.
324 disposedSurfaces.clear();
325}
326
327void SpriteController::ensureSurfaceComposerClient() {
328 if (mSurfaceComposerClient == NULL) {
329 mSurfaceComposerClient = new SurfaceComposerClient();
330 }
331}
332
333sp<SurfaceControl> SpriteController::obtainSurface(int32_t width, int32_t height) {
334 ensureSurfaceComposerClient();
335
336 sp<SurfaceControl> surfaceControl = mSurfaceComposerClient->createSurface(
Jeff Brown64a55af2012-08-26 02:47:39 -0700337 String8("Sprite"), width, height, PIXEL_FORMAT_RGBA_8888,
Riley Andrews68eccda2014-07-07 11:47:35 -0700338 ISurfaceComposerClient::eHidden |
339 ISurfaceComposerClient::eCursorWindow);
Mathias Agopian52800612013-02-14 17:11:20 -0800340 if (surfaceControl == NULL || !surfaceControl->isValid()) {
Steve Block3762c312012-01-06 19:20:56 +0000341 ALOGE("Error creating sprite surface.");
Jeff Brown5541de92011-04-11 11:54:25 -0700342 return NULL;
343 }
344 return surfaceControl;
345}
346
347
348// --- SpriteController::SpriteImpl ---
349
350SpriteController::SpriteImpl::SpriteImpl(const sp<SpriteController> controller) :
Jeff Brown2352b972011-04-12 22:39:53 -0700351 mController(controller) {
Jeff Brown5541de92011-04-11 11:54:25 -0700352}
353
354SpriteController::SpriteImpl::~SpriteImpl() {
355 AutoMutex _m(mController->mLock);
356
357 // Let the controller take care of deleting the last reference to sprite
358 // surfaces so that we do not block the caller on an IPC here.
Jeff Brown2352b972011-04-12 22:39:53 -0700359 if (mLocked.state.surfaceControl != NULL) {
360 mController->disposeSurfaceLocked(mLocked.state.surfaceControl);
361 mLocked.state.surfaceControl.clear();
Jeff Brown5541de92011-04-11 11:54:25 -0700362 }
363}
364
Jeff Brown2352b972011-04-12 22:39:53 -0700365void SpriteController::SpriteImpl::setIcon(const SpriteIcon& icon) {
Jeff Brown5541de92011-04-11 11:54:25 -0700366 AutoMutex _l(mController->mLock);
367
Jeff Brown2352b972011-04-12 22:39:53 -0700368 uint32_t dirty;
369 if (icon.isValid()) {
Derek Sollenberger9ca5bbe2019-08-14 15:50:59 -0400370 mLocked.state.icon.bitmap = icon.bitmap.copy(ANDROID_BITMAP_FORMAT_RGBA_8888);
Jeff Brown2352b972011-04-12 22:39:53 -0700371 if (!mLocked.state.icon.isValid()
372 || mLocked.state.icon.hotSpotX != icon.hotSpotX
373 || mLocked.state.icon.hotSpotY != icon.hotSpotY) {
374 mLocked.state.icon.hotSpotX = icon.hotSpotX;
375 mLocked.state.icon.hotSpotY = icon.hotSpotY;
376 dirty = DIRTY_BITMAP | DIRTY_HOTSPOT;
377 } else {
378 dirty = DIRTY_BITMAP;
379 }
Garfield Tan67e479a2019-08-05 16:47:40 -0700380
381 if (mLocked.state.icon.style != icon.style) {
382 mLocked.state.icon.style = icon.style;
383 dirty |= DIRTY_ICON_STYLE;
384 }
Jeff Brown2352b972011-04-12 22:39:53 -0700385 } else if (mLocked.state.icon.isValid()) {
386 mLocked.state.icon.bitmap.reset();
Garfield Tan67e479a2019-08-05 16:47:40 -0700387 dirty = DIRTY_BITMAP | DIRTY_HOTSPOT | DIRTY_ICON_STYLE;
Jeff Brown2352b972011-04-12 22:39:53 -0700388 } else {
389 return; // setting to invalid icon and already invalid so nothing to do
Jeff Brown5541de92011-04-11 11:54:25 -0700390 }
391
392 invalidateLocked(dirty);
393}
394
395void SpriteController::SpriteImpl::setVisible(bool visible) {
396 AutoMutex _l(mController->mLock);
397
Jeff Brown2352b972011-04-12 22:39:53 -0700398 if (mLocked.state.visible != visible) {
399 mLocked.state.visible = visible;
Jeff Brown5541de92011-04-11 11:54:25 -0700400 invalidateLocked(DIRTY_VISIBILITY);
401 }
402}
403
404void SpriteController::SpriteImpl::setPosition(float x, float y) {
405 AutoMutex _l(mController->mLock);
406
Jeff Brown2352b972011-04-12 22:39:53 -0700407 if (mLocked.state.positionX != x || mLocked.state.positionY != y) {
408 mLocked.state.positionX = x;
409 mLocked.state.positionY = y;
Jeff Brown5541de92011-04-11 11:54:25 -0700410 invalidateLocked(DIRTY_POSITION);
411 }
412}
413
414void SpriteController::SpriteImpl::setLayer(int32_t layer) {
415 AutoMutex _l(mController->mLock);
416
Jeff Brown2352b972011-04-12 22:39:53 -0700417 if (mLocked.state.layer != layer) {
418 mLocked.state.layer = layer;
Jeff Brown5541de92011-04-11 11:54:25 -0700419 invalidateLocked(DIRTY_LAYER);
420 }
421}
422
423void SpriteController::SpriteImpl::setAlpha(float alpha) {
424 AutoMutex _l(mController->mLock);
425
Jeff Brown2352b972011-04-12 22:39:53 -0700426 if (mLocked.state.alpha != alpha) {
427 mLocked.state.alpha = alpha;
Jeff Brown5541de92011-04-11 11:54:25 -0700428 invalidateLocked(DIRTY_ALPHA);
429 }
430}
431
432void SpriteController::SpriteImpl::setTransformationMatrix(
433 const SpriteTransformationMatrix& matrix) {
434 AutoMutex _l(mController->mLock);
435
Jeff Brown2352b972011-04-12 22:39:53 -0700436 if (mLocked.state.transformationMatrix != matrix) {
437 mLocked.state.transformationMatrix = matrix;
Jeff Brown5541de92011-04-11 11:54:25 -0700438 invalidateLocked(DIRTY_TRANSFORMATION_MATRIX);
439 }
440}
441
Arthur Hungb9b32002018-12-18 17:39:43 +0800442void SpriteController::SpriteImpl::setDisplayId(int32_t displayId) {
443 AutoMutex _l(mController->mLock);
444
445 if (mLocked.state.displayId != displayId) {
446 mLocked.state.displayId = displayId;
447 invalidateLocked(DIRTY_DISPLAY_ID);
448 }
449}
450
Jeff Brown5541de92011-04-11 11:54:25 -0700451void SpriteController::SpriteImpl::invalidateLocked(uint32_t dirty) {
Jeff Brown2352b972011-04-12 22:39:53 -0700452 bool wasDirty = mLocked.state.dirty;
453 mLocked.state.dirty |= dirty;
454
455 if (!wasDirty) {
456 mController->invalidateSpriteLocked(this);
Jeff Brown5541de92011-04-11 11:54:25 -0700457 }
458}
459
460} // namespace android