Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: samplecode/SampleXfermodesBlur.cpp

Issue 1818043002: SkTypeface::MakeFromName to take SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Android fix + nit fix Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samplecode/SampleSlides.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 paint->setTypeface(SkTypeface::MakeFromName(name, SkTypeface::kNormal)); 31 paint->setTypeface(SkTypeface::MakeFromName(name, SkFontStyle()));
32 } 32 }
33 33
34 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; 34 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
35 35
36 class XfermodesBlurView : public SampleView { 36 class XfermodesBlurView : public SampleView {
37 SkBitmap fBG; 37 SkBitmap fBG;
38 SkBitmap fSrcB, fDstB; 38 SkBitmap fSrcB, fDstB;
39 39
40 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha, 40 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha,
41 SkScalar x, SkScalar y) { 41 SkScalar x, SkScalar y) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return this->INHERITED::onQuery(evt); 83 return this->INHERITED::onQuery(evt);
84 } 84 }
85 85
86 virtual void onDrawContent(SkCanvas* canvas) { 86 virtual void onDrawContent(SkCanvas* canvas) {
87 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); 87 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
88 88
89 if (false) { 89 if (false) {
90 SkPaint paint; 90 SkPaint paint;
91 paint.setAntiAlias(true); 91 paint.setAntiAlias(true);
92 paint.setTextSize(50); 92 paint.setTextSize(50);
93 paint.setTypeface(SkTypeface::MakeFromName("Arial Unicode MS", SkTyp eface::kNormal)); 93 paint.setTypeface(SkTypeface::MakeFromName("Arial Unicode MS", SkFon tStyle()));
94 char buffer[10]; 94 char buffer[10];
95 size_t len = SkUTF8_FromUnichar(0x8500, buffer); 95 size_t len = SkUTF8_FromUnichar(0x8500, buffer);
96 canvas->drawText(buffer, len, 40, 40, paint); 96 canvas->drawText(buffer, len, 40, 40, paint);
97 return; 97 return;
98 } 98 }
99 if (false) { 99 if (false) {
100 SkPaint paint; 100 SkPaint paint;
101 paint.setAntiAlias(true); 101 paint.setAntiAlias(true);
102 102
103 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
190 } 190 }
191 191
192 private: 192 private:
193 typedef SampleView INHERITED; 193 typedef SampleView INHERITED;
194 }; 194 };
195 195
196 ////////////////////////////////////////////////////////////////////////////// 196 //////////////////////////////////////////////////////////////////////////////
197 197
198 static SkView* MyFactory() { return new XfermodesBlurView; } 198 static SkView* MyFactory() { return new XfermodesBlurView; }
199 static SkViewRegister reg(MyFactory); 199 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleSlides.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698