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

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

Issue 446953002: Add an opaqueness hint to GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@greg
Patch Set: Address comments Created 6 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 | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.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 "GrDistanceFieldTextContext.h" 8 #include "GrDistanceFieldTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 // The texture coords are last in both the with and without color vertex lay outs. 415 // The texture coords are last in both the with and without color vertex lay outs.
416 SkPoint* textureCoords = reinterpret_cast<SkPoint*>( 416 SkPoint* textureCoords = reinterpret_cast<SkPoint*>(
417 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint)) ; 417 reinterpret_cast<intptr_t>(positions) + vertSize - sizeof(SkPoint)) ;
418 textureCoords->setRectFan(SkFixedToFloat(texture->normalizeFixedX(tx)), 418 textureCoords->setRectFan(SkFixedToFloat(texture->normalizeFixedX(tx)),
419 SkFixedToFloat(texture->normalizeFixedY(ty)), 419 SkFixedToFloat(texture->normalizeFixedY(ty)),
420 SkFixedToFloat(texture->normalizeFixedX(tx + tw)), 420 SkFixedToFloat(texture->normalizeFixedX(tx + tw)),
421 SkFixedToFloat(texture->normalizeFixedY(ty + th)), 421 SkFixedToFloat(texture->normalizeFixedY(ty + th)),
422 vertSize); 422 vertSize);
423 if (useColorVerts) { 423 if (useColorVerts) {
424 if (0xFF == GrColorUnpackA(fPaint.getColor())) {
425 fDrawTarget->drawState()->setHint(GrDrawState::kVertexColorsAreOpaqu e_Hint, true);
426 }
424 // color comes after position. 427 // color comes after position.
425 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1); 428 GrColor* colors = reinterpret_cast<GrColor*>(positions + 1);
426 for (int i = 0; i < 4; ++i) { 429 for (int i = 0; i < 4; ++i) {
427 *colors = fPaint.getColor(); 430 *colors = fPaint.getColor();
428 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(color s) + vertSize); 431 colors = reinterpret_cast<GrColor*>(reinterpret_cast<intptr_t>(color s) + vertSize);
429 } 432 }
430 } 433 }
431 434
432 fCurrVertex += 4; 435 fCurrVertex += 4;
433 } 436 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 SkScalarToFixed(x) - (glyph.fAdvanceX >> a lignShift), 644 SkScalarToFixed(x) - (glyph.fAdvanceX >> a lignShift),
642 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift), 645 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift),
643 fontScaler); 646 fontScaler);
644 } 647 }
645 pos += scalarsPerPosition; 648 pos += scalarsPerPosition;
646 } 649 }
647 } 650 }
648 651
649 this->finish(); 652 this->finish();
650 } 653 }
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698