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

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: bug fix Created 6 years 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 * 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(GrDrawState* drawState,
66 bool hasLocalCoords, 66 bool hasLocalCoords,
67 GrColor color) { 67 GrColor color,
68 const SkMatrix* primProcLocalMa trix) {
68 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType | 69 uint32_t flags = GrDefaultGeoProcFactory::kPosition_GPType |
69 GrDefaultGeoProcFactory::kColor_GPType; 70 GrDefaultGeoProcFactory::kColor_GPType;
70 flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0; 71 flags |= hasLocalCoords ? GrDefaultGeoProcFactory::kLocalCoord_GPType : 0;
71 return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(color)) ; 72 if (primProcLocalMatrix) {
73 return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(col or), 0xff,
74 *primProcLocalMatrix);
75 } else {
76 return GrDefaultGeoProcFactory::Create(color, flags, GrColorIsOpaque(col or));
77 }
72 } 78 }
73 79
74 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin gs) { 80 static bool path_fill_type_is_winding(const GrStencilSettings& pathStencilSettin gs) {
75 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa ce; 81 static const GrStencilSettings::Face pathFace = GrStencilSettings::kFront_Fa ce;
76 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace); 82 bool isWinding = kInvert_StencilOp != pathStencilSettings.passOp(pathFace);
77 if (isWinding) { 83 if (isWinding) {
78 // Double check that it is in fact winding. 84 // Double check that it is in fact winding.
79 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace)); 85 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.passOp(pathFace));
80 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace)); 86 SkASSERT(kIncClamp_StencilOp == pathStencilSettings.failOp(pathFace));
81 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace)); 87 SkASSERT(0x1 != pathStencilSettings.writeMask(pathFace));
(...skipping 23 matching lines...) Expand all
105 static inline uint8_t add_trace_bit(uint8_t cmd) { return cmd | kTraceCmdBit; } 111 static inline uint8_t add_trace_bit(uint8_t cmd) { return cmd | kTraceCmdBit; }
106 112
107 static inline uint8_t strip_trace_bit(uint8_t cmd) { return cmd & kCmdMask; } 113 static inline uint8_t strip_trace_bit(uint8_t cmd) { return cmd & kCmdMask; }
108 114
109 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); } 115 static inline bool cmd_has_trace_marker(uint8_t cmd) { return SkToBool(cmd & kTr aceCmdBit); }
110 116
111 void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds, 117 void GrInOrderDrawBuffer::onDrawRect(GrDrawState* ds,
112 GrColor color, 118 GrColor color,
113 const SkRect& rect, 119 const SkRect& rect,
114 const SkRect* localRect, 120 const SkRect* localRect,
115 const SkMatrix* localMatrix) { 121 const SkMatrix* localMatrix,
122 const SkMatrix* primProcLocalMatrix) {
116 GrDrawState::AutoRestoreEffects are(ds); 123 GrDrawState::AutoRestoreEffects are(ds);
117 124
118 SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(ds, SkToBool(local Rect), color)); 125 SkAutoTUnref<const GrGeometryProcessor> gp(create_rect_gp(ds, SkToBool(local Rect), color,
126 primProcLocalMatri x));
119 127
120 size_t vstride = gp->getVertexStride(); 128 size_t vstride = gp->getVertexStride();
121 SkASSERT(vstride == sizeof(SkPoint) + sizeof(GrColor) + (SkToBool(localRect) ? sizeof(SkPoint) : 129 SkASSERT(vstride == sizeof(SkPoint) + sizeof(GrColor) + (SkToBool(localRect) ? sizeof(SkPoint) :
122 0)); 130 0));
123 AutoReleaseGeometry geo(this, 4, vstride, 0); 131 AutoReleaseGeometry geo(this, 4, vstride, 0);
124 if (!geo.succeeded()) { 132 if (!geo.succeeded()) {
125 SkDebugf("Failed to get space for vertices!\n"); 133 SkDebugf("Failed to get space for vertices!\n");
126 return; 134 return;
127 } 135 }
128 136
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 525
518 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() { 526 void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary() {
519 SkASSERT(!fCmdBuffer.empty()); 527 SkASSERT(!fCmdBuffer.empty());
520 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType)); 528 SkASSERT(!cmd_has_trace_marker(fCmdBuffer.back().fType));
521 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers(); 529 const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
522 if (activeTraceMarkers.count() > 0) { 530 if (activeTraceMarkers.count() > 0) {
523 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); 531 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType);
524 fGpuCmdMarkers.push_back(activeTraceMarkers); 532 fGpuCmdMarkers.push_back(activeTraceMarkers);
525 } 533 }
526 } 534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698