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

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

Issue 418143004: Rename GrGpuObject to GrGpuResource (Closed) Base URL: https://skia.googlesource.com/skia.git@compact
Patch Set: Fix indents Created 6 years, 4 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/GrResourceCache.cpp ('k') | src/gpu/GrStencilBuffer.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 2014 Google Inc. 2 * Copyright 2014 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 "GrStencilAndCoverTextContext.h" 8 #include "GrStencilAndCoverTextContext.h"
9 #include "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
11 #include "GrPath.h" 11 #include "GrPath.h"
12 #include "GrPathRange.h" 12 #include "GrPathRange.h"
13 #include "SkAutoKern.h" 13 #include "SkAutoKern.h"
14 #include "SkDraw.h" 14 #include "SkDraw.h"
15 #include "SkDrawProcs.h" 15 #include "SkDrawProcs.h"
16 #include "SkGlyphCache.h" 16 #include "SkGlyphCache.h"
17 #include "SkGpuDevice.h" 17 #include "SkGpuDevice.h"
18 #include "SkPath.h" 18 #include "SkPath.h"
19 #include "SkTextMapStateProc.h" 19 #include "SkTextMapStateProc.h"
20 20
21 class GrStencilAndCoverTextContext::GlyphPathRange : public GrGpuObject { 21 class GrStencilAndCoverTextContext::GlyphPathRange : public GrGpuResource {
22 static const int kMaxGlyphCount = 1 << 16; // Glyph IDs are uint16_t's 22 static const int kMaxGlyphCount = 1 << 16; // Glyph IDs are uint16_t's
23 static const int kGlyphGroupSize = 16; // Glyphs get tracked in groups of 16 23 static const int kGlyphGroupSize = 16; // Glyphs get tracked in groups of 16
24 24
25 public: 25 public:
26 static GlyphPathRange* Create(GrContext* context, 26 static GlyphPathRange* Create(GrContext* context,
27 SkGlyphCache* cache, 27 SkGlyphCache* cache,
28 const SkStrokeRec& stroke) { 28 const SkStrokeRec& stroke) {
29 static const GrCacheID::Domain gGlyphPathRangeDomain = GrCacheID::Genera teDomain(); 29 static const GrCacheID::Domain gGlyphPathRangeDomain = GrCacheID::Genera teDomain();
30 30
31 GrCacheID::Key key; 31 GrCacheID::Key key;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const SkGlyph& skGlyph = cache->getGlyphIDMetrics(id); 68 const SkGlyph& skGlyph = cache->getGlyphIDMetrics(id);
69 if (const SkPath* skPath = cache->findPath(skGlyph)) { 69 if (const SkPath* skPath = cache->findPath(skGlyph)) {
70 fPathRange->initAt(id, *skPath); 70 fPathRange->initAt(id, *skPath);
71 } // GrGpu::drawPaths will silently ignore undefined paths. 71 } // GrGpu::drawPaths will silently ignore undefined paths.
72 } 72 }
73 73
74 fLoadedGlyphs[groupByte] |= groupBit; 74 fLoadedGlyphs[groupByte] |= groupBit;
75 this->didChangeGpuMemorySize(); 75 this->didChangeGpuMemorySize();
76 } 76 }
77 77
78 // GrGpuObject overrides 78 // GrGpuResource overrides
79 virtual size_t gpuMemorySize() const SK_OVERRIDE { return fPathRange->gpuMem orySize(); } 79 virtual size_t gpuMemorySize() const SK_OVERRIDE { return fPathRange->gpuMem orySize(); }
80 80
81 private: 81 private:
82 GlyphPathRange(GrContext* context, const SkDescriptor& desc, const SkStrokeR ec& stroke) 82 GlyphPathRange(GrContext* context, const SkDescriptor& desc, const SkStrokeR ec& stroke)
83 : INHERITED(context->getGpu(), false) 83 : INHERITED(context->getGpu(), false)
84 , fDesc(desc.copy()) 84 , fDesc(desc.copy())
85 // We reserve a range of kMaxGlyphCount paths because of fallbacks fonts . We 85 // We reserve a range of kMaxGlyphCount paths because of fallbacks fonts . We
86 // can't know exactly how many glyphs we might need without preloading e very 86 // can't know exactly how many glyphs we might need without preloading e very
87 // fallback, which we don't want to do at this point. 87 // fallback, which we don't want to do at this point.
88 , fPathRange(context->getGpu()->createPathRange(kMaxGlyphCount, stroke)) { 88 , fPathRange(context->getGpu()->createPathRange(kMaxGlyphCount, stroke)) {
(...skipping 15 matching lines...) Expand all
104 fPathRange->abandon(); 104 fPathRange->abandon();
105 fPathRange.reset(NULL); 105 fPathRange.reset(NULL);
106 } 106 }
107 107
108 108
109 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) / kGlyphGroupSize; 109 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) / kGlyphGroupSize;
110 SkDescriptor* const fDesc; 110 SkDescriptor* const fDesc;
111 uint8_t fLoadedGlyphs[(kMaxGroupCount + 7) >> 3]; // One bit per glyph group 111 uint8_t fLoadedGlyphs[(kMaxGroupCount + 7) >> 3]; // One bit per glyph group
112 SkAutoTUnref<GrPathRange> fPathRange; 112 SkAutoTUnref<GrPathRange> fPathRange;
113 113
114 typedef GrGpuObject INHERITED; 114 typedef GrGpuResource INHERITED;
115 }; 115 };
116 116
117 117
118 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext( 118 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(
119 GrContext* context, const SkDeviceProperties& properties) 119 GrContext* context, const SkDeviceProperties& properties)
120 : GrTextContext(context, properties) 120 : GrTextContext(context, properties)
121 , fStroke(SkStrokeRec::kFill_InitStyle) 121 , fStroke(SkStrokeRec::kFill_InitStyle)
122 , fPendingGlyphCount(0) { 122 , fPendingGlyphCount(0) {
123 } 123 }
124 124
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 fGlyphCache = NULL; 418 fGlyphCache = NULL;
419 419
420 fDrawTarget->drawState()->stencil()->setDisabled(); 420 fDrawTarget->drawState()->stencil()->setDisabled();
421 fStateRestore.set(NULL); 421 fStateRestore.set(NULL);
422 if (fNeedsDeviceSpaceGlyphs) { 422 if (fNeedsDeviceSpaceGlyphs) {
423 fContext->setMatrix(fGlyphTransform); 423 fContext->setMatrix(fGlyphTransform);
424 } 424 }
425 GrTextContext::finish(); 425 GrTextContext::finish();
426 } 426 }
427 427
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache.cpp ('k') | src/gpu/GrStencilBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698