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

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

Issue 144283004: Add dev bounds to bmp txt context, use bounds to ignore clips (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: cleanup comment Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrBitmapTextContext.h ('k') | src/gpu/GrClipMaskManager.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 2013 Google Inc. 2 * Copyright 2013 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 "GrBitmapTextContext.h" 8 #include "GrBitmapTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 21 matching lines...) Expand all
32 GrBitmapTextContext::GrBitmapTextContext(GrContext* context, 32 GrBitmapTextContext::GrBitmapTextContext(GrContext* context,
33 const SkDeviceProperties& properties) 33 const SkDeviceProperties& properties)
34 : GrTextContext(context, properties) { 34 : GrTextContext(context, properties) {
35 fStrike = NULL; 35 fStrike = NULL;
36 36
37 fCurrTexture = NULL; 37 fCurrTexture = NULL;
38 fCurrVertex = 0; 38 fCurrVertex = 0;
39 39
40 fVertices = NULL; 40 fVertices = NULL;
41 fMaxVertices = 0; 41 fMaxVertices = 0;
42
43 fVertexBounds.setLargestInverted();
42 } 44 }
43 45
44 GrBitmapTextContext::~GrBitmapTextContext() { 46 GrBitmapTextContext::~GrBitmapTextContext() {
45 this->flushGlyphs(); 47 this->flushGlyphs();
46 } 48 }
47 49
48 bool GrBitmapTextContext::canDraw(const SkPaint& paint) { 50 bool GrBitmapTextContext::canDraw(const SkPaint& paint) {
49 return !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix()); 51 return !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix());
50 } 52 }
51 53
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } else { 100 } else {
99 // set back to normal in case we took LCD path previously. 101 // set back to normal in case we took LCD path previously.
100 drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlen dCoeff()); 102 drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlen dCoeff());
101 drawState->setColor(fPaint.getColor()); 103 drawState->setColor(fPaint.getColor());
102 } 104 }
103 105
104 int nGlyphs = fCurrVertex / 4; 106 int nGlyphs = fCurrVertex / 4;
105 fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer()); 107 fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
106 fDrawTarget->drawIndexedInstances(kTriangles_GrPrimitiveType, 108 fDrawTarget->drawIndexedInstances(kTriangles_GrPrimitiveType,
107 nGlyphs, 109 nGlyphs,
108 4, 6); 110 4, 6, &fVertexBounds);
109 111
110 fDrawTarget->resetVertexSource(); 112 fDrawTarget->resetVertexSource();
111 fVertices = NULL; 113 fVertices = NULL;
112 fMaxVertices = 0; 114 fMaxVertices = 0;
113 fCurrVertex = 0; 115 fCurrVertex = 0;
116 fVertexBounds.setLargestInverted();
114 SkSafeSetNull(fCurrTexture); 117 SkSafeSetNull(fCurrTexture);
115 } 118 }
116 } 119 }
117 120
118 inline void GrBitmapTextContext::init(const GrPaint& paint, const SkPaint& skPai nt) { 121 inline void GrBitmapTextContext::init(const GrPaint& paint, const SkPaint& skPai nt) {
119 GrTextContext::init(paint, skPaint); 122 GrTextContext::init(paint, skPaint);
120 123
121 fStrike = NULL; 124 fStrike = NULL;
122 125
123 fCurrTexture = NULL; 126 fCurrTexture = NULL;
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 0, 612 0,
610 GrTCast<void**>(& fVertices), 613 GrTCast<void**>(& fVertices),
611 NULL); 614 NULL);
612 GrAlwaysAssert(success); 615 GrAlwaysAssert(success);
613 SkASSERT(2*sizeof(GrPoint) == fDrawTarget->getDrawState().getVertexSize( )); 616 SkASSERT(2*sizeof(GrPoint) == fDrawTarget->getDrawState().getVertexSize( ));
614 } 617 }
615 618
616 GrFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX); 619 GrFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
617 GrFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY); 620 GrFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
618 621
619 fVertices[2*fCurrVertex].setRectFan(SkFixedToFloat(vx), 622 SkRect r;
620 SkFixedToFloat(vy), 623 r.fLeft = SkFixedToFloat(vx);
621 SkFixedToFloat(vx + width), 624 r.fTop = SkFixedToFloat(vy);
622 SkFixedToFloat(vy + height), 625 r.fRight = SkFixedToFloat(vx + width);
626 r.fBottom = SkFixedToFloat(vy + height);
627
628 fVertexBounds.growToInclude(r);
629
630 fVertices[2*fCurrVertex].setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom,
623 2 * sizeof(SkPoint)); 631 2 * sizeof(SkPoint));
624 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed X(tx)), 632 fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixed X(tx)),
625 SkFixedToFloat(texture->normalizeFixed Y(ty)), 633 SkFixedToFloat(texture->normalizeFixed Y(ty)),
626 SkFixedToFloat(texture->normalizeFixed X(tx + width)), 634 SkFixedToFloat(texture->normalizeFixed X(tx + width)),
627 SkFixedToFloat(texture->normalizeFixed Y(ty + height)), 635 SkFixedToFloat(texture->normalizeFixed Y(ty + height)),
628 2 * sizeof(SkPoint)); 636 2 * sizeof(SkPoint));
629 fCurrVertex += 4; 637 fCurrVertex += 4;
630 } 638 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.h ('k') | src/gpu/GrClipMaskManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698