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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "SkColorFilter.h" | 21 #include "SkColorFilter.h" |
22 #include "SkTime.h" | 22 #include "SkTime.h" |
23 #include "SkTypeface.h" | 23 #include "SkTypeface.h" |
24 #include "SkXfermode.h" | 24 #include "SkXfermode.h" |
25 | 25 |
26 #include "SkStream.h" | 26 #include "SkStream.h" |
27 #include "SkColorPriv.h" | 27 #include "SkColorPriv.h" |
28 #include "SkBlurMaskFilter.h" | 28 #include "SkBlurMaskFilter.h" |
29 | 29 |
30 static void setNamedTypeface(SkPaint* paint, const char name[]) { | 30 static void setNamedTypeface(SkPaint* paint, const char name[]) { |
31 SkTypeface* face = SkTypeface::CreateFromName(name, SkTypeface::kNormal); | 31 paint->setTypeface(SkTypeface::MakeFromName(name, SkTypeface::kNormal)); |
32 paint->setTypeface(face); | |
33 SkSafeUnref(face); | |
34 } | 32 } |
35 | 33 |
36 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; | 34 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; |
37 | 35 |
38 class XfermodesBlurView : public SampleView { | 36 class XfermodesBlurView : public SampleView { |
39 SkBitmap fBG; | 37 SkBitmap fBG; |
40 SkBitmap fSrcB, fDstB; | 38 SkBitmap fSrcB, fDstB; |
41 | 39 |
42 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha, | 40 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha, |
43 SkScalar x, SkScalar y) { | 41 SkScalar x, SkScalar y) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return this->INHERITED::onQuery(evt); | 83 return this->INHERITED::onQuery(evt); |
86 } | 84 } |
87 | 85 |
88 virtual void onDrawContent(SkCanvas* canvas) { | 86 virtual void onDrawContent(SkCanvas* canvas) { |
89 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); | 87 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); |
90 | 88 |
91 if (false) { | 89 if (false) { |
92 SkPaint paint; | 90 SkPaint paint; |
93 paint.setAntiAlias(true); | 91 paint.setAntiAlias(true); |
94 paint.setTextSize(50); | 92 paint.setTextSize(50); |
95 paint.setTypeface(SkTypeface::CreateFromName("Arial Unicode MS", SkT
ypeface::kNormal)); | 93 paint.setTypeface(SkTypeface::MakeFromName("Arial Unicode MS", SkTyp
eface::kNormal)); |
96 SkSafeUnref(paint.getTypeface()); | |
97 char buffer[10]; | 94 char buffer[10]; |
98 size_t len = SkUTF8_FromUnichar(0x8500, buffer); | 95 size_t len = SkUTF8_FromUnichar(0x8500, buffer); |
99 canvas->drawText(buffer, len, 40, 40, paint); | 96 canvas->drawText(buffer, len, 40, 40, paint); |
100 return; | 97 return; |
101 } | 98 } |
102 if (false) { | 99 if (false) { |
103 SkPaint paint; | 100 SkPaint paint; |
104 paint.setAntiAlias(true); | 101 paint.setAntiAlias(true); |
105 | 102 |
106 SkRect r0 = { 0, 0, 10.5f, 20 }; | 103 SkRect r0 = { 0, 0, 10.5f, 20 }; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 190 } |
194 | 191 |
195 private: | 192 private: |
196 typedef SampleView INHERITED; | 193 typedef SampleView INHERITED; |
197 }; | 194 }; |
198 | 195 |
199 ////////////////////////////////////////////////////////////////////////////// | 196 ////////////////////////////////////////////////////////////////////////////// |
200 | 197 |
201 static SkView* MyFactory() { return new XfermodesBlurView; } | 198 static SkView* MyFactory() { return new XfermodesBlurView; } |
202 static SkViewRegister reg(MyFactory); | 199 static SkViewRegister reg(MyFactory); |
OLD | NEW |