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

Side by Side Diff: gm/textblobshader.cpp

Issue 1263553002: make pixelsnap textblob* etc gm portable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add more 565 compatibility Created 5 years, 4 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 | « gm/textbloblooper.cpp ('k') | gm/transparency.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 2014 Google Inc. 2 * Copyright 2014 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 "gm.h" 8 #include "gm.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 protected: 28 protected:
29 29
30 void onOnceBeforeDraw() override { 30 void onOnceBeforeDraw() override {
31 SkPaint p; 31 SkPaint p;
32 p.setAntiAlias(true); 32 p.setAntiAlias(true);
33 p.setSubpixelText(true); 33 p.setSubpixelText(true);
34 p.setTextSize(30); 34 p.setTextSize(30);
35 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 35 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
36 sk_tool_utils::set_portable_typeface(&p);
36 37
37 SkTextBlobBuilder builder; 38 SkTextBlobBuilder builder;
38 int glyphCount = fGlyphs.count(); 39 int glyphCount = fGlyphs.count();
39 const SkTextBlobBuilder::RunBuffer* run; 40 const SkTextBlobBuilder::RunBuffer* run;
40 41
41 run = &builder.allocRun(p, glyphCount, 10, 10, NULL); 42 run = &builder.allocRun(p, glyphCount, 10, 10, NULL);
42 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); 43 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t));
43 44
44 run = &builder.allocRunPosH(p, glyphCount, 80, NULL); 45 run = &builder.allocRunPosH(p, glyphCount, 80, NULL);
45 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); 46 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 102
102 private: 103 private:
103 SkTDArray<uint16_t> fGlyphs; 104 SkTDArray<uint16_t> fGlyphs;
104 SkAutoTUnref<const SkTextBlob> fBlob; 105 SkAutoTUnref<const SkTextBlob> fBlob;
105 SkAutoTUnref<SkShader> fShader; 106 SkAutoTUnref<SkShader> fShader;
106 107
107 typedef skiagm::GM INHERITED; 108 typedef skiagm::GM INHERITED;
108 }; 109 };
109 110
110 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); ) 111 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); )
OLDNEW
« no previous file with comments | « gm/textbloblooper.cpp ('k') | gm/transparency.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698