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

Side by Side Diff: samplecode/SampleXfermodesBlur.cpp

Issue 1974783002: Revert of Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
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 SkTypeface* face = SkTypeface::CreateFromName(name, SkTypeface::kNormal);
32 paint->setTypeface(face);
33 SkSafeUnref(face);
32 } 34 }
33 35
34 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF }; 36 static uint16_t gBG[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
35 37
36 class XfermodesBlurView : public SampleView { 38 class XfermodesBlurView : public SampleView {
37 SkBitmap fBG; 39 SkBitmap fBG;
38 SkBitmap fSrcB, fDstB; 40 SkBitmap fSrcB, fDstB;
39 41
40 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha, 42 void draw_mode(SkCanvas* canvas, sk_sp<SkXfermode> mode, int alpha,
41 SkScalar x, SkScalar y) { 43 SkScalar x, SkScalar y) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return this->INHERITED::onQuery(evt); 85 return this->INHERITED::onQuery(evt);
84 } 86 }
85 87
86 virtual void onDrawContent(SkCanvas* canvas) { 88 virtual void onDrawContent(SkCanvas* canvas) {
87 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); 89 canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
88 90
89 if (false) { 91 if (false) {
90 SkPaint paint; 92 SkPaint paint;
91 paint.setAntiAlias(true); 93 paint.setAntiAlias(true);
92 paint.setTextSize(50); 94 paint.setTextSize(50);
93 paint.setTypeface(SkTypeface::MakeFromName("Arial Unicode MS", SkTyp eface::kNormal)); 95 paint.setTypeface(SkTypeface::CreateFromName("Arial Unicode MS", SkT ypeface::kNormal));
96 SkSafeUnref(paint.getTypeface());
94 char buffer[10]; 97 char buffer[10];
95 size_t len = SkUTF8_FromUnichar(0x8500, buffer); 98 size_t len = SkUTF8_FromUnichar(0x8500, buffer);
96 canvas->drawText(buffer, len, 40, 40, paint); 99 canvas->drawText(buffer, len, 40, 40, paint);
97 return; 100 return;
98 } 101 }
99 if (false) { 102 if (false) {
100 SkPaint paint; 103 SkPaint paint;
101 paint.setAntiAlias(true); 104 paint.setAntiAlias(true);
102 105
103 SkRect r0 = { 0, 0, 10.5f, 20 }; 106 SkRect r0 = { 0, 0, 10.5f, 20 };
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 193 }
191 194
192 private: 195 private:
193 typedef SampleView INHERITED; 196 typedef SampleView INHERITED;
194 }; 197 };
195 198
196 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
197 200
198 static SkView* MyFactory() { return new XfermodesBlurView; } 201 static SkView* MyFactory() { return new XfermodesBlurView; }
199 static SkViewRegister reg(MyFactory); 202 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698