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

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

Issue 2330553003: Gamut transformation of the paint color in Ganesh (Closed)
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrColorSpaceXform.cpp ('k') | src/gpu/SkGr.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 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 "GrBatchTest.h" 8 #include "GrBatchTest.h"
9 #include "GrColor.h" 9 #include "GrColor.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 sk_sp<SkColorSpace> colorSpace, 79 sk_sp<SkColorSpace> colorSpace,
80 const SkSurfaceProps* surfaceProps, 80 const SkSurfaceProps* surfaceProps,
81 GrAuditTrail* auditTrail, 81 GrAuditTrail* auditTrail,
82 GrSingleOwner* singleOwner) 82 GrSingleOwner* singleOwner)
83 : fDrawingManager(drawingMgr) 83 : fDrawingManager(drawingMgr)
84 , fRenderTarget(std::move(rt)) 84 , fRenderTarget(std::move(rt))
85 , fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget())) 85 , fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget()))
86 , fContext(context) 86 , fContext(context)
87 , fInstancedPipelineInfo(fRenderTarget.get()) 87 , fInstancedPipelineInfo(fRenderTarget.get())
88 , fColorSpace(std::move(colorSpace)) 88 , fColorSpace(std::move(colorSpace))
89 , fColorXformFromSRGB(nullptr)
89 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) 90 , fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
90 , fAuditTrail(auditTrail) 91 , fAuditTrail(auditTrail)
91 #ifdef SK_DEBUG 92 #ifdef SK_DEBUG
92 , fSingleOwner(singleOwner) 93 , fSingleOwner(singleOwner)
93 #endif 94 #endif
94 { 95 {
96 if (fColorSpace) {
97 // sRGB sources are very common (SkColor, etc...), so we cache that gamu t transformation
98 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
99 fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fCol orSpace.get());
100 }
95 SkDEBUGCODE(this->validate();) 101 SkDEBUGCODE(this->validate();)
96 } 102 }
97 103
98 #ifdef SK_DEBUG 104 #ifdef SK_DEBUG
99 void GrDrawContext::validate() const { 105 void GrDrawContext::validate() const {
100 SkASSERT(fRenderTarget); 106 SkASSERT(fRenderTarget);
101 ASSERT_OWNED_RESOURCE(fRenderTarget); 107 ASSERT_OWNED_RESOURCE(fRenderTarget);
102 108
103 if (fDrawTarget && !fDrawTarget->isClosed()) { 109 if (fDrawTarget && !fDrawTarget->isClosed()) {
104 SkASSERT(fRenderTarget->getLastDrawTarget() == fDrawTarget); 110 SkASSERT(fRenderTarget->getLastDrawTarget() == fDrawTarget);
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 1434
1429 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip, 1435 void GrDrawContext::drawBatch(const GrPipelineBuilder& pipelineBuilder, const Gr Clip& clip,
1430 GrDrawBatch* batch) { 1436 GrDrawBatch* batch) {
1431 ASSERT_SINGLE_OWNER 1437 ASSERT_SINGLE_OWNER
1432 RETURN_IF_ABANDONED 1438 RETURN_IF_ABANDONED
1433 SkDEBUGCODE(this->validate();) 1439 SkDEBUGCODE(this->validate();)
1434 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch"); 1440 GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrDrawContext::drawBatch");
1435 1441
1436 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch); 1442 this->getDrawTarget()->drawBatch(pipelineBuilder, this, clip, batch);
1437 } 1443 }
OLDNEW
« no previous file with comments | « src/gpu/GrColorSpaceXform.cpp ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698