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

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

Issue 554833002: Calculate Primary and Secondary output types in the GrOptDrawState (Closed) Base URL: https://skia.googlesource.com/skia.git@optReadDst
Patch Set: Rebase 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 | « src/gpu/GrDrawState.h ('k') | src/gpu/GrOptDrawState.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 2012 Google Inc. 2 * Copyright 2012 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 "GrDrawState.h" 8 #include "GrDrawState.h"
9 9
10 #include "GrDrawTargetCaps.h"
11 #include "GrOptDrawState.h" 10 #include "GrOptDrawState.h"
12 #include "GrPaint.h" 11 #include "GrPaint.h"
13 12
14 //////////////////////////////////////////////////////////////////////////////s 13 //////////////////////////////////////////////////////////////////////////////s
15 14
16 GrOptDrawState* GrDrawState::createOptState() const { 15 GrOptDrawState* GrDrawState::createOptState(const GrDrawTargetCaps& caps) const {
17 if (NULL == fCachedOptState) { 16 if (NULL == fCachedOptState || caps.getUniqueID() != fCachedCapsID) {
18 GrBlendCoeff srcCoeff; 17 GrBlendCoeff srcCoeff;
19 GrBlendCoeff dstCoeff; 18 GrBlendCoeff dstCoeff;
20 BlendOptFlags blendFlags = this->getBlendOpts(false, &srcCoeff, &dstCoef f); 19 BlendOptFlags blendFlags = this->getBlendOpts(false, &srcCoeff, &dstCoef f);
21 fCachedOptState = SkNEW_ARGS(GrOptDrawState, (*this, blendFlags, srcCoef f, dstCoeff)); 20 fCachedOptState = SkNEW_ARGS(GrOptDrawState, (*this, blendFlags, srcCoef f, dstCoeff, caps));
21 fCachedCapsID = caps.getUniqueID();
22 } else { 22 } else {
23 #ifdef SK_DEBUG 23 #ifdef SK_DEBUG
24 GrBlendCoeff srcCoeff; 24 GrBlendCoeff srcCoeff;
25 GrBlendCoeff dstCoeff; 25 GrBlendCoeff dstCoeff;
26 BlendOptFlags blendFlags = this->getBlendOpts(false, &srcCoeff, &dstCoef f); 26 BlendOptFlags blendFlags = this->getBlendOpts(false, &srcCoeff, &dstCoef f);
27 SkASSERT(GrOptDrawState(*this, blendFlags, srcCoeff, dstCoeff) == *fCach edOptState); 27 SkASSERT(GrOptDrawState(*this, blendFlags, srcCoeff, dstCoeff, caps) == *fCachedOptState);
28 #endif 28 #endif
29 } 29 }
30 fCachedOptState->ref(); 30 fCachedOptState->ref();
31 return fCachedOptState; 31 return fCachedOptState;
32 } 32 }
33 33
34 //////////////////////////////////////////////////////////////////////////////s 34 //////////////////////////////////////////////////////////////////////////////s
35 35
36 GrDrawState::CombinedState GrDrawState::CombineIfPossible( 36 GrDrawState::CombinedState GrDrawState::CombineIfPossible(
37 const GrDrawState& a, const GrDrawState& b, const GrDrawTargetCaps& caps) { 37 const GrDrawState& a, const GrDrawState& b, const GrDrawTargetCaps& caps) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 SkSafeSetNull(fCachedOptState); 466 SkSafeSetNull(fCachedOptState);
467 } 467 }
468 468
469 //////////////////////////////////////////////////////////////////////////////// 469 ////////////////////////////////////////////////////////////////////////////////
470 470
471 GrDrawState::~GrDrawState() { 471 GrDrawState::~GrDrawState() {
472 SkSafeUnref(fCachedOptState); 472 SkSafeUnref(fCachedOptState);
473 SkASSERT(0 == fBlockEffectRemovalCnt); 473 SkASSERT(0 == fBlockEffectRemovalCnt);
474 } 474 }
475 475
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrOptDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698