OLD | NEW |
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 "GrResourceProvider.h" | 8 #include "GrResourceProvider.h" |
9 | 9 |
10 #include "GrBuffer.h" | 10 #include "GrBuffer.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 const GrBuffer* GrResourceProvider::createQuadIndexBuffer() { | 65 const GrBuffer* GrResourceProvider::createQuadIndexBuffer() { |
66 static const int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1; | 66 static const int kMaxQuads = 1 << 12; // max possible: (1 << 14) - 1; |
67 GR_STATIC_ASSERT(4 * kMaxQuads <= 65535); | 67 GR_STATIC_ASSERT(4 * kMaxQuads <= 65535); |
68 static const uint16_t kPattern[] = { 0, 1, 2, 0, 2, 3 }; | 68 static const uint16_t kPattern[] = { 0, 1, 2, 0, 2, 3 }; |
69 | 69 |
70 return this->createInstancedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadInde
xBufferKey); | 70 return this->createInstancedIndexBuffer(kPattern, 6, kMaxQuads, 4, fQuadInde
xBufferKey); |
71 } | 71 } |
72 | 72 |
73 GrPath* GrResourceProvider::createPath(const SkPath& path, const GrStyle& style)
{ | 73 GrPath* GrResourceProvider::createPath(const SkPath& path, const GrStrokeInfo& s
troke) { |
74 SkASSERT(this->gpu()->pathRendering()); | 74 SkASSERT(this->gpu()->pathRendering()); |
75 return this->gpu()->pathRendering()->createPath(path, style); | 75 return this->gpu()->pathRendering()->createPath(path, stroke); |
76 } | 76 } |
77 | 77 |
78 GrPathRange* GrResourceProvider::createPathRange(GrPathRange::PathGenerator* gen
, | 78 GrPathRange* GrResourceProvider::createPathRange(GrPathRange::PathGenerator* gen
, |
79 const GrStyle& style) { | 79 const GrStrokeInfo& stroke) { |
80 SkASSERT(this->gpu()->pathRendering()); | 80 SkASSERT(this->gpu()->pathRendering()); |
81 return this->gpu()->pathRendering()->createPathRange(gen, style); | 81 return this->gpu()->pathRendering()->createPathRange(gen, stroke); |
82 } | 82 } |
83 | 83 |
84 GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, | 84 GrPathRange* GrResourceProvider::createGlyphs(const SkTypeface* tf, |
85 const SkScalerContextEffects& effe
cts, | 85 const SkScalerContextEffects& effe
cts, |
86 const SkDescriptor* desc, | 86 const SkDescriptor* desc, |
87 const GrStyle& style) { | 87 const GrStrokeInfo& stroke) { |
88 | 88 |
89 SkASSERT(this->gpu()->pathRendering()); | 89 SkASSERT(this->gpu()->pathRendering()); |
90 return this->gpu()->pathRendering()->createGlyphs(tf, effects, desc, style); | 90 return this->gpu()->pathRendering()->createGlyphs(tf, effects, desc, stroke)
; |
91 } | 91 } |
92 | 92 |
93 GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedTyp
e, | 93 GrBuffer* GrResourceProvider::createBuffer(size_t size, GrBufferType intendedTyp
e, |
94 GrAccessPattern accessPattern, uint32
_t flags, | 94 GrAccessPattern accessPattern, uint32
_t flags, |
95 const void* data) { | 95 const void* data) { |
96 if (this->isAbandoned()) { | 96 if (this->isAbandoned()) { |
97 return nullptr; | 97 return nullptr; |
98 } | 98 } |
99 if (kDynamic_GrAccessPattern != accessPattern) { | 99 if (kDynamic_GrAccessPattern != accessPattern) { |
100 return this->gpu()->createBuffer(size, intendedType, accessPattern, data
); | 100 return this->gpu()->createBuffer(size, intendedType, accessPattern, data
); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 return rt->renderTargetPriv().getStencilAttachment(); | 196 return rt->renderTargetPriv().getStencilAttachment(); |
197 } | 197 } |
198 | 198 |
199 GrRenderTarget* GrResourceProvider::wrapBackendTextureAsRenderTarget( | 199 GrRenderTarget* GrResourceProvider::wrapBackendTextureAsRenderTarget( |
200 const GrBackendTextureDesc& desc) { | 200 const GrBackendTextureDesc& desc) { |
201 if (this->isAbandoned()) { | 201 if (this->isAbandoned()) { |
202 return nullptr; | 202 return nullptr; |
203 } | 203 } |
204 return this->gpu()->wrapBackendTextureAsRenderTarget(desc); | 204 return this->gpu()->wrapBackendTextureAsRenderTarget(desc); |
205 } | 205 } |
OLD | NEW |