OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
12 #include "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
13 #include "SkPaint.h" | 13 #include "SkPaint.h" |
14 #include "SkPictureFlat.h" | 14 #include "SkPictureFlat.h" |
15 #include "SkShader.h" | 15 #include "SkShader.h" |
16 #include "SkXfermode.h" | 16 #include "SkXfermode.h" |
17 #include "Test.h" | 17 #include "Test.h" |
18 | 18 |
19 struct SkFlattenableTraits { | 19 struct SkFlattenableTraits { |
20 static void flatten(SkWriteBuffer& buffer, const SkFlattenable& flattenable)
{ | 20 static void Flatten(SkWriteBuffer& buffer, const SkFlattenable& flattenable)
{ |
21 buffer.writeFlattenable(&flattenable); | 21 buffer.writeFlattenable(&flattenable); |
22 } | 22 } |
23 }; | 23 }; |
24 struct SkBitmapTraits { | 24 struct SkBitmapTraits { |
25 static void flatten(SkWriteBuffer& buffer, const SkBitmap& bitmap) { | 25 static void Flatten(SkWriteBuffer& buffer, const SkBitmap& bitmap) { |
26 bitmap.flatten(buffer); | 26 bitmap.flatten(buffer); |
27 } | 27 } |
28 }; | 28 }; |
29 | 29 |
30 class Controller : public SkChunkFlatController { | 30 class Controller : public SkChunkFlatController { |
31 public: | 31 public: |
32 Controller() : INHERITED(1024) { | 32 Controller() : INHERITED(1024) { |
33 this->INHERITED::setNamedFactorySet(SkNEW(SkNamedFactorySet))->unref(); | 33 this->INHERITED::setNamedFactorySet(SkNEW(SkNamedFactorySet))->unref(); |
34 } | 34 } |
35 private: | 35 private: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 // Test SkColorFilter | 79 // Test SkColorFilter |
80 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateLightingFilter(SK_ColorB
LUE, SK_ColorRED)); | 80 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateLightingFilter(SK_ColorB
LUE, SK_ColorRED)); |
81 testCreate<SkFlattenableTraits>(reporter, *cf); | 81 testCreate<SkFlattenableTraits>(reporter, *cf); |
82 | 82 |
83 // Test SkXfermode | 83 // Test SkXfermode |
84 SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(SkXfermode::kDstOver_Mode))
; | 84 SkAutoTUnref<SkXfermode> xfer(SkXfermode::Create(SkXfermode::kDstOver_Mode))
; |
85 testCreate<SkFlattenableTraits>(reporter, *xfer); | 85 testCreate<SkFlattenableTraits>(reporter, *xfer); |
86 } | 86 } |
OLD | NEW |