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

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

Issue 1196683003: remove SkDeviceProperties (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 5 years, 6 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAARectRenderer.h" 9 #include "GrAARectRenderer.h"
10 #include "GrAtlasTextContext.h" 10 #include "GrAtlasTextContext.h"
(...skipping 16 matching lines...) Expand all
27 public: 27 public:
28 AutoCheckFlush(GrContext* context) : fContext(context) { SkASSERT(context); } 28 AutoCheckFlush(GrContext* context) : fContext(context) { SkASSERT(context); }
29 ~AutoCheckFlush() { fContext->flushIfNecessary(); } 29 ~AutoCheckFlush() { fContext->flushIfNecessary(); }
30 30
31 private: 31 private:
32 GrContext* fContext; 32 GrContext* fContext;
33 }; 33 };
34 34
35 GrDrawContext::GrDrawContext(GrContext* context, 35 GrDrawContext::GrDrawContext(GrContext* context,
36 GrDrawTarget* drawTarget, 36 GrDrawTarget* drawTarget,
37 const SkDeviceProperties& devProps) 37 const SkSurfaceProps& surfaceProps)
38 : fContext(context) 38 : fContext(context)
39 , fDrawTarget(SkRef(drawTarget)) 39 , fDrawTarget(SkRef(drawTarget))
40 , fTextContext(NULL) 40 , fTextContext(NULL)
41 , fDevProps(SkNEW_ARGS(SkDeviceProperties, (devProps))) { 41 , fSurfaceProps(surfaceProps) {
42 } 42 }
43 43
44 GrDrawContext::~GrDrawContext() { 44 GrDrawContext::~GrDrawContext() {
45 SkSafeUnref(fDrawTarget); 45 SkSafeUnref(fDrawTarget);
46 SkDELETE(fTextContext); 46 SkDELETE(fTextContext);
47 SkDELETE(fDevProps);
48 } 47 }
49 48
50 void GrDrawContext::copySurface(GrRenderTarget* dst, GrSurface* src, 49 void GrDrawContext::copySurface(GrRenderTarget* dst, GrSurface* src,
51 const SkIRect& srcRect, const SkIPoint& dstPoint ) { 50 const SkIRect& srcRect, const SkIPoint& dstPoint ) {
52 if (!this->prepareToDraw(dst)) { 51 if (!this->prepareToDraw(dst)) {
53 return; 52 return;
54 } 53 }
55 54
56 fDrawTarget->copySurface(dst, src, srcRect, dstPoint); 55 fDrawTarget->copySurface(dst, src, srcRect, dstPoint);
57 } 56 }
58 57
59 GrTextContext* GrDrawContext::createTextContext(GrRenderTarget* renderTarget, 58 GrTextContext* GrDrawContext::createTextContext(GrRenderTarget* renderTarget,
60 const SkDeviceProperties& leakyP roperties) { 59 const SkSurfaceProps& surfacePro ps) {
61 if (fContext->caps()->shaderCaps()->pathRenderingSupport() && 60 if (fContext->caps()->shaderCaps()->pathRenderingSupport() &&
62 renderTarget->isStencilBufferMultisampled()) { 61 renderTarget->isStencilBufferMultisampled()) {
63 GrStencilAttachment* sb = renderTarget->renderTargetPriv().attachStencil Attachment(); 62 GrStencilAttachment* sb = renderTarget->renderTargetPriv().attachStencil Attachment();
64 if (sb) { 63 if (sb) {
65 return GrStencilAndCoverTextContext::Create(fContext, this, leakyPro perties); 64 return GrStencilAndCoverTextContext::Create(fContext, this, surfaceP rops);
66 } 65 }
67 } 66 }
68 67
69 return GrAtlasTextContext::Create(fContext, this, leakyProperties); 68 return GrAtlasTextContext::Create(fContext, this, surfaceProps);
70 } 69 }
71 70
72 void GrDrawContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& grPaint, 71 void GrDrawContext::drawText(GrRenderTarget* rt, const GrClip& clip, const GrPai nt& grPaint,
73 const SkPaint& skPaint, 72 const SkPaint& skPaint,
74 const SkMatrix& viewMatrix, 73 const SkMatrix& viewMatrix,
75 const char text[], size_t byteLength, 74 const char text[], size_t byteLength,
76 SkScalar x, SkScalar y, const SkIRect& clipBounds) { 75 SkScalar x, SkScalar y, const SkIRect& clipBounds) {
77 if (!fTextContext) { 76 if (!fTextContext) {
78 fTextContext = this->createTextContext(rt, *fDevProps); 77 fTextContext = this->createTextContext(rt, fSurfaceProps);
79 } 78 }
80 79
81 fTextContext->drawText(rt, clip, grPaint, skPaint, viewMatrix, 80 fTextContext->drawText(rt, clip, grPaint, skPaint, viewMatrix,
82 text, byteLength, x, y, clipBounds); 81 text, byteLength, x, y, clipBounds);
83 82
84 } 83 }
85 void GrDrawContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr Paint& grPaint, 84 void GrDrawContext::drawPosText(GrRenderTarget* rt, const GrClip& clip, const Gr Paint& grPaint,
86 const SkPaint& skPaint, 85 const SkPaint& skPaint,
87 const SkMatrix& viewMatrix, 86 const SkMatrix& viewMatrix,
88 const char text[], size_t byteLength, 87 const char text[], size_t byteLength,
89 const SkScalar pos[], int scalarsPerPosition, 88 const SkScalar pos[], int scalarsPerPosition,
90 const SkPoint& offset, const SkIRect& clipBounds ) { 89 const SkPoint& offset, const SkIRect& clipBounds ) {
91 if (!fTextContext) { 90 if (!fTextContext) {
92 fTextContext = this->createTextContext(rt, *fDevProps); 91 fTextContext = this->createTextContext(rt, fSurfaceProps);
93 } 92 }
94 93
95 fTextContext->drawPosText(rt, clip, grPaint, skPaint, viewMatrix, text, byte Length, 94 fTextContext->drawPosText(rt, clip, grPaint, skPaint, viewMatrix, text, byte Length,
96 pos, scalarsPerPosition, offset, clipBounds); 95 pos, scalarsPerPosition, offset, clipBounds);
97 96
98 } 97 }
99 void GrDrawContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, const S kPaint& skPaint, 98 void GrDrawContext::drawTextBlob(GrRenderTarget* rt, const GrClip& clip, const S kPaint& skPaint,
100 const SkMatrix& viewMatrix, const SkTextBlob* b lob, 99 const SkMatrix& viewMatrix, const SkTextBlob* b lob,
101 SkScalar x, SkScalar y, 100 SkScalar x, SkScalar y,
102 SkDrawFilter* filter, const SkIRect& clipBounds ) { 101 SkDrawFilter* filter, const SkIRect& clipBounds ) {
103 if (!fTextContext) { 102 if (!fTextContext) {
104 fTextContext = this->createTextContext(rt, *fDevProps); 103 fTextContext = this->createTextContext(rt, fSurfaceProps);
105 } 104 }
106 105
107 fTextContext->drawTextBlob(rt, clip, skPaint, viewMatrix, blob, x, y, filter , clipBounds); 106 fTextContext->drawTextBlob(rt, clip, skPaint, viewMatrix, blob, x, y, filter , clipBounds);
108 } 107 }
109 108
110 void GrDrawContext::drawPaths(GrPipelineBuilder* pipelineBuilder, 109 void GrDrawContext::drawPaths(GrPipelineBuilder* pipelineBuilder,
111 const GrPathProcessor* pathProc, 110 const GrPathProcessor* pathProc,
112 const GrPathRange* pathRange, 111 const GrPathRange* pathRange,
113 const void* indices, 112 const void* indices,
114 int /*GrDrawTarget::PathIndexType*/ indexType, 113 int /*GrDrawTarget::PathIndexType*/ indexType,
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 return DrawVerticesBatch::Create(geometry, type, viewMatrix, 1327 return DrawVerticesBatch::Create(geometry, type, viewMatrix,
1329 positions.begin(), vertexCount, 1328 positions.begin(), vertexCount,
1330 indices.begin(), hasIndices ? vertexCount : 0, 1329 indices.begin(), hasIndices ? vertexCount : 0,
1331 colors.begin(), 1330 colors.begin(),
1332 texCoords.begin(), 1331 texCoords.begin(),
1333 bounds); 1332 bounds);
1334 } 1333 }
1335 1334
1336 #endif 1335 #endif
1337 1336
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrLayerHoister.cpp » ('j') | src/gpu/SkGpuDevice.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698