OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
11 #include "SkPicturePlayback.h" | 11 #include "SkPicturePlayback.h" |
12 #include "SkPictureRecord.h" | 12 #include "SkPictureRecord.h" |
13 #include "SkReader32.h" | 13 #include "SkReader32.h" |
14 #include "SkRSXform.h" | 14 #include "SkRSXform.h" |
15 #include "SkTextBlob.h" | 15 #include "SkTextBlob.h" |
16 #include "SkTDArray.h" | 16 #include "SkTDArray.h" |
17 #include "SkTypes.h" | 17 #include "SkTypes.h" |
18 | 18 |
19 // matches old SkCanvas::SaveFlags | 19 // matches old SkCanvas::SaveFlags |
20 enum LegacySaveFlags { | 20 enum LegacySaveFlags { |
21 kHasAlphaLayer_LegacySaveFlags = 0x04, | 21 kHasAlphaLayer_LegacySaveFlags = 0x04, |
22 kClipToLayer_LegacySaveFlags = 0x10, | 22 kClipToLayer_LegacySaveFlags = 0x10, |
23 }; | 23 }; |
24 #ifdef SK_SUPPORT_LEGACY_SAVEFLAGS | |
25 static_assert(kHasAlphaLayer_LegacySaveFlags == (int)SkCanvas::kHasAlphaLayer_Sa
veFlag, ""); | |
26 static_assert(kClipToLayer_LegacySaveFlags == (int)SkCanvas::kClipToLayer_SaveFl
ag, ""); | |
27 #endif | |
28 | 24 |
29 SkCanvas::SaveLayerFlags SkCanvas::LegacySaveFlagsToSaveLayerFlags(uint32_t flag
s) { | 25 SkCanvas::SaveLayerFlags SkCanvas::LegacySaveFlagsToSaveLayerFlags(uint32_t flag
s) { |
30 uint32_t layerFlags = 0; | 26 uint32_t layerFlags = 0; |
31 | 27 |
32 if (0 == (flags & kClipToLayer_LegacySaveFlags)) { | 28 if (0 == (flags & kClipToLayer_LegacySaveFlags)) { |
33 layerFlags |= SkCanvas::kDontClipToLayer_PrivateSaveLayerFlag; | 29 layerFlags |= SkCanvas::kDontClipToLayer_PrivateSaveLayerFlag; |
34 } | 30 } |
35 if (0 == (flags & kHasAlphaLayer_LegacySaveFlags)) { | 31 if (0 == (flags & kHasAlphaLayer_LegacySaveFlags)) { |
36 layerFlags |= kIsOpaque_SaveLayerFlag; | 32 layerFlags |= kIsOpaque_SaveLayerFlag; |
37 } | 33 } |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 case TRANSLATE: { | 521 case TRANSLATE: { |
526 SkScalar dx = reader->readScalar(); | 522 SkScalar dx = reader->readScalar(); |
527 SkScalar dy = reader->readScalar(); | 523 SkScalar dy = reader->readScalar(); |
528 canvas->translate(dx, dy); | 524 canvas->translate(dx, dy); |
529 } break; | 525 } break; |
530 default: | 526 default: |
531 SkASSERTF(false, "Unknown draw type: %d", op); | 527 SkASSERTF(false, "Unknown draw type: %d", op); |
532 } | 528 } |
533 } | 529 } |
534 | 530 |
OLD | NEW |