| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 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 "SkBitmapHeap.h" | 10 #include "SkBitmapHeap.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "SkImageFilter.h" | 21 #include "SkImageFilter.h" |
| 22 #include "SkMaskFilter.h" | 22 #include "SkMaskFilter.h" |
| 23 #include "SkOrderedReadBuffer.h" | 23 #include "SkOrderedReadBuffer.h" |
| 24 #include "SkPathEffect.h" | 24 #include "SkPathEffect.h" |
| 25 #include "SkRasterizer.h" | 25 #include "SkRasterizer.h" |
| 26 #include "SkRRect.h" | 26 #include "SkRRect.h" |
| 27 #include "SkShader.h" | 27 #include "SkShader.h" |
| 28 #include "SkTypeface.h" | 28 #include "SkTypeface.h" |
| 29 #include "SkXfermode.h" | 29 #include "SkXfermode.h" |
| 30 | 30 |
| 31 static SkEffectType paintflat_to_effecttype(PaintFlats pf) { | 31 static SkFlattenable::Type paintflat_to_flattype(PaintFlats pf) { |
| 32 static const uint8_t gEffectTypesInPaintFlatsOrder[] = { | 32 static const uint8_t gEffectTypesInPaintFlatsOrder[] = { |
| 33 kColorFilter_SkEffectType, | 33 SkFlattenable::kSkColorFilter_Type, |
| 34 kDrawLooper_SkEffectType, | 34 SkFlattenable::kSkDrawLooper_Type, |
| 35 kImageFilter_SkEffectType, | 35 SkFlattenable::kSkImageFilter_Type, |
| 36 kMaskFilter_SkEffectType, | 36 SkFlattenable::kSkMaskFilter_Type, |
| 37 kPathEffect_SkEffectType, | 37 SkFlattenable::kSkPathEffect_Type, |
| 38 kRasterizer_SkEffectType, | 38 SkFlattenable::kSkRasterizer_Type, |
| 39 kShader_SkEffectType, | 39 SkFlattenable::kSkShader_Type, |
| 40 kXfermode_SkEffectType, | 40 SkFlattenable::kSkXfermode_Type, |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 SkASSERT((size_t)pf < SK_ARRAY_COUNT(gEffectTypesInPaintFlatsOrder)); | 43 SkASSERT((size_t)pf < SK_ARRAY_COUNT(gEffectTypesInPaintFlatsOrder)); |
| 44 return (SkEffectType)gEffectTypesInPaintFlatsOrder[pf]; | 44 return (SkFlattenable::Type)gEffectTypesInPaintFlatsOrder[pf]; |
| 45 } | 45 } |
| 46 | 46 |
| 47 static void set_paintflat(SkPaint* paint, SkFlattenable* obj, unsigned paintFlat
) { | 47 static void set_paintflat(SkPaint* paint, SkFlattenable* obj, unsigned paintFlat
) { |
| 48 SkASSERT(paintFlat < kCount_PaintFlats); | 48 SkASSERT(paintFlat < kCount_PaintFlats); |
| 49 switch (paintFlat) { | 49 switch (paintFlat) { |
| 50 case kColorFilter_PaintFlat: | 50 case kColorFilter_PaintFlat: |
| 51 paint->setColorFilter((SkColorFilter*)obj); | 51 paint->setColorFilter((SkColorFilter*)obj); |
| 52 break; | 52 break; |
| 53 case kDrawLooper_PaintFlat: | 53 case kDrawLooper_PaintFlat: |
| 54 paint->setLooper((SkDrawLooper*)obj); | 54 paint->setLooper((SkDrawLooper*)obj); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 SkFlattenable* getFlat(unsigned index) const { | 116 SkFlattenable* getFlat(unsigned index) const { |
| 117 if (0 == index) { | 117 if (0 == index) { |
| 118 return NULL; | 118 return NULL; |
| 119 } | 119 } |
| 120 return fFlatArray[index - 1]; | 120 return fFlatArray[index - 1]; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void defFlattenable(PaintFlats pf, int index) { | 123 void defFlattenable(PaintFlats pf, int index) { |
| 124 index--; | 124 index--; |
| 125 SkFlattenable* obj = fReader->readFlattenable(paintflat_to_effecttype(pf
)); | 125 SkFlattenable* obj = fReader->readFlattenable(paintflat_to_flattype(pf))
; |
| 126 if (fFlatArray.count() == index) { | 126 if (fFlatArray.count() == index) { |
| 127 *fFlatArray.append() = obj; | 127 *fFlatArray.append() = obj; |
| 128 } else { | 128 } else { |
| 129 SkSafeUnref(fFlatArray[index]); | 129 SkSafeUnref(fFlatArray[index]); |
| 130 fFlatArray[index] = obj; | 130 fFlatArray[index] = obj; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void defFactory(const char* name) { | 134 void defFactory(const char* name) { |
| 135 SkFlattenable::Factory factory = SkFlattenable::NameToFactory(name); | 135 SkFlattenable::Factory factory = SkFlattenable::NameToFactory(name); |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 status = kReadAtom_Status; | 886 status = kReadAtom_Status; |
| 887 break; | 887 break; |
| 888 } | 888 } |
| 889 } | 889 } |
| 890 | 890 |
| 891 if (bytesRead) { | 891 if (bytesRead) { |
| 892 *bytesRead = reader.offset(); | 892 *bytesRead = reader.offset(); |
| 893 } | 893 } |
| 894 return status; | 894 return status; |
| 895 } | 895 } |
| OLD | NEW |