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

Unified Diff: src/gpu/batches/GrDrawAtlasBatch.cpp

Issue 1348583002: Make skpaint->grpaint flow work for composing draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused inheriteds to satisfy clang Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/SkGrPriv.h ('k') | src/gpu/effects/GrXfermodeFragmentProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrDrawAtlasBatch.cpp
diff --git a/src/gpu/batches/GrDrawAtlasBatch.cpp b/src/gpu/batches/GrDrawAtlasBatch.cpp
index 2254e9cdfec6573ba3afc6065bd5eaf1780effa6..5ecdc1fb032a619b50ec5433428dbd225cc18961 100644
--- a/src/gpu/batches/GrDrawAtlasBatch.cpp
+++ b/src/gpu/batches/GrDrawAtlasBatch.cpp
@@ -13,12 +13,21 @@
#include "SkRSXform.h"
void GrDrawAtlasBatch::initBatchTracker(const GrPipelineOptimizations& opt) {
+ SkASSERT(fGeoData.count() == 1);
// Handle any color overrides
if (!opt.readsColor()) {
fGeoData[0].fColor = GrColor_ILLEGAL;
}
- opt.getOverrideColorIfSet(&fGeoData[0].fColor);
-
+ if (opt.getOverrideColorIfSet(&fGeoData[0].fColor) && fHasColors) {
+ size_t vertexStride = sizeof(SkPoint) + sizeof(SkPoint) +
+ (this->hasColors() ? sizeof(GrColor) : 0);
+ uint8_t* currVertex = fGeoData[0].fVerts.begin();
+ for (int i = 0; i < 4*fQuadCount; ++i) {
+ *(reinterpret_cast<GrColor*>(currVertex + sizeof(SkPoint))) = fGeoData[0].fColor;
+ currVertex += vertexStride;
+ }
+ }
+
// setup batch properties
fColorIgnored = !opt.readsColor();
fColor = fGeoData[0].fColor;
@@ -117,7 +126,7 @@ GrDrawAtlasBatch::GrDrawAtlasBatch(const Geometry& geometry, const SkMatrix& vie
if (paintAlpha != 255) {
color = SkColorSetA(color, SkMulDiv255Round(SkColorGetA(color), paintAlpha));
}
- GrColor grColor = SkColor2GrColor(color);
+ GrColor grColor = SkColorToPremulGrColor(color);
*(reinterpret_cast<GrColor*>(currVertex+sizeof(SkPoint))) = grColor;
*(reinterpret_cast<GrColor*>(currVertex+vertexStride+sizeof(SkPoint))) = grColor;
« no previous file with comments | « src/gpu/SkGrPriv.h ('k') | src/gpu/effects/GrXfermodeFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698