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

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

Issue 817853002: Remove localcoordchange functions off paint (Closed) Base URL: https://skia.googlesource.com/skia.git@local-matrix-on-gp
Patch Set: changing ignores Created 5 years, 12 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/GrDrawTarget.h ('k') | src/gpu/GrOvalRenderer.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 2011 Google Inc. 2 * Copyright 2011 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 "GrInOrderDrawBuffer.h" 8 #include "GrInOrderDrawBuffer.h"
9 9
10 #include "GrDefaultGeoProcFactory.h" 10 #include "GrDefaultGeoProcFactory.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 /** We always use per-vertex colors so that rects can be batched across color ch anges. Sometimes we 55 /** We always use per-vertex colors so that rects can be batched across color ch anges. Sometimes we
56 have explicit local coords and sometimes not. We *could* always provide expl icit local coords 56 have explicit local coords and sometimes not. We *could* always provide expl icit local coords
57 and just duplicate the positions when the caller hasn't provided a local coo rd rect, but we 57 and just duplicate the positions when the caller hasn't provided a local coo rd rect, but we
58 haven't seen a use case which frequently switches between local rect and no local rect draws. 58 haven't seen a use case which frequently switches between local rect and no local rect draws.
59 59
60 The color param is used to determine whether the opaque hint can be set on t he draw state. 60 The color param is used to determine whether the opaque hint can be set on t he draw state.
61 The caller must populate the vertex colors itself. 61 The caller must populate the vertex colors itself.
62 62
63 The vertex attrib order is always pos, color, [local coords]. 63 The vertex attrib order is always pos, color, [local coords].
64 */ 64 */
65 static const GrGeometryProcessor* create_rect_gp(GrDrawState* drawState, 65 static const GrGeometryProcessor* create_rect_gp(bool hasExplicitLocalCoords,
66 bool hasLocalCoords, 66 GrColor color,
67 GrColor color) { 67 const SkMatrix* localMatrix) {
68 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType | 68 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
69 GrDefaultGeoProcFactory::kColor_GPType; 69 GrDefaultGeoProcFactory::kColor_GPType;
70 flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0; 70 flags |= hasExplicitLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPTyp e : 0;
71 return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(color)) ; 71 if (localMatrix) {
72 return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(col or), 0xff,
73 *localMatrix);
74 } else {
75 return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(col or));
76 }
72 } 77 }
73 78
74 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin gs) { 79 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin gs) {
75 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa ce; 80 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa ce;
76 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace); 81 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace);
77 if (isWinding) { 82 if (isWinding) {
78 // Double check that it is in fact winding. 83 // Double check that it is in fact winding.
79 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace)); 84 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace));
80 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace)); 85 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace));
81 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace)); 86 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace));
(...skipping 26 matching lines...) Expand all
108 113
109 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); } 114 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); }
110 115
111 void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds, 116 void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
112 GrColor color, 117 GrColor color,
113 const SkRect& rect, 118 const SkRect& rect,
114 const SkRect* localRect, 119 const SkRect* localRect,
115 const SkMatrix* localMatrix) { 120 const SkMatrix* localMatrix) {
116 GrDrawState::AutoRestoreEffects are(ds); 121 GrDrawState::AutoRestoreEffects are(ds);
117 122
118 SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(ds, SkToBool(local Rect), color)); 123 bool hasExplicitLocalCoords = SkToBool(localRect);
124 SkAutoTUnref<const GrGeometryProcessor> gp(
125 create_rect_gp(hasExplicitLocalCoords,
126 color,
127 hasExplicitLocalCoords ? NULL : localMatrix));
119 128
120 size_t vstride = gp->getVertexStride(); 129 size_t vstride = gp->getVertexStride();
121 SkASSERT(vstride == sizeof(SkPoint) + sizeof(GrColor) + (SkToBool(localRect) ? sizeof(SkPoint) : 130 SkASSERT(vstride == sizeof(SkPoint) + sizeof(GrColor) + (SkToBool(localRect) ? sizeof(SkPoint) :
122 0)); 131 0));
123 AutoReleaseGeometry geo(this, 4, vstride, 0); 132 AutoReleaseGeometry geo(this, 4, vstride, 0);
124 if (!geo.succeeded()) { 133 if (!geo.succeeded()) {
125 SkDebugf("Failed to get space for vertices!\n"); 134 SkDebugf("Failed to get space for vertices!\n");
126 return; 135 return;
127 } 136 }
128 137
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 526
518 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { 527 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() {
519 SkASSERT(!fCmdBuffer.empty()); 528 SkASSERT(!fCmdBuffer.empty());
520 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); 529 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType));
521 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); 530 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
522 if (activeTraceMarkers.count() > 0) { 531 if (activeTraceMarkers.count() > 0) {
523 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); 532 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType);
524 fGpuCmdMarkers.push_back(activeTraceMarkers); 533 fGpuCmdMarkers.push_back(activeTraceMarkers);
525 } 534 }
526 } 535 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698