OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkDrawSaveLayer.h" | 10 #include "SkDrawSaveLayer.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 { | 34 { |
35 if (!bounds) { | 35 if (!bounds) { |
36 return false; | 36 return false; |
37 } | 37 } |
38 SkPaint* save = maker.fPaint; | 38 SkPaint* save = maker.fPaint; |
39 //paint is an SkDrawPaint | 39 //paint is an SkDrawPaint |
40 if (paint) | 40 if (paint) |
41 { | 41 { |
42 SkPaint realPaint; | 42 SkPaint realPaint; |
43 paint->setupPaint(&realPaint); | 43 paint->setupPaint(&realPaint); |
44 maker.fCanvas->saveLayer(&bounds->fRect, &realPaint, SkCanvas::kHasAlpha
Layer_SaveFlag); | 44 maker.fCanvas->saveLayer(&bounds->fRect, &realPaint); |
45 } | 45 } |
46 else | 46 else |
47 maker.fCanvas->saveLayer(&bounds->fRect, save, SkCanvas::kHasAlphaLayer_
SaveFlag); | 47 maker.fCanvas->saveLayer(&bounds->fRect, save); |
48 SkPaint local = SkPaint(*maker.fPaint); | 48 SkPaint local = SkPaint(*maker.fPaint); |
49 maker.fPaint = &local; | 49 maker.fPaint = &local; |
50 bool result = INHERITED::draw(maker); | 50 bool result = INHERITED::draw(maker); |
51 maker.fPaint = save; | 51 maker.fPaint = save; |
52 maker.fCanvas->restore(); | 52 maker.fCanvas->restore(); |
53 return result; | 53 return result; |
54 } | 54 } |
55 | 55 |
56 #ifdef SK_DUMP_ENABLED | 56 #ifdef SK_DUMP_ENABLED |
57 void SkSaveLayer::dump(SkAnimateMaker* maker) | 57 void SkSaveLayer::dump(SkAnimateMaker* maker) |
58 { | 58 { |
59 dumpBase(maker); | 59 dumpBase(maker); |
60 //would dump enabled be defined but not debug? | 60 //would dump enabled be defined but not debug? |
61 #ifdef SK_DEBUG | 61 #ifdef SK_DEBUG |
62 if (paint) | 62 if (paint) |
63 SkDebugf("paint=\"%s\" ", paint->id); | 63 SkDebugf("paint=\"%s\" ", paint->id); |
64 if (bounds) | 64 if (bounds) |
65 SkDebugf("bounds=\"%s\" ", bounds->id); | 65 SkDebugf("bounds=\"%s\" ", bounds->id); |
66 #endif | 66 #endif |
67 dumpDrawables(maker); | 67 dumpDrawables(maker); |
68 } | 68 } |
69 #endif | 69 #endif |
70 | 70 |
71 void SkSaveLayer::onEndElement(SkAnimateMaker& maker) | 71 void SkSaveLayer::onEndElement(SkAnimateMaker& maker) |
72 { | 72 { |
73 if (!bounds) | 73 if (!bounds) |
74 maker.setErrorCode(SkDisplayXMLParserError::kSaveLayerNeedsBounds); | 74 maker.setErrorCode(SkDisplayXMLParserError::kSaveLayerNeedsBounds); |
75 INHERITED::onEndElement(maker); | 75 INHERITED::onEndElement(maker); |
76 } | 76 } |
OLD | NEW |