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

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

Issue 377503004: Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*. (Closed) Base URL: https://skia.googlesource.com/skia.git@no_ref
Patch Set: Update YUV effect to reflect these changes. Created 6 years, 5 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/GrPaint.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 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 "GrEffect.h" 8 #include "GrEffect.h"
9 #include "GrBackendEffectFactory.h" 9 #include "GrBackendEffectFactory.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 static void DeleteTLS(void* pool) { 53 static void DeleteTLS(void* pool) {
54 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); 54 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool));
55 } 55 }
56 }; 56 };
57 57
58 int32_t GrBackendEffectFactory::fCurrEffectClassID = GrBackendEffectFactory::kIl legalEffectClassID; 58 int32_t GrBackendEffectFactory::fCurrEffectClassID = GrBackendEffectFactory::kIl legalEffectClassID;
59 59
60 /////////////////////////////////////////////////////////////////////////////// 60 ///////////////////////////////////////////////////////////////////////////////
61 61
62 GrEffectRef::~GrEffectRef() { 62 GrEffect::~GrEffect() {}
63 SkASSERT(this->unique());
64 fEffect->EffectRefDestroyed();
65 fEffect->unref();
66 }
67
68 void* GrEffectRef::operator new(size_t size) {
69 return GrEffect_Globals::GetTLS()->allocate(size);
70 }
71
72 void GrEffectRef::operator delete(void* target) {
73 GrEffect_Globals::GetTLS()->release(target);
74 }
75
76 ///////////////////////////////////////////////////////////////////////////////
77
78 GrEffect::~GrEffect() {
79 SkASSERT(NULL == fEffectRef);
80 }
81 63
82 const char* GrEffect::name() const { 64 const char* GrEffect::name() const {
83 return this->getFactory().name(); 65 return this->getFactory().name();
84 } 66 }
85 67
86 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { 68 void GrEffect::addCoordTransform(const GrCoordTransform* transform) {
87 fCoordTransforms.push_back(transform); 69 fCoordTransforms.push_back(transform);
88 SkDEBUGCODE(transform->setInEffect();) 70 SkDEBUGCODE(transform->setInEffect();)
89 } 71 }
90 72
(...skipping 14 matching lines...) Expand all
105 SkASSERT(this->numTransforms() == other.numTransforms()); 87 SkASSERT(this->numTransforms() == other.numTransforms());
106 for (int i = 0; i < this->numTransforms(); ++i) { 88 for (int i = 0; i < this->numTransforms(); ++i) {
107 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); 89 SkASSERT(this->coordTransform(i) == other.coordTransform(i));
108 } 90 }
109 SkASSERT(this->numTextures() == other.numTextures()); 91 SkASSERT(this->numTextures() == other.numTextures());
110 for (int i = 0; i < this->numTextures(); ++i) { 92 for (int i = 0; i < this->numTextures(); ++i) {
111 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); 93 SkASSERT(this->textureAccess(i) == other.textureAccess(i));
112 } 94 }
113 } 95 }
114 #endif 96 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/GrPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698