OLD | NEW |
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 "GrGpuGL.h" | 8 #include "GrGpuGL.h" |
9 | 9 |
10 #include "GrEffect.h" | 10 #include "GrEffect.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) | 203 #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
204 | 204 |
205 void GrGpuGL::flushPathStencilMatrix() { | 205 void GrGpuGL::flushPathStencilMatrix() { |
206 const SkMatrix& viewMatrix = this->getDrawState().getViewMatrix(); | 206 const SkMatrix& viewMatrix = this->getDrawState().getViewMatrix(); |
207 const GrRenderTarget* rt = this->getDrawState().getRenderTarget(); | 207 const GrRenderTarget* rt = this->getDrawState().getRenderTarget(); |
208 SkISize size; | 208 SkISize size; |
209 size.set(rt->width(), rt->height()); | 209 size.set(rt->width(), rt->height()); |
210 const SkMatrix& vm = this->getDrawState().getViewMatrix(); | 210 const SkMatrix& vm = this->getDrawState().getViewMatrix(); |
211 | 211 |
212 if (fHWPathStencilMatrixState.fRenderTargetOrigin != rt->origin() || | 212 if (fHWProjectionMatrixState.fRenderTargetOrigin != rt->origin() || |
213 !fHWPathStencilMatrixState.fViewMatrix.cheapEqualTo(viewMatrix) || | 213 !fHWProjectionMatrixState.fViewMatrix.cheapEqualTo(viewMatrix) || |
214 fHWPathStencilMatrixState.fRenderTargetSize!= size) { | 214 fHWProjectionMatrixState.fRenderTargetSize!= size) { |
215 // rescale the coords from skia's "device" coords to GL's normalized coo
rds, | 215 // rescale the coords from skia's "device" coords to GL's normalized coo
rds, |
216 // and perform a y-flip if required. | 216 // and perform a y-flip if required. |
217 SkMatrix m; | 217 SkMatrix m; |
218 if (kBottomLeft_GrSurfaceOrigin == rt->origin()) { | 218 if (kBottomLeft_GrSurfaceOrigin == rt->origin()) { |
219 m.setScale(SkIntToScalar(2) / rt->width(), SkIntToScalar(-2) / rt->h
eight()); | 219 m.setScale(SkIntToScalar(2) / rt->width(), SkIntToScalar(-2) / rt->h
eight()); |
220 m.postTranslate(-SK_Scalar1, SK_Scalar1); | 220 m.postTranslate(-SK_Scalar1, SK_Scalar1); |
221 } else { | 221 } else { |
222 m.setScale(SkIntToScalar(2) / rt->width(), SkIntToScalar(2) / rt->he
ight()); | 222 m.setScale(SkIntToScalar(2) / rt->width(), SkIntToScalar(2) / rt->he
ight()); |
223 m.postTranslate(-SK_Scalar1, -SK_Scalar1); | 223 m.postTranslate(-SK_Scalar1, -SK_Scalar1); |
224 } | 224 } |
(...skipping 17 matching lines...) Expand all Loading... |
242 0, 0, 0, 0, | 242 0, 0, 0, 0, |
243 | 243 |
244 // col3 | 244 // col3 |
245 SkScalarToFloat(m[SkMatrix::kMTransX]), | 245 SkScalarToFloat(m[SkMatrix::kMTransX]), |
246 SkScalarToFloat(m[SkMatrix::kMTransY]), | 246 SkScalarToFloat(m[SkMatrix::kMTransY]), |
247 0.0f, | 247 0.0f, |
248 SkScalarToFloat(m[SkMatrix::kMPersp2]) | 248 SkScalarToFloat(m[SkMatrix::kMPersp2]) |
249 }; | 249 }; |
250 GL_CALL(MatrixMode(GR_GL_PROJECTION)); | 250 GL_CALL(MatrixMode(GR_GL_PROJECTION)); |
251 GL_CALL(LoadMatrixf(mv)); | 251 GL_CALL(LoadMatrixf(mv)); |
252 fHWPathStencilMatrixState.fViewMatrix = vm; | 252 fHWProjectionMatrixState.fViewMatrix = vm; |
253 fHWPathStencilMatrixState.fRenderTargetSize = size; | 253 fHWProjectionMatrixState.fRenderTargetSize = size; |
254 fHWPathStencilMatrixState.fRenderTargetOrigin = rt->origin(); | 254 fHWProjectionMatrixState.fRenderTargetOrigin = rt->origin(); |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
opy) { | 258 bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC
opy) { |
259 const GrDrawState& drawState = this->getDrawState(); | 259 const GrDrawState& drawState = this->getDrawState(); |
260 | 260 |
261 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. | 261 // GrGpu::setupClipAndFlushState should have already checked this and bailed
if not true. |
262 SkASSERT(NULL != drawState.getRenderTarget()); | 262 SkASSERT(NULL != drawState.getRenderTarget()); |
263 | 263 |
264 if (kStencilPath_DrawType == type) { | 264 if (kStencilPath_DrawType == type) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 GrGLAttribTypeToLayout(attribType).fCount, | 398 GrGLAttribTypeToLayout(attribType).fCount, |
399 GrGLAttribTypeToLayout(attribType).fType, | 399 GrGLAttribTypeToLayout(attribType).fType, |
400 GrGLAttribTypeToLayout(attribType).fNormalized, | 400 GrGLAttribTypeToLayout(attribType).fNormalized, |
401 stride, | 401 stride, |
402 reinterpret_cast<GrGLvoid*>( | 402 reinterpret_cast<GrGLvoid*>( |
403 vertexOffsetInBytes + vertexAttrib->fOffset)); | 403 vertexOffsetInBytes + vertexAttrib->fOffset)); |
404 } | 404 } |
405 | 405 |
406 attribState->disableUnusedAttribArrays(this, usedAttribArraysMask); | 406 attribState->disableUnusedAttribArrays(this, usedAttribArraysMask); |
407 } | 407 } |
OLD | NEW |