OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
9 #include "SkTSearch.h" | 9 #include "SkTSearch.h" |
10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 | 420 |
421 // For this optimization we only fold the saveLayer and drawBitmapRect | 421 // For this optimization we only fold the saveLayer and drawBitmapRect |
422 // together if the saveLayer's draw is simple (i.e., no fancy effects) and | 422 // together if the saveLayer's draw is simple (i.e., no fancy effects) and |
423 // and the only difference in the colors is that the saveLayer's can have | 423 // and the only difference in the colors is that the saveLayer's can have |
424 // an alpha while the drawBitmapRect's is opaque. | 424 // an alpha while the drawBitmapRect's is opaque. |
425 // TODO: it should be possible to fold them together even if they both | 425 // TODO: it should be possible to fold them together even if they both |
426 // have different non-255 alphas | 426 // have different non-255 alphas |
427 SkColor layerColor = saveLayerPaint->getColor() | 0xFF000000; // force opaqu
e | 427 SkColor layerColor = saveLayerPaint->getColor() | 0xFF000000; // force opaqu
e |
428 | 428 |
429 SkAutoTDelete<SkPaint> dbmPaint(paintDict->unflatten(dbmPaintId)); | 429 SkAutoTDelete<SkPaint> dbmPaint(paintDict->unflatten(dbmPaintId)); |
430 if (NULL == dbmPaint.get() || dbmPaint->getColor() != layerColor) { | 430 if (NULL == dbmPaint.get() || dbmPaint->getColor() != layerColor || !is_simp
le(*dbmPaint)) { |
431 return false; | 431 return false; |
432 } | 432 } |
433 | 433 |
434 SkColor newColor = SkColorSetA(dbmPaint->getColor(), | 434 SkColor newColor = SkColorSetA(dbmPaint->getColor(), |
435 SkColorGetA(saveLayerPaint->getColor())); | 435 SkColorGetA(saveLayerPaint->getColor())); |
436 dbmPaint->setColor(newColor); | 436 dbmPaint->setColor(newColor); |
437 | 437 |
438 const SkFlatData* data = paintDict->findAndReturnFlat(*dbmPaint); | 438 const SkFlatData* data = paintDict->findAndReturnFlat(*dbmPaint); |
439 if (NULL == data) { | 439 if (NULL == data) { |
440 return false; | 440 return false; |
(...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1826 void SkPictureRecord::validateRegions() const { | 1826 void SkPictureRecord::validateRegions() const { |
1827 int count = fRegions.count(); | 1827 int count = fRegions.count(); |
1828 SkASSERT((unsigned) count < 0x1000); | 1828 SkASSERT((unsigned) count < 0x1000); |
1829 for (int index = 0; index < count; index++) { | 1829 for (int index = 0; index < count; index++) { |
1830 const SkFlatData* region = fRegions[index]; | 1830 const SkFlatData* region = fRegions[index]; |
1831 SkASSERT(region); | 1831 SkASSERT(region); |
1832 // region->validate(); | 1832 // region->validate(); |
1833 } | 1833 } |
1834 } | 1834 } |
1835 #endif | 1835 #endif |
OLD | NEW |