blob: 173cd507d9430504bdc1e199aba0221a58659a3a [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
Mark Salyzyn52eb4e02016-09-28 16:15:30 -070026// ToDo: Fix code to be warning free
Andreas Gampe6b83b762014-11-10 15:55:11 -080027#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Wunused-parameter"
Jeff Brown5541de92011-04-11 11:54:25 -070029#include <SkBitmap.h>
30#include <SkCanvas.h>
31#include <SkColor.h>
32#include <SkPaint.h>
Andreas Gampe6b83b762014-11-10 15:55:11 -080033#pragma GCC diagnostic pop
34
Mathias Agopian52800612013-02-14 17:11:20 -080035#include <android/native_window.h>
Jeff Brown5541de92011-04-11 11:54:25 -070036
37namespace android {
38
39// --- SpriteController ---
40
41SpriteController::SpriteController(const sp<Looper>& looper, int32_t overlayLayer) :
42 mLooper(looper), mOverlayLayer(overlayLayer) {
43 mHandler = new WeakMessageHandler(this);
Jeff Brown2352b972011-04-12 22:39:53 -070044
45 mLocked.transactionNestingCount = 0;
46 mLocked.deferredSpriteUpdate = false;
Jeff Brown5541de92011-04-11 11:54:25 -070047}
48
49SpriteController::~SpriteController() {
50 mLooper->removeMessages(mHandler);
51
52 if (mSurfaceComposerClient != NULL) {
53 mSurfaceComposerClient->dispose();
54 mSurfaceComposerClient.clear();
55 }
56}
57
58sp<Sprite> SpriteController::createSprite() {
59 return new SpriteImpl(this);
60}
61
Jeff Brown2352b972011-04-12 22:39:53 -070062void SpriteController::openTransaction() {
63 AutoMutex _l(mLock);
64
65 mLocked.transactionNestingCount += 1;
66}
67
68void SpriteController::closeTransaction() {
69 AutoMutex _l(mLock);
70
71 LOG_ALWAYS_FATAL_IF(mLocked.transactionNestingCount == 0,
72 "Sprite closeTransaction() called but there is no open sprite transaction");
73
74 mLocked.transactionNestingCount -= 1;
75 if (mLocked.transactionNestingCount == 0 && mLocked.deferredSpriteUpdate) {
76 mLocked.deferredSpriteUpdate = false;
Jeff Brown5541de92011-04-11 11:54:25 -070077 mLooper->sendMessage(mHandler, Message(MSG_UPDATE_SPRITES));
78 }
79}
80
Jeff Brown2352b972011-04-12 22:39:53 -070081void SpriteController::invalidateSpriteLocked(const sp<SpriteImpl>& sprite) {
82 bool wasEmpty = mLocked.invalidatedSprites.isEmpty();
83 mLocked.invalidatedSprites.push(sprite);
84 if (wasEmpty) {
85 if (mLocked.transactionNestingCount != 0) {
86 mLocked.deferredSpriteUpdate = true;
87 } else {
88 mLooper->sendMessage(mHandler, Message(MSG_UPDATE_SPRITES));
89 }
90 }
91}
92
Jeff Brown5541de92011-04-11 11:54:25 -070093void SpriteController::disposeSurfaceLocked(const sp<SurfaceControl>& surfaceControl) {
Jeff Brown2352b972011-04-12 22:39:53 -070094 bool wasEmpty = mLocked.disposedSurfaces.isEmpty();
95 mLocked.disposedSurfaces.push(surfaceControl);
Jeff Brown5541de92011-04-11 11:54:25 -070096 if (wasEmpty) {
97 mLooper->sendMessage(mHandler, Message(MSG_DISPOSE_SURFACES));
98 }
99}
100
101void SpriteController::handleMessage(const Message& message) {
102 switch (message.what) {
103 case MSG_UPDATE_SPRITES:
104 doUpdateSprites();
105 break;
106 case MSG_DISPOSE_SURFACES:
107 doDisposeSurfaces();
108 break;
109 }
110}
111
112void SpriteController::doUpdateSprites() {
113 // Collect information about sprite updates.
114 // Each sprite update record includes a reference to its associated sprite so we can
115 // be certain the sprites will not be deleted while this function runs. Sprites
116 // may invalidate themselves again during this time but we will handle those changes
117 // in the next iteration.
118 Vector<SpriteUpdate> updates;
119 size_t numSprites;
120 { // acquire lock
121 AutoMutex _l(mLock);
122
Jeff Brown2352b972011-04-12 22:39:53 -0700123 numSprites = mLocked.invalidatedSprites.size();
Jeff Brown5541de92011-04-11 11:54:25 -0700124 for (size_t i = 0; i < numSprites; i++) {
Jeff Brown2352b972011-04-12 22:39:53 -0700125 const sp<SpriteImpl>& sprite = mLocked.invalidatedSprites.itemAt(i);
Jeff Brown5541de92011-04-11 11:54:25 -0700126
127 updates.push(SpriteUpdate(sprite, sprite->getStateLocked()));
128 sprite->resetDirtyLocked();
129 }
Jeff Brown2352b972011-04-12 22:39:53 -0700130 mLocked.invalidatedSprites.clear();
Jeff Brown5541de92011-04-11 11:54:25 -0700131 } // release lock
132
133 // Create missing surfaces.
134 bool surfaceChanged = false;
135 for (size_t i = 0; i < numSprites; i++) {
136 SpriteUpdate& update = updates.editItemAt(i);
137
138 if (update.state.surfaceControl == NULL && update.state.wantSurfaceVisible()) {
Jeff Brown2352b972011-04-12 22:39:53 -0700139 update.state.surfaceWidth = update.state.icon.bitmap.width();
140 update.state.surfaceHeight = update.state.icon.bitmap.height();
Jeff Brown5541de92011-04-11 11:54:25 -0700141 update.state.surfaceDrawn = false;
142 update.state.surfaceVisible = false;
143 update.state.surfaceControl = obtainSurface(
144 update.state.surfaceWidth, update.state.surfaceHeight);
145 if (update.state.surfaceControl != NULL) {
146 update.surfaceChanged = surfaceChanged = true;
147 }
148 }
149 }
150
Robert Carre13b58e2017-08-31 14:50:44 -0700151 // Resize sprites if needed.
152 SurfaceComposerClient::Transaction t;
153 bool needApplyTransaction = false;
Jeff Brown5541de92011-04-11 11:54:25 -0700154 for (size_t i = 0; i < numSprites; i++) {
155 SpriteUpdate& update = updates.editItemAt(i);
156
157 if (update.state.surfaceControl != NULL && update.state.wantSurfaceVisible()) {
Jeff Brown2352b972011-04-12 22:39:53 -0700158 int32_t desiredWidth = update.state.icon.bitmap.width();
159 int32_t desiredHeight = update.state.icon.bitmap.height();
Jeff Brown5541de92011-04-11 11:54:25 -0700160 if (update.state.surfaceWidth < desiredWidth
161 || update.state.surfaceHeight < desiredHeight) {
Robert Carre13b58e2017-08-31 14:50:44 -0700162 needApplyTransaction = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700163
Robert Carre13b58e2017-08-31 14:50:44 -0700164 t.setSize(update.state.surfaceControl,
165 desiredWidth, desiredHeight);
166 update.state.surfaceWidth = desiredWidth;
167 update.state.surfaceHeight = desiredHeight;
168 update.state.surfaceDrawn = false;
169 update.surfaceChanged = surfaceChanged = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700170
Robert Carre13b58e2017-08-31 14:50:44 -0700171 if (update.state.surfaceVisible) {
172 t.hide(update.state.surfaceControl);
173 update.state.surfaceVisible = false;
Jeff Brown5541de92011-04-11 11:54:25 -0700174 }
175 }
176 }
177 }
Robert Carre13b58e2017-08-31 14:50:44 -0700178 if (needApplyTransaction) {
179 t.apply();
Jeff Brown5541de92011-04-11 11:54:25 -0700180 }
181
182 // Redraw sprites if needed.
183 for (size_t i = 0; i < numSprites; i++) {
184 SpriteUpdate& update = updates.editItemAt(i);
185
186 if ((update.state.dirty & DIRTY_BITMAP) && update.state.surfaceDrawn) {
187 update.state.surfaceDrawn = false;
188 update.surfaceChanged = surfaceChanged = true;
189 }
190
191 if (update.state.surfaceControl != NULL && !update.state.surfaceDrawn
192 && update.state.wantSurfaceVisible()) {
193 sp<Surface> surface = update.state.surfaceControl->getSurface();
Mathias Agopian52800612013-02-14 17:11:20 -0800194 ANativeWindow_Buffer outBuffer;
195 status_t status = surface->lock(&outBuffer, NULL);
Jeff Brown5541de92011-04-11 11:54:25 -0700196 if (status) {
Steve Block3762c312012-01-06 19:20:56 +0000197 ALOGE("Error %d locking sprite surface before drawing.", status);
Jeff Brown5541de92011-04-11 11:54:25 -0700198 } else {
199 SkBitmap surfaceBitmap;
Mathias Agopian52800612013-02-14 17:11:20 -0800200 ssize_t bpr = outBuffer.stride * bytesPerPixel(outBuffer.format);
Mike Reedb9330552014-06-16 17:31:48 -0400201 surfaceBitmap.installPixels(SkImageInfo::MakeN32Premul(outBuffer.width, outBuffer.height),
202 outBuffer.bits, bpr);
Jeff Brown5541de92011-04-11 11:54:25 -0700203
Derek Sollenbergerfc615a02012-12-20 14:39:57 -0500204 SkCanvas surfaceCanvas(surfaceBitmap);
Jeff Brown5541de92011-04-11 11:54:25 -0700205
206 SkPaint paint;
Mike Reed260ab722016-10-07 15:59:20 -0400207 paint.setBlendMode(SkBlendMode::kSrc);
Jeff Brown2352b972011-04-12 22:39:53 -0700208 surfaceCanvas.drawBitmap(update.state.icon.bitmap, 0, 0, &paint);
Jeff Brown5541de92011-04-11 11:54:25 -0700209
Michael Wright4d8779f2013-10-16 14:01:50 -0700210 if (outBuffer.width > update.state.icon.bitmap.width()) {
Jeff Brown5541de92011-04-11 11:54:25 -0700211 paint.setColor(0); // transparent fill color
Mike Reed6c9bb242017-04-04 09:15:37 -0400212 surfaceCanvas.drawRect(SkRect::MakeLTRB(update.state.icon.bitmap.width(), 0,
213 outBuffer.width, update.state.icon.bitmap.height()), paint);
Jeff Brown5541de92011-04-11 11:54:25 -0700214 }
Michael Wright4d8779f2013-10-16 14:01:50 -0700215 if (outBuffer.height > update.state.icon.bitmap.height()) {
Jeff Brown5541de92011-04-11 11:54:25 -0700216 paint.setColor(0); // transparent fill color
Mike Reed6c9bb242017-04-04 09:15:37 -0400217 surfaceCanvas.drawRect(SkRect::MakeLTRB(0, update.state.icon.bitmap.height(),
218 outBuffer.width, outBuffer.height), paint);
Jeff Brown5541de92011-04-11 11:54:25 -0700219 }
220
221 status = surface->unlockAndPost();
222 if (status) {
Steve Block3762c312012-01-06 19:20:56 +0000223 ALOGE("Error %d unlocking and posting sprite surface after drawing.", status);
Jeff Brown5541de92011-04-11 11:54:25 -0700224 } else {
225 update.state.surfaceDrawn = true;
226 update.surfaceChanged = surfaceChanged = true;
227 }
228 }
229 }
230 }
231
Robert Carre13b58e2017-08-31 14:50:44 -0700232 needApplyTransaction = false;
Jeff Brown5541de92011-04-11 11:54:25 -0700233 for (size_t i = 0; i < numSprites; i++) {
234 SpriteUpdate& update = updates.editItemAt(i);
235
236 bool wantSurfaceVisibleAndDrawn = update.state.wantSurfaceVisible()
237 && update.state.surfaceDrawn;
238 bool becomingVisible = wantSurfaceVisibleAndDrawn && !update.state.surfaceVisible;
239 bool becomingHidden = !wantSurfaceVisibleAndDrawn && update.state.surfaceVisible;
240 if (update.state.surfaceControl != NULL && (becomingVisible || becomingHidden
241 || (wantSurfaceVisibleAndDrawn && (update.state.dirty & (DIRTY_ALPHA
242 | DIRTY_POSITION | DIRTY_TRANSFORMATION_MATRIX | DIRTY_LAYER
243 | DIRTY_VISIBILITY | DIRTY_HOTSPOT))))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700244 needApplyTransaction = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700245
246 if (wantSurfaceVisibleAndDrawn
247 && (becomingVisible || (update.state.dirty & DIRTY_ALPHA))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700248 t.setAlpha(update.state.surfaceControl,
249 update.state.alpha);
Jeff Brown5541de92011-04-11 11:54:25 -0700250 }
251
252 if (wantSurfaceVisibleAndDrawn
253 && (becomingVisible || (update.state.dirty & (DIRTY_POSITION
254 | DIRTY_HOTSPOT)))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700255 t.setPosition(
256 update.state.surfaceControl,
Jeff Brown2352b972011-04-12 22:39:53 -0700257 update.state.positionX - update.state.icon.hotSpotX,
258 update.state.positionY - update.state.icon.hotSpotY);
Jeff Brown5541de92011-04-11 11:54:25 -0700259 }
260
261 if (wantSurfaceVisibleAndDrawn
262 && (becomingVisible
263 || (update.state.dirty & DIRTY_TRANSFORMATION_MATRIX))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700264 t.setMatrix(
265 update.state.surfaceControl,
Jeff Brown5541de92011-04-11 11:54:25 -0700266 update.state.transformationMatrix.dsdx,
267 update.state.transformationMatrix.dtdx,
268 update.state.transformationMatrix.dsdy,
269 update.state.transformationMatrix.dtdy);
Jeff Brown5541de92011-04-11 11:54:25 -0700270 }
271
272 int32_t surfaceLayer = mOverlayLayer + update.state.layer;
273 if (wantSurfaceVisibleAndDrawn
274 && (becomingVisible || (update.state.dirty & DIRTY_LAYER))) {
Robert Carre13b58e2017-08-31 14:50:44 -0700275 t.setLayer(update.state.surfaceControl, surfaceLayer);
Jeff Brown5541de92011-04-11 11:54:25 -0700276 }
277
278 if (becomingVisible) {
Robert Carre13b58e2017-08-31 14:50:44 -0700279 t.show(update.state.surfaceControl);
280
281 update.state.surfaceVisible = true;
282 update.surfaceChanged = surfaceChanged = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700283 } else if (becomingHidden) {
Robert Carre13b58e2017-08-31 14:50:44 -0700284 t.hide(update.state.surfaceControl);
285
286 update.state.surfaceVisible = false;
287 update.surfaceChanged = surfaceChanged = true;
Jeff Brown5541de92011-04-11 11:54:25 -0700288 }
289 }
290 }
291
Robert Carre13b58e2017-08-31 14:50:44 -0700292 if (needApplyTransaction) {
293 status_t status = t.apply();
294 if (status) {
295 ALOGE("Error applying Surface transaction");
296 }
Jeff Brown5541de92011-04-11 11:54:25 -0700297 }
298
299 // If any surfaces were changed, write back the new surface properties to the sprites.
300 if (surfaceChanged) { // acquire lock
301 AutoMutex _l(mLock);
302
303 for (size_t i = 0; i < numSprites; i++) {
304 const SpriteUpdate& update = updates.itemAt(i);
305
306 if (update.surfaceChanged) {
307 update.sprite->setSurfaceLocked(update.state.surfaceControl,
308 update.state.surfaceWidth, update.state.surfaceHeight,
309 update.state.surfaceDrawn, update.state.surfaceVisible);
310 }
311 }
312 } // release lock
313
314 // Clear the sprite update vector outside the lock. It is very important that
315 // we do not clear sprite references inside the lock since we could be releasing
316 // the last remaining reference to the sprite here which would result in the
317 // sprite being deleted and the lock being reacquired by the sprite destructor
318 // while already held.
319 updates.clear();
320}
321
322void SpriteController::doDisposeSurfaces() {
323 // Collect disposed surfaces.
324 Vector<sp<SurfaceControl> > disposedSurfaces;
325 { // acquire lock
Jeff Brown2352b972011-04-12 22:39:53 -0700326 AutoMutex _l(mLock);
327
328 disposedSurfaces = mLocked.disposedSurfaces;
329 mLocked.disposedSurfaces.clear();
Jeff Brown5541de92011-04-11 11:54:25 -0700330 } // release lock
331
332 // Release the last reference to each surface outside of the lock.
333 // We don't want the surfaces to be deleted while we are holding our lock.
334 disposedSurfaces.clear();
335}
336
337void SpriteController::ensureSurfaceComposerClient() {
338 if (mSurfaceComposerClient == NULL) {
339 mSurfaceComposerClient = new SurfaceComposerClient();
340 }
341}
342
343sp<SurfaceControl> SpriteController::obtainSurface(int32_t width, int32_t height) {
344 ensureSurfaceComposerClient();
345
346 sp<SurfaceControl> surfaceControl = mSurfaceComposerClient->createSurface(
Jeff Brown64a55af2012-08-26 02:47:39 -0700347 String8("Sprite"), width, height, PIXEL_FORMAT_RGBA_8888,
Riley Andrews68eccda2014-07-07 11:47:35 -0700348 ISurfaceComposerClient::eHidden |
349 ISurfaceComposerClient::eCursorWindow);
Mathias Agopian52800612013-02-14 17:11:20 -0800350 if (surfaceControl == NULL || !surfaceControl->isValid()) {
Steve Block3762c312012-01-06 19:20:56 +0000351 ALOGE("Error creating sprite surface.");
Jeff Brown5541de92011-04-11 11:54:25 -0700352 return NULL;
353 }
354 return surfaceControl;
355}
356
357
358// --- SpriteController::SpriteImpl ---
359
360SpriteController::SpriteImpl::SpriteImpl(const sp<SpriteController> controller) :
Jeff Brown2352b972011-04-12 22:39:53 -0700361 mController(controller) {
Jeff Brown5541de92011-04-11 11:54:25 -0700362}
363
364SpriteController::SpriteImpl::~SpriteImpl() {
365 AutoMutex _m(mController->mLock);
366
367 // Let the controller take care of deleting the last reference to sprite
368 // surfaces so that we do not block the caller on an IPC here.
Jeff Brown2352b972011-04-12 22:39:53 -0700369 if (mLocked.state.surfaceControl != NULL) {
370 mController->disposeSurfaceLocked(mLocked.state.surfaceControl);
371 mLocked.state.surfaceControl.clear();
Jeff Brown5541de92011-04-11 11:54:25 -0700372 }
373}
374
Jeff Brown2352b972011-04-12 22:39:53 -0700375void SpriteController::SpriteImpl::setIcon(const SpriteIcon& icon) {
Jeff Brown5541de92011-04-11 11:54:25 -0700376 AutoMutex _l(mController->mLock);
377
Jeff Brown2352b972011-04-12 22:39:53 -0700378 uint32_t dirty;
379 if (icon.isValid()) {
Matt Sarett155d5212017-04-25 17:32:34 -0400380 SkBitmap* bitmapCopy = &mLocked.state.icon.bitmap;
381 if (bitmapCopy->tryAllocPixels(icon.bitmap.info().makeColorType(kN32_SkColorType))) {
382 icon.bitmap.readPixels(bitmapCopy->info(), bitmapCopy->getPixels(),
383 bitmapCopy->rowBytes(), 0, 0);
384 }
Jeff Brown5541de92011-04-11 11:54:25 -0700385
Jeff Brown2352b972011-04-12 22:39:53 -0700386 if (!mLocked.state.icon.isValid()
387 || mLocked.state.icon.hotSpotX != icon.hotSpotX
388 || mLocked.state.icon.hotSpotY != icon.hotSpotY) {
389 mLocked.state.icon.hotSpotX = icon.hotSpotX;
390 mLocked.state.icon.hotSpotY = icon.hotSpotY;
391 dirty = DIRTY_BITMAP | DIRTY_HOTSPOT;
392 } else {
393 dirty = DIRTY_BITMAP;
394 }
395 } else if (mLocked.state.icon.isValid()) {
396 mLocked.state.icon.bitmap.reset();
397 dirty = DIRTY_BITMAP | DIRTY_HOTSPOT;
398 } else {
399 return; // setting to invalid icon and already invalid so nothing to do
Jeff Brown5541de92011-04-11 11:54:25 -0700400 }
401
402 invalidateLocked(dirty);
403}
404
405void SpriteController::SpriteImpl::setVisible(bool visible) {
406 AutoMutex _l(mController->mLock);
407
Jeff Brown2352b972011-04-12 22:39:53 -0700408 if (mLocked.state.visible != visible) {
409 mLocked.state.visible = visible;
Jeff Brown5541de92011-04-11 11:54:25 -0700410 invalidateLocked(DIRTY_VISIBILITY);
411 }
412}
413
414void SpriteController::SpriteImpl::setPosition(float x, float y) {
415 AutoMutex _l(mController->mLock);
416
Jeff Brown2352b972011-04-12 22:39:53 -0700417 if (mLocked.state.positionX != x || mLocked.state.positionY != y) {
418 mLocked.state.positionX = x;
419 mLocked.state.positionY = y;
Jeff Brown5541de92011-04-11 11:54:25 -0700420 invalidateLocked(DIRTY_POSITION);
421 }
422}
423
424void SpriteController::SpriteImpl::setLayer(int32_t layer) {
425 AutoMutex _l(mController->mLock);
426
Jeff Brown2352b972011-04-12 22:39:53 -0700427 if (mLocked.state.layer != layer) {
428 mLocked.state.layer = layer;
Jeff Brown5541de92011-04-11 11:54:25 -0700429 invalidateLocked(DIRTY_LAYER);
430 }
431}
432
433void SpriteController::SpriteImpl::setAlpha(float alpha) {
434 AutoMutex _l(mController->mLock);
435
Jeff Brown2352b972011-04-12 22:39:53 -0700436 if (mLocked.state.alpha != alpha) {
437 mLocked.state.alpha = alpha;
Jeff Brown5541de92011-04-11 11:54:25 -0700438 invalidateLocked(DIRTY_ALPHA);
439 }
440}
441
442void SpriteController::SpriteImpl::setTransformationMatrix(
443 const SpriteTransformationMatrix& matrix) {
444 AutoMutex _l(mController->mLock);
445
Jeff Brown2352b972011-04-12 22:39:53 -0700446 if (mLocked.state.transformationMatrix != matrix) {
447 mLocked.state.transformationMatrix = matrix;
Jeff Brown5541de92011-04-11 11:54:25 -0700448 invalidateLocked(DIRTY_TRANSFORMATION_MATRIX);
449 }
450}
451
Jeff Brown5541de92011-04-11 11:54:25 -0700452void SpriteController::SpriteImpl::invalidateLocked(uint32_t dirty) {
Jeff Brown2352b972011-04-12 22:39:53 -0700453 bool wasDirty = mLocked.state.dirty;
454 mLocked.state.dirty |= dirty;
455
456 if (!wasDirty) {
457 mController->invalidateSpriteLocked(this);
Jeff Brown5541de92011-04-11 11:54:25 -0700458 }
459}
460
461} // namespace android