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

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

Issue 1117443002: create GrTestUtils.h, move some common functions into it (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/GrOvalRenderer.cpp ('k') | src/gpu/GrTestUtils.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 "GrProcessor.h" 8 #include "GrProcessor.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrCoordTransform.h" 10 #include "GrCoordTransform.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 template<> 70 template<>
71 void GrProcessorTestFactory<GrXPFactory>::VerifyFactoryCount() { 71 void GrProcessorTestFactory<GrXPFactory>::VerifyFactoryCount() {
72 if (kXPFactoryCount != GetFactories()->count()) { 72 if (kXPFactoryCount != GetFactories()->count()) {
73 SkFAIL("Wrong number of xp factory factories!"); 73 SkFAIL("Wrong number of xp factory factories!");
74 } 74 }
75 } 75 }
76 76
77 #endif 77 #endif
78 78
79 namespace GrProcessorUnitTest {
80 const SkMatrix& TestMatrix(SkRandom* random) {
81 static SkMatrix gMatrices[5];
82 static bool gOnce;
83 if (!gOnce) {
84 gMatrices[0].reset();
85 gMatrices[1].setTranslate(SkIntToScalar(-100), SkIntToScalar(100));
86 gMatrices[2].setRotate(SkIntToScalar(17));
87 gMatrices[3].setRotate(SkIntToScalar(185));
88 gMatrices[3].postTranslate(SkIntToScalar(66), SkIntToScalar(-33));
89 gMatrices[3].postScale(SkIntToScalar(2), SK_ScalarHalf);
90 gMatrices[4].setRotate(SkIntToScalar(215));
91 gMatrices[4].set(SkMatrix::kMPersp0, 0.00013f);
92 gMatrices[4].set(SkMatrix::kMPersp1, -0.000039f);
93 gOnce = true;
94 }
95 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT( gMatrices)))];
96 }
97 }
98
99 79
100 // We use a global pool protected by a mutex(spinlock). Chrome may use the same GrContext on 80 // We use a global pool protected by a mutex(spinlock). Chrome may use the same GrContext on
101 // different threads. The GrContext is not used concurrently on different thread s and there is a 81 // different threads. The GrContext is not used concurrently on different thread s and there is a
102 // memory barrier between accesses of a context on different threads. Also, ther e may be multiple 82 // memory barrier between accesses of a context on different threads. Also, ther e may be multiple
103 // GrContexts and those contexts may be in use concurrently on different threads . 83 // GrContexts and those contexts may be in use concurrently on different threads .
104 namespace { 84 namespace {
105 SK_DECLARE_STATIC_SPINLOCK(gProcessorSpinlock); 85 SK_DECLARE_STATIC_SPINLOCK(gProcessorSpinlock);
106 class MemoryPoolAccessor { 86 class MemoryPoolAccessor {
107 public: 87 public:
108 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); } 88 MemoryPoolAccessor() { gProcessorSpinlock.acquire(); }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 150
171 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const { 151 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const {
172 this->onComputeInvariantOutput(inout); 152 this->onComputeInvariantOutput(inout);
173 } 153 }
174 154
175 //////////////////////////////////////////////////////////////////////////////// /////////////////// 155 //////////////////////////////////////////////////////////////////////////////// ///////////////////
176 156
177 // Initial static variable from GrXPFactory 157 // Initial static variable from GrXPFactory
178 int32_t GrXPFactory::gCurrXPFClassID = 158 int32_t GrXPFactory::gCurrXPFClassID =
179 GrXPFactory::kIllegalXPFClassID; 159 GrXPFactory::kIllegalXPFClassID;
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrTestUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698