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

Side by Side Diff: samplecode/SampleAnimatedText.cpp

Issue 1506203002: Move texture drawing utility method to SkGpuDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 5 years 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 | « include/gpu/GrContext.h ('k') | src/gpu/GrTest.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 2015 Google Inc. 2 * Copyright 2015 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 "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 modeString.append("x"); 99 modeString.append("x");
100 100
101 fTimer.start(); 101 fTimer.start();
102 102
103 canvas->save(); 103 canvas->save();
104 104
105 #if SK_SUPPORT_GPU 105 #if SK_SUPPORT_GPU
106 SkBaseDevice* device = canvas->getDevice_just_for_deprecated_compatibili ty_testing(); 106 SkBaseDevice* device = canvas->getDevice_just_for_deprecated_compatibili ty_testing();
107 GrContext* grContext = canvas->getGrContext(); 107 GrContext* grContext = canvas->getGrContext();
108 if (grContext) { 108 if (grContext) {
109 grContext->drawFontCache(SkRect::MakeXYWH(512, 10, 512, 512), kA8_Gr MaskFormat, paint, 109 GrTexture* tex = grContext->getFontAtlasTexture(GrMaskFormat::kA8_Gr MaskFormat);
110 reinterpret_cast<SkGpuDevice*>(device)->acc essRenderTarget()); 110 reinterpret_cast<SkGpuDevice*>(device)->drawTexture(tex,
111 SkRect::MakeXYWH(512, 10, 512, 512), paint);
111 } 112 }
112 #endif 113 #endif
113 canvas->translate(180, 180); 114 canvas->translate(180, 180);
114 canvas->rotate(fRotation); 115 canvas->rotate(fRotation);
115 canvas->scale(fScale, fScale); 116 canvas->scale(fScale, fScale);
116 canvas->translate(-180, -180); 117 canvas->translate(-180, -180);
117 118
118 const char* text = "Hamburgefons"; 119 const char* text = "Hamburgefons";
119 size_t length = strlen(text); 120 size_t length = strlen(text);
120 121
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 int fCurrentTime; 156 int fCurrentTime;
156 157
157 158
158 typedef SampleView INHERITED; 159 typedef SampleView INHERITED;
159 }; 160 };
160 161
161 ////////////////////////////////////////////////////////////////////////////// 162 //////////////////////////////////////////////////////////////////////////////
162 163
163 static SkView* MyFactory() { return new AnimatedTextView; } 164 static SkView* MyFactory() { return new AnimatedTextView; }
164 static SkViewRegister reg(MyFactory); 165 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698