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

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

Issue 619853005: add SkRect::joinNonEmptyArg for faster unioning (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | « include/core/SkRect.h ('k') | src/gpu/GrDistanceFieldTextContext.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 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 568
569 SkFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX); 569 SkFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
570 SkFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY); 570 SkFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
571 571
572 SkRect r; 572 SkRect r;
573 r.fLeft = SkFixedToFloat(vx); 573 r.fLeft = SkFixedToFloat(vx);
574 r.fTop = SkFixedToFloat(vy); 574 r.fTop = SkFixedToFloat(vy);
575 r.fRight = SkFixedToFloat(vx + width); 575 r.fRight = SkFixedToFloat(vx + width);
576 r.fBottom = SkFixedToFloat(vy + height); 576 r.fBottom = SkFixedToFloat(vy + height);
577 577
578 fVertexBounds.growToInclude(r); 578 fVertexBounds.joinNonEmptyArg(r);
579 579
580 size_t vertSize = useColorVerts ? (2 * sizeof(SkPoint) + sizeof(GrColor)) : 580 size_t vertSize = useColorVerts ? (2 * sizeof(SkPoint) + sizeof(GrColor)) :
581 (2 * sizeof(SkPoint)); 581 (2 * sizeof(SkPoint));
582 582
583 SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride()); 583 SkASSERT(vertSize == fDrawTarget->getDrawState().getVertexStride());
584 584
585 SkPoint* positions = reinterpret_cast<SkPoint*>( 585 SkPoint* positions = reinterpret_cast<SkPoint*>(
586 reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex); 586 reinterpret_cast<intptr_t>(fVertices) + vertSize * fCurrVertex);
587 positions->setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, vertSize); 587 positions->setRectFan(r.fLeft, r.fTop, r.fRight, r.fBottom, vertSize);
588 588
(...skipping 11 matching lines...) Expand all
600 } 600 }
601 // color comes after position. 601 // color comes after position.
602 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); 602 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1);
603 for (int i = 0; i < 4; ++i) { 603 for (int i = 0; i < 4; ++i) {
604 *colors = fPaint.getColor(); 604 *colors = fPaint.getColor();
605 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors ) + vertSize); 605 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(colors ) + vertSize);
606 } 606 }
607 } 607 }
608 fCurrVertex += 4; 608 fCurrVertex += 4;
609 } 609 }
OLDNEW
« no previous file with comments | « include/core/SkRect.h ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698