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

Side by Side Diff: src/gpu/GrAtlasTextBlob.cpp

Issue 1502323002: A small cleanup of GrAtlasTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext
Patch Set: fix refcount issue 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 | « src/gpu/GrAtlasTextBlob.h ('k') | src/gpu/GrAtlasTextContext.h » ('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 "GrAtlasTextBlob.h" 8 #include "GrAtlasTextBlob.h"
9 9
10 void GrAtlasTextBlob::appendGlyph(Run* run,
11 Run::SubRunInfo* subRun,
12 const SkRect& positions, GrColor color,
13 size_t vertexStride, bool useVertexColor,
14 GrGlyph* glyph) {
15 run->fVertexBounds.joinNonEmptyArg(positions);
16 run->fColor = color;
17
18 intptr_t vertex = reinterpret_cast<intptr_t>(this->fVertices + subRun->verte xEndIndex());
19
20 if (useVertexColor) {
21 // V0
22 SkPoint* position = reinterpret_cast<SkPoint*>(vertex);
23 position->set(positions.fLeft, positions.fTop);
24 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint)) ;
25 *colorPtr = color;
26 vertex += vertexStride;
27
28 // V1
29 position = reinterpret_cast<SkPoint*>(vertex);
30 position->set(positions.fLeft, positions.fBottom);
31 colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
32 *colorPtr = color;
33 vertex += vertexStride;
34
35 // V2
36 position = reinterpret_cast<SkPoint*>(vertex);
37 position->set(positions.fRight, positions.fBottom);
38 colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
39 *colorPtr = color;
40 vertex += vertexStride;
41
42 // V3
43 position = reinterpret_cast<SkPoint*>(vertex);
44 position->set(positions.fRight, positions.fTop);
45 colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint));
46 *colorPtr = color;
47 } else {
48 // V0
49 SkPoint* position = reinterpret_cast<SkPoint*>(vertex);
50 position->set(positions.fLeft, positions.fTop);
51 vertex += vertexStride;
52
53 // V1
54 position = reinterpret_cast<SkPoint*>(vertex);
55 position->set(positions.fLeft, positions.fBottom);
56 vertex += vertexStride;
57
58 // V2
59 position = reinterpret_cast<SkPoint*>(vertex);
60 position->set(positions.fRight, positions.fBottom);
61 vertex += vertexStride;
62
63 // V3
64 position = reinterpret_cast<SkPoint*>(vertex);
65 position->set(positions.fRight, positions.fTop);
66 }
67 subRun->appendVertices(vertexStride);
68 fGlyphs[subRun->glyphEndIndex()] = glyph;
69 subRun->glyphAppended();
70 }
71
72 // TODO get this code building again
10 #ifdef CACHE_SANITY_CHECK 73 #ifdef CACHE_SANITY_CHECK
11 void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo b& r) { 74 void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo b& r) {
12 SkASSERT(l.fSize == r.fSize); 75 SkASSERT(l.fSize == r.fSize);
13 SkASSERT(l.fPool == r.fPool); 76 SkASSERT(l.fPool == r.fPool);
14 77
15 SkASSERT(l.fBlurRec.fSigma == r.fBlurRec.fSigma); 78 SkASSERT(l.fBlurRec.fSigma == r.fBlurRec.fSigma);
16 SkASSERT(l.fBlurRec.fStyle == r.fBlurRec.fStyle); 79 SkASSERT(l.fBlurRec.fStyle == r.fBlurRec.fStyle);
17 SkASSERT(l.fBlurRec.fQuality == r.fBlurRec.fQuality); 80 SkASSERT(l.fBlurRec.fQuality == r.fBlurRec.fQuality);
18 81
19 SkASSERT(l.fStrokeInfo.fFrameWidth == r.fStrokeInfo.fFrameWidth); 82 SkASSERT(l.fStrokeInfo.fFrameWidth == r.fStrokeInfo.fFrameWidth);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); 163 rSubRun.fBulkUseToken.fPlotAlreadyUpdated);
101 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) { 164 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) {
102 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == 165 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] ==
103 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); 166 rSubRun.fBulkUseToken.fPlotsToUpdate[k]);
104 }*/ 167 }*/
105 } 168 }
106 } 169 }
107 } 170 }
108 171
109 #endif 172 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAtlasTextBlob.h ('k') | src/gpu/GrAtlasTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698